media/ffmpeg: Fix frameCount calculation when the stream duration is unset.
Fixes #18844.
This commit is contained in:
parent
04ac3d9687
commit
3a3b54380a
@ -1265,8 +1265,12 @@ AVFormatReader::Stream::GetStreamInfo(int64* frameCount,
|
||||
*frameCount = fStream->nb_frames * fStream->codecpar->frame_size;
|
||||
if (*frameCount == 0) {
|
||||
// Calculate from duration and frame rate
|
||||
*frameCount = (int64)(fStream->duration * frameRate
|
||||
* fStream->time_base.num / fStream->time_base.den);
|
||||
if (fStream->duration != AV_NOPTS_VALUE) {
|
||||
*frameCount = (int64)(fStream->duration * frameRate
|
||||
* fStream->time_base.num / fStream->time_base.den);
|
||||
} else if (fContext->duration != AV_NOPTS_VALUE) {
|
||||
*frameCount = (fContext->duration * frameRate);
|
||||
}
|
||||
TRACE(" frameCount calculated: %" B_PRIu64 ", from context: %" B_PRIu64 "\n",
|
||||
*frameCount, fStream->nb_frames);
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user