From 1e8f6320e8bb914c5dce50a90c8ae290bb5d9919 Mon Sep 17 00:00:00 2001 From: Mladen Milinkovic Date: Thu, 1 Aug 2024 11:27:22 +0200 Subject: [PATCH 09/11] StreamProcessor: stop using AVFrame::duration Calculate duration as duration field might be unknown, and duration/pkt_duration do not exist on FFmpeg 5/6 --- src/streamprocessor/streamprocessor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp index b30c9631..f27fa667 100644 --- a/src/streamprocessor/streamprocessor.cpp +++ b/src/streamprocessor/streamprocessor.cpp @@ -447,8 +447,7 @@ StreamProcessor::processAudio() timeFrameDuration = frameResampled->nb_samples * 1000 / frameResampled->sample_rate; } else { frameSize = frame->nb_samples * av_get_bytes_per_sample(static_cast(frame->format)); - if(frame->duration) - timeFrameDuration = frame->duration * 1000 * m_avStream->time_base.num / m_avStream->time_base.den; + timeFrameDuration = int64_t(frame->nb_samples) * 1000 / frame->sample_rate; } timeFrameEnd = timeFrameStart + timeFrameDuration; -- 2.46.0