[FFmpeg-devel] [PATCH v2 6/8] avfilter/silencedetect: fix for ticket 6968 Fix missing log of silence_end at end of stream
Michael Niedermayer
michael at niedermayer.cc
Tue Feb 13 17:26:24 EET 2018
On Mon, Feb 12, 2018 at 10:48:28AM +0100, Nicolas Gaullier wrote:
> From: nicolas gaullier <nicolas.gaullier at arkena.com>
>
> ---
> libavfilter/af_silencedetect.c | 33 +++++++++++++++++++++++++++------
> 1 file changed, 27 insertions(+), 6 deletions(-)
>
> diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
> index 8973049fe5..723136c2a8 100644
> --- a/libavfilter/af_silencedetect.c
> +++ b/libavfilter/af_silencedetect.c
> @@ -41,7 +41,9 @@ typedef struct SilenceDetectContext {
> int independant_channels; ///< number of entries in following arrays (always 1 in mono mode)
> int64_t *nb_null_samples; ///< (array) current number of continuous zero samples
> int64_t *start; ///< (array) if silence is detected, this value contains the time of the first zero sample (default/unset = INT64_MIN)
> + int64_t frame_end; ///< pts of the end of the current frame (used to compute duration of silence at EOS)
> int last_sample_rate; ///< last sample rate to check for sample rate changes
> + AVRational time_base; ///< time_base
>
> void (*silencedetect)(struct SilenceDetectContext *s, AVFrame *insamples,
> int nb_samples, int64_t nb_samples_notify,
> @@ -92,13 +94,16 @@ static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples,
> }
> } else {
> if (s->start[channel] > INT64_MIN) {
> - int64_t end_pts = insamples->pts + av_rescale_q(current_sample / s->channels,
> - (AVRational){ 1, s->last_sample_rate }, time_base);
> + int64_t end_pts = insamples ? insamples->pts + av_rescale_q(current_sample / s->channels,
> + (AVRational){ 1, s->last_sample_rate }, time_base)
> + : s->frame_end;
> int64_t duration_ts = end_pts - s->start[channel];
> - set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end",
> - av_ts2timestr(end_pts, &time_base));
> - set_meta(insamples, s->mono ? channel + 1 : 0, "silence_duration",
> - av_ts2timestr(duration_ts, &time_base));
> + if (insamples) {
> + set_meta(insamples, s->mono ? channel + 1 : 0, "silence_end",
> + av_ts2timestr(end_pts, &time_base));
> + set_meta(insamples, s->mono ? channel + 1 : 0, "silence_duration",
> + av_ts2timestr(duration_ts, &stime_base));
^
this does not build, and looks like a typo
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180213/b80670d4/attachment.sig>
More information about the ffmpeg-devel
mailing list