mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
libfdk-aacdec: Reduce the default decoder delay by one frame
The default error concealment method if none is set via aacDecoder_SetParam(AAC_CONCEAL_METHOD) is set in CConcealment_InitCommonData within the fdk-aac library and is set to Energy Interpolation. This method requires one frame delay to the output. To reduce the default decoder output delay and avoid missing the last frame in file based decoding, use Noise Substitution as the default concealment method. Signed-off-by: Omer Osman <omer.osman@iis.fraunhofer.de> Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
391ecc961c
commit
e0bfe34ea8
@ -26,7 +26,6 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
enum ConcealMethod {
|
enum ConcealMethod {
|
||||||
CONCEAL_METHOD_DEFAULT = -1,
|
|
||||||
CONCEAL_METHOD_SPECTRAL_MUTING = 0,
|
CONCEAL_METHOD_SPECTRAL_MUTING = 0,
|
||||||
CONCEAL_METHOD_NOISE_SUBSTITUTION = 1,
|
CONCEAL_METHOD_NOISE_SUBSTITUTION = 1,
|
||||||
CONCEAL_METHOD_ENERGY_INTERPOLATION = 2,
|
CONCEAL_METHOD_ENERGY_INTERPOLATION = 2,
|
||||||
@ -43,8 +42,7 @@ typedef struct FDKAACDecContext {
|
|||||||
#define OFFSET(x) offsetof(FDKAACDecContext, x)
|
#define OFFSET(x) offsetof(FDKAACDecContext, x)
|
||||||
#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
|
#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
|
||||||
static const AVOption fdk_aac_dec_options[] = {
|
static const AVOption fdk_aac_dec_options[] = {
|
||||||
{ "conceal", "Error concealment method", OFFSET(conceal_method), AV_OPT_TYPE_INT, { .i64 = CONCEAL_METHOD_DEFAULT }, CONCEAL_METHOD_DEFAULT, CONCEAL_METHOD_NB - 1, AD, "conceal" },
|
{ "conceal", "Error concealment method", OFFSET(conceal_method), AV_OPT_TYPE_INT, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, CONCEAL_METHOD_SPECTRAL_MUTING, CONCEAL_METHOD_NB - 1, AD, "conceal" },
|
||||||
{ "default", "Default", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_DEFAULT }, INT_MIN, INT_MAX, AD, "conceal" },
|
|
||||||
{ "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, "conceal" },
|
{ "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, "conceal" },
|
||||||
{ "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, "conceal" },
|
{ "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, "conceal" },
|
||||||
{ "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, "conceal" },
|
{ "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, "conceal" },
|
||||||
@ -195,12 +193,10 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->conceal_method != CONCEAL_METHOD_DEFAULT) {
|
if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
|
||||||
if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD,
|
s->conceal_method)) != AAC_DEC_OK) {
|
||||||
s->conceal_method)) != AAC_DEC_OK) {
|
av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
|
||||||
av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n");
|
return AVERROR_UNKNOWN;
|
||||||
return AVERROR_UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 55
|
#define LIBAVCODEC_VERSION_MAJOR 55
|
||||||
#define LIBAVCODEC_VERSION_MINOR 55
|
#define LIBAVCODEC_VERSION_MINOR 55
|
||||||
#define LIBAVCODEC_VERSION_MICRO 0
|
#define LIBAVCODEC_VERSION_MICRO 1
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
LIBAVCODEC_VERSION_MINOR, \
|
LIBAVCODEC_VERSION_MINOR, \
|
||||||
|
Loading…
Reference in New Issue
Block a user