diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-04 04:06:49 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-04 04:27:01 +0100 |
commit | 337fa0dbe7b12977ba11d0ba0e6088daa6917453 (patch) | |
tree | 1eaa35a55aa54b1bbf63b001220f138f86e7b84e | |
parent | b8afbbca9c4e96881e8e22018c675ed5b915fea6 (diff) | |
download | ffmpeg-337fa0dbe7b12977ba11d0ba0e6088daa6917453.tar.gz |
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@gmx.at>
-rw-r--r-- | libavformat/utils.c | 2 | ||||
-rw-r--r-- | tests/ref/fate/wtv-demux | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index bf8abeec68..dce34449ba 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 d20d041432..fadc4ef20d 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 |