[FFmpeg-cvslog] lavfi/asettb: do not create a new reference in filter_samples()
Stefano Sabatini
git at videolan.org
Tue Jul 31 13:32:42 CEST 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Mon Jul 30 14:58:22 2012 +0200| [b4c3359828d232d8e81c1bff2dcbbca773dee2d7] | committer: Stefano Sabatini
lavfi/asettb: do not create a new reference in filter_samples()
There is no need to duplicate the input reference, since a filter should
not pass along a reference which is later modified. If this happens the
filter passing the reference should be fixed.
Also improve consistency with start_frame() of settb, allowing a pending
factorization.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4c3359828d232d8e81c1bff2dcbbca773dee2d7
---
libavfilter/f_settb.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/libavfilter/f_settb.c b/libavfilter/f_settb.c
index 033e1f7..3430e70 100644
--- a/libavfilter/f_settb.c
+++ b/libavfilter/f_settb.c
@@ -116,22 +116,20 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
return ff_start_frame(outlink, picref);
}
-static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
+static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
- AVFilterBufferRef *outsamples = insamples;
if (av_cmp_q(inlink->time_base, outlink->time_base)) {
- outsamples = avfilter_ref_buffer(insamples, ~0);
- outsamples->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
+ int64_t orig_pts = samplesref->pts;
+ samplesref->pts = av_rescale_q(samplesref->pts, inlink->time_base, outlink->time_base);
av_log(ctx, AV_LOG_DEBUG, "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
- inlink ->time_base.num, inlink ->time_base.den, insamples ->pts,
- outlink->time_base.num, outlink->time_base.den, outsamples->pts);
- avfilter_unref_buffer(insamples);
+ inlink ->time_base.num, inlink ->time_base.den, orig_pts,
+ outlink->time_base.num, outlink->time_base.den, samplesref->pts);
}
- return ff_filter_samples(outlink, outsamples);
+ return ff_filter_samples(outlink, samplesref);
}
#if CONFIG_SETTB_FILTER
More information about the ffmpeg-cvslog
mailing list