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>
This commit is contained in:
Michael Niedermayer 2012-03-04 04:06:49 +01:00
parent b8afbbca9c
commit 337fa0dbe7
2 changed files with 7 additions and 7 deletions

View File

@ -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;
}

View File

@ -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