[FFmpeg-devel] [PATCH 2/5] libmp3lame + mp3enc: removes decoder delay compensation
Jon Toohill
jtoohill at google.com
Wed Jul 13 02:19:53 EEST 2016
initial_padding specifies only encoder delay, decoder delay is
handled by start_skip_samples.
---
doc/APIchanges | 4 ++++
libavcodec/libmp3lame.c | 2 +-
libavcodec/version.h | 2 +-
libavformat/mp3enc.c | 4 ++--
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index d777dc0..ae450e1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@ libavutil: 2015-08-28
API changes, most recent first:
+2016-07-12 - xxxxxxx - lavc 57.47.100 - libmp3lame.c
+ Removed MP3 decoder delay from initial_padding in AVCodecContext.
+ initial_padding only includes the encoder delay.
+
2016-04-27 - xxxxxxx - lavu 55.23.100 - log.h
Add a new function av_log_format_line2() which returns number of bytes
written to the target buffer.
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 5642264..198ac94 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -137,7 +137,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
}
/* get encoder delay */
- avctx->initial_padding = lame_get_encoder_delay(s->gfp) + 528 + 1;
+ avctx->initial_padding = lame_get_encoder_delay(s->gfp);
ff_af_queue_init(avctx, &s->afq);
avctx->frame_size = lame_get_framesize(s->gfp);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0852b43..37a6e17 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 46
+#define LIBAVCODEC_VERSION_MINOR 47
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index de63401..3b77d29 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -249,10 +249,10 @@ static int mp3_write_xing(AVFormatContext *s)
avio_w8(dyn_ctx, 0); // unknown abr/minimal bitrate
// encoder delay
- if (par->initial_padding - 528 - 1 >= 1 << 12) {
+ if (par->initial_padding >= 1 << 12) {
av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
}
- avio_wb24(dyn_ctx, FFMAX(par->initial_padding - 528 - 1, 0)<<12);
+ avio_wb24(dyn_ctx, par->initial_padding << 12);
avio_w8(dyn_ctx, 0); // misc
avio_w8(dyn_ctx, 0); // mp3gain
--
2.8.0.rc3.226.g39d4020
More information about the ffmpeg-devel
mailing list