[FFmpeg-cvslog] lavfi: guess a timestamp for compat status change.

Nicolas George git at videolan.org
Fri Sep 8 11:34:33 EEST 2017


ffmpeg | branch: master | Nicolas George <george at nsup.org> | Thu Sep  7 10:45:54 2017 +0200| [f5a9c63401c840024defeb50a3dab9f86551b67e] | committer: Nicolas George

lavfi: guess a timestamp for compat status change.

Use the earliest input with the same status.
If that fails, print a warning and use the earliest source.
With this change, simple filter forward correctly the timestamp
of EOF.
Filters that are supposed to change it should be updated to
actually forward it.

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

 libavfilter/avfilter.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 6a97456054..e5c1238182 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -427,6 +427,24 @@ int ff_request_frame(AVFilterLink *link)
     return 0;
 }
 
+static int64_t guess_status_pts(AVFilterContext *ctx, int status)
+{
+    unsigned i;
+    int64_t r = INT64_MAX;
+
+    for (i = 0; i < ctx->nb_inputs; i++)
+        if (ctx->inputs[i]->status_out == status)
+            r = FFMIN(r, ctx->inputs[i]->current_pts);
+    if (r < INT64_MAX)
+        return r;
+    av_log(ctx, AV_LOG_WARNING, "EOF timestamp not reliable\n");
+    for (i = 0; i < ctx->nb_inputs; i++)
+        r = FFMIN(r, ctx->inputs[i]->status_in_pts);
+    if (r < INT64_MAX)
+        return r;
+    return AV_NOPTS_VALUE;
+}
+
 static int ff_request_frame_to_filter(AVFilterLink *link)
 {
     int ret = -1;
@@ -440,7 +458,7 @@ static int ff_request_frame_to_filter(AVFilterLink *link)
         ret = ff_request_frame(link->src->inputs[0]);
     if (ret < 0) {
         if (ret != AVERROR(EAGAIN) && ret != link->status_in)
-            ff_avfilter_link_set_in_status(link, ret, AV_NOPTS_VALUE);
+            ff_avfilter_link_set_in_status(link, ret, guess_status_pts(link->src, ret));
         if (ret == AVERROR_EOF)
             ret = 0;
     }



More information about the ffmpeg-cvslog mailing list