[FFmpeg] Deduce the length from the container

Determine the length of the file from the container, rather than the
individual audio stream. The former is more likely to be set than the
latter is.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-25 00:05:57 -07:00
parent 3de7a34eb8
commit 72572c9c7f
1 changed files with 1 additions and 1 deletions

View File

@ -424,7 +424,7 @@ static uint8_t reverse_bits[0x100];
// totalFrames = codecCtx->sample_rate * ((float)formatCtx->duration/AV_TIME_BASE);
AVRational tb = { .num = 1, .den = codecCtx->sample_rate };
totalFrames = isStream ? 0 : av_rescale_q(stream->duration, stream->time_base, tb);
totalFrames = isStream ? 0 : av_rescale_q(formatCtx->duration, AV_TIME_BASE_Q, tb);
bitrate = (int)((codecCtx->bit_rate) / 1000);
framesRead = 0;
endOfStream = NO;