[FFmpeg-devel] [PATCH 5/7] fftools/sync_queue: update audio frame duration when re-chunking

Anton Khirnov anton at khirnov.net
Fri Apr 14 19:42:42 EEST 2023


---
 fftools/sync_queue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/sync_queue.c b/fftools/sync_queue.c
index 42a6b89b79..a7aac04047 100644
--- a/fftools/sync_queue.c
+++ b/fftools/sync_queue.c
@@ -431,7 +431,7 @@ static int receive_samples(SyncQueue *sq, SyncQueueStream *st,
         offset_audio(src.f, nb_samples);
         st->samples_queued -= nb_samples;
 
-        return 0;
+        goto finish;
     }
 
     // otherwise allocate a new frame and copy the data
@@ -474,6 +474,10 @@ static int receive_samples(SyncQueue *sq, SyncQueueStream *st,
         dst->nb_samples += to_copy;
     }
 
+finish:
+    dst->duration   = av_rescale_q(nb_samples, (AVRational){ 1, dst->sample_rate },
+                                   dst->time_base);
+
     return 0;
 
 fail:
-- 
2.39.1



More information about the ffmpeg-devel mailing list