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