Fix an infinite loop in forward_status_change().
Showing the changes to libavfilter/framesync.c (1 of 1 file). Show all
Unified · Split
| @@ -18,6 +18,9 @@ · 17 unmodified lines | |||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #define FF_INTERNAL_FIELDS 1 | ||
| 22 | #include "framequeue.h" | ||
| 23 | |||
| 21 | #include "libavutil/avassert.h" | 24 | #include "libavutil/avassert.h" |
| 22 | #include "avfilter.h" | 25 | #include "avfilter.h" |
| 23 | #include "bufferqueue.h" | 26 | #include "bufferqueue.h" |
| @@ -314,7 +317,7 @@ int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink, · 290 unmodified lines | |||
| 314 | int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink) | 317 | int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink) |
| 315 | { | 318 | { |
| 316 | AVFilterContext *ctx = outlink->src; | 319 | AVFilterContext *ctx = outlink->src; |
| 317 | int input, ret; | 320 | int input, ret, i; |
| 318 | 321 | ||
| 319 | if ((ret = ff_framesync_process_frame(fs, 0)) < 0) | 322 | if ((ret = ff_framesync_process_frame(fs, 0)) < 0) |
| 320 | return ret; | 323 | return ret; |
| @@ -323,6 +326,11 @@ int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink) · 2 unmodified lines | |||
| 323 | if (fs->eof) | 326 | if (fs->eof) |
| 324 | return AVERROR_EOF; | 327 | return AVERROR_EOF; |
| 325 | input = fs->in_request; | 328 | input = fs->in_request; |
| 329 | /* Detect status change early */ | ||
| 330 | for (i = 0; i < fs->nb_in; i++) | ||
| 331 | if (!ff_framequeue_queued_frames(&ctx->inputs[i]->fifo) && | ||
| 332 | ctx->inputs[i]->status_in && !ctx->inputs[i]->status_out) | ||
| 333 | input = i; | ||
| 326 | ret = ff_request_frame(ctx->inputs[input]); | 334 | ret = ff_request_frame(ctx->inputs[input]); |
| 327 | if (ret == AVERROR_EOF) { | 335 | if (ret == AVERROR_EOF) { |
| 328 | if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0) | 336 | if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0) |