[FFmpeg-cvslog] lavfi: ensure audio frame durations match the sample count

Anton Khirnov git at videolan.org
Wed Apr 19 22:16:09 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Apr 14 09:01:31 2023 +0200| [e392674399e19c104e5b13f37440facd7f3dcd6c] | committer: Anton Khirnov

lavfi: ensure audio frame durations match the sample count

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e392674399e19c104e5b13f37440facd7f3dcd6c
---

 libavfilter/avfilter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8d5702a0c8..d2e9ba47ef 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -997,6 +997,14 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
             av_log(link->dst, AV_LOG_ERROR, "Sample rate change is not supported\n");
             goto error;
         }
+
+        frame->duration = av_rescale_q(frame->nb_samples, (AVRational){ 1, frame->sample_rate },
+                                       link->time_base);
+#if FF_API_PKT_DURATION
+FF_DISABLE_DEPRECATION_WARNINGS
+        frame->pkt_duration = frame->duration;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     }
 
     link->frame_blocked_in = link->frame_wanted_out = 0;



More information about the ffmpeg-cvslog mailing list