Browse code

Revert "Revert "lavfi/buffersrc: push the frame deeper if requested.""

This reverts commit 04aa09c4bcf2d5a634a35da3a3ae3fc1abe30ef8
and reintroduces 0ff5567a30be6d7c804e95997ae282d6bacd76c3 that
was temporarily reverted due to minor regressions.

It also reverts e5bce8b4ce7b1f3a83998febdfa86a3771df96ce that fixed FATE refs.
The fate-ffm change is caused by field_order now being set
on the output format because the first frame arrives earlier.
The fate-mxf change is assumed to be the same.

Nicolas George authored on 2017/07/17 00:03:50
Showing 3 changed files
... ...
@@ -173,6 +173,20 @@ int attribute_align_arg av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
173 173
     return ret;
174 174
 }
175 175
 
176
+static int push_frame(AVFilterGraph *graph)
177
+{
178
+    int ret;
179
+
180
+    while (1) {
181
+        ret = ff_filter_graph_run_once(graph);
182
+        if (ret == AVERROR(EAGAIN))
183
+            break;
184
+        if (ret < 0)
185
+            return ret;
186
+    }
187
+    return 0;
188
+}
189
+
176 190
 static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
177 191
                                            AVFrame *frame, int flags)
178 192
 {
... ...
@@ -185,6 +199,11 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
185 185
     if (!frame) {
186 186
         s->eof = 1;
187 187
         ff_avfilter_link_set_in_status(ctx->outputs[0], AVERROR_EOF, AV_NOPTS_VALUE);
188
+        if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
189
+            ret = push_frame(ctx->graph);
190
+            if (ret < 0)
191
+                return ret;
192
+        }
188 193
         return 0;
189 194
     } else if (s->eof)
190 195
         return AVERROR(EINVAL);
... ...
@@ -239,6 +258,12 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx,
239 239
     if ((ret = ctx->output_pads[0].request_frame(ctx->outputs[0])) < 0)
240 240
         return ret;
241 241
 
242
+    if ((flags & AV_BUFFERSRC_FLAG_PUSH)) {
243
+        ret = push_frame(ctx->graph);
244
+        if (ret < 0)
245
+            return ret;
246
+    }
247
+
242 248
     return 0;
243 249
 }
244 250
 
... ...
@@ -1,3 +1,3 @@
1
-a0e9616f0d9a8c1029f3220b1b9175f4 *./tests/data/lavf/lavf.ffm
1
+ca2a450cd0d1e299514a345923b4c82a *./tests/data/lavf/lavf.ffm
2 2
 376832 ./tests/data/lavf/lavf.ffm
3 3
 ./tests/data/lavf/lavf.ffm CRC=0x000e23ae
... ...
@@ -1,9 +1,9 @@
1
-dbdbb7d8677dc29b0d90eedcf418ce13 *./tests/data/lavf/lavf.mxf
1
+eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
2 2
 525369 ./tests/data/lavf/lavf.mxf
3 3
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
4
-40fcb0a898f8825a17f5754b23762f49 *./tests/data/lavf/lavf.mxf
4
+1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
5 5
 560697 ./tests/data/lavf/lavf.mxf
6 6
 ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
7
-9233d192af20fc2a89304f5ae93c21ee *./tests/data/lavf/lavf.mxf
7
+e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
8 8
 525369 ./tests/data/lavf/lavf.mxf
9 9
 ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab