[FFmpeg-cvslog] Revert "swfenc: use av_get_audio_frame_duration() instead of AVCodecContext .frame_size"

Carl Eugen Hoyos git at videolan.org
Sun Feb 17 21:04:14 CET 2013


ffmpeg | branch: release/0.11 | Carl Eugen Hoyos <cehoyos at ag.or.at> | Sun Feb 17 20:55:37 2013 +0100| [381e3e7e44f9ca9726b5c8ae8ab731daec67e6fd] | committer: Carl Eugen Hoyos

Revert "swfenc: use av_get_audio_frame_duration() instead of AVCodecContext.frame_size"

This reverts commit 620b88a302d522f71a6a95aff500cf7bd8520043.

Fixes ticket #2272.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=381e3e7e44f9ca9726b5c8ae8ab731daec67e6fd
---

 libavformat/swfenc.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 8177ffa..b165b46 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -187,6 +187,10 @@ static int swf_write_header(AVFormatContext *s)
         AVCodecContext *enc = s->streams[i]->codec;
         if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
             if (enc->codec_id == CODEC_ID_MP3) {
+                if (!enc->frame_size) {
+                    av_log(s, AV_LOG_ERROR, "audio frame size not set\n");
+                    return -1;
+                }
                 swf->audio_enc = enc;
                 swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE);
                 if (!swf->audio_fifo)
@@ -448,7 +452,7 @@ static int swf_write_audio(AVFormatContext *s,
     }
 
     av_fifo_generic_write(swf->audio_fifo, buf, size, NULL);
-    swf->sound_samples += av_get_audio_frame_duration(enc, size);
+    swf->sound_samples += enc->frame_size;
 
     /* if audio only stream make sure we add swf frames */
     if (!swf->video_enc)



More information about the ffmpeg-cvslog mailing list