[FFmpeg-cvslog] avfilter/af_silenceremove: fix regression in output frame pts

Paul B Mahol git at videolan.org
Thu Sep 9 21:24:10 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Sep  9 20:20:13 2021 +0200| [abd24eaf688d4987c75be0816abf5eb49ccaa28f] | committer: Paul B Mahol

avfilter/af_silenceremove: fix regression in output frame pts

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

 libavfilter/af_silenceremove.c | 29 ++++-------------------------
 1 file changed, 4 insertions(+), 25 deletions(-)

diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c
index 6f3250bbb1..e8e79e93f4 100644
--- a/libavfilter/af_silenceremove.c
+++ b/libavfilter/af_silenceremove.c
@@ -561,11 +561,6 @@ static void flush(SilenceRemoveContext *s,
     if (*nb_samples_written) {
         out->nb_samples = *nb_samples_written;
 
-        out->pts = s->next_pts;
-        s->next_pts += av_rescale_q(out->nb_samples,
-                                    (AVRational){1, outlink->sample_rate},
-                                    outlink->time_base);
-
         av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples);
         *nb_samples_written = 0;
     }
@@ -596,11 +591,6 @@ static void flush(SilenceRemoveContext *s,
     s->stop_silence_offset = 0;
     s->stop_silence_end = 0;
 
-    silence->pts = s->next_pts;
-    s->next_pts += av_rescale_q(silence->nb_samples,
-                                (AVRational){1, outlink->sample_rate},
-                                outlink->time_base);
-
     av_audio_fifo_write(s->fifo, (void **)silence->extended_data, silence->nb_samples);
     av_frame_free(&silence);
 }
@@ -724,11 +714,6 @@ silence_trim_flush:
                         s->start_holdoff_offset, nbs,
                         outlink->channels, outlink->format);
 
-        out->pts = s->next_pts;
-        s->next_pts += av_rescale_q(out->nb_samples,
-                                    (AVRational){1, outlink->sample_rate},
-                                    outlink->time_base);
-
         s->start_holdoff_offset += nbs;
 
         av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples);
@@ -848,11 +833,6 @@ silence_copy:
                             nb_samples_read, nbs,
                             outlink->channels, outlink->format);
 
-            out->pts = s->next_pts;
-            s->next_pts += av_rescale_q(out->nb_samples,
-                                        (AVRational){1, outlink->sample_rate},
-                                        outlink->time_base);
-
             av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples);
             av_frame_free(&out);
         }
@@ -876,11 +856,6 @@ silence_copy_flush:
 
         s->stop_holdoff_offset += nbs;
 
-        out->pts = s->next_pts;
-        s->next_pts += av_rescale_q(out->nb_samples,
-                                    (AVRational){1, outlink->sample_rate},
-                                    outlink->time_base);
-
         av_audio_fifo_write(s->fifo, (void **)out->extended_data, out->nb_samples);
         av_frame_free(&out);
 
@@ -909,6 +884,10 @@ silence_stop:
 
         av_audio_fifo_read(s->fifo, (void **)out->extended_data, out->nb_samples);
         out->pts = s->next_pts;
+        s->next_pts += av_rescale_q(out->nb_samples,
+                                    (AVRational){1, outlink->sample_rate},
+                                    outlink->time_base);
+
         ret = ff_filter_frame(outlink, out);
     }
 



More information about the ffmpeg-cvslog mailing list