[FFmpeg-cvslog] lavf: Do not compute the packet duration based on the bitrate if the frame_size can be determined .

Michael Niedermayer git at videolan.org
Sun Mar 4 04:47:45 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar  4 04:06:49 2012 +0100| [337fa0dbe7b12977ba11d0ba0e6088daa6917453] | committer: Michael Niedermayer

lavf: Do not compute the packet duration based on the bitrate if the frame_size can be determined.

This fixes issues when the bitrate is variable or inaccurate but the
frame size has not been determined yet.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/utils.c      |    2 +-
 tests/ref/fate/wtv-demux |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index bf8abee..dce3444 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -779,7 +779,7 @@ static int get_audio_frame_size(AVCodecContext *enc, int size)
             frame_size = (size << 3) / (bits_per_sample * enc->channels);
         } else {
             /* used for example by ADPCM codecs */
-            if (enc->bit_rate == 0)
+            if (enc->bit_rate == 0 || determinable_frame_size(enc))
                 return -1;
             frame_size = ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate;
         }
diff --git a/tests/ref/fate/wtv-demux b/tests/ref/fate/wtv-demux
index d20d041..fadc4ef 100644
--- a/tests/ref/fate/wtv-demux
+++ b/tests/ref/fate/wtv-demux
@@ -1,11 +1,11 @@
 #tb 0: 1/10000000
 #tb 1: 1/10000000
-1,         -2,         -2,   180000,      576, 0x9b6e1638
-1,     179998,     179998,   240000,      576, 0x0ca91183
-1,     419998,     419998,   240000,      576, 0xec6a180f
-1,     659998,     659998,   240000,      576, 0x478a2b9b
-1,     899998,     899998,   240000,      576, 0x00fa15b3
-1,    1139998,    1139998,   240000,      576, 0xfb551816
+1,         -2,         -2,   240000,      576, 0x9b6e1638
+1,     239998,     239998,   240000,      576, 0x0ca91183
+1,     479998,     479998,   240000,      576, 0xec6a180f
+1,     719998,     719998,   240000,      576, 0x478a2b9b
+1,     959998,     959998,   240000,      576, 0x00fa15b3
+1,    1199998,    1199998,   240000,      576, 0xfb551816
 1,    1439998,    1439998,   240000,      576, 0x422e12bd
 1,    1679998,    1679998,   240000,      576, 0xa7581b29
 1,    1919998,    1919998,   240000,      576, 0xd4b31a74



More information about the ffmpeg-cvslog mailing list