mirror of https://git.ffmpeg.org/ffmpeg.git
lavf/framesync: detect EOF immediately.
Fix an infinite loop in forward_status_change().
This commit is contained in:
parent
68e5598e22
commit
3b64e3ea45
|
@ -18,6 +18,9 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FF_INTERNAL_FIELDS 1
|
||||||
|
#include "framequeue.h"
|
||||||
|
|
||||||
#include "libavutil/avassert.h"
|
#include "libavutil/avassert.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "bufferqueue.h"
|
#include "bufferqueue.h"
|
||||||
|
@ -314,7 +317,7 @@ int ff_framesync_filter_frame(FFFrameSync *fs, AVFilterLink *inlink,
|
||||||
int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
|
int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
AVFilterContext *ctx = outlink->src;
|
||||||
int input, ret;
|
int input, ret, i;
|
||||||
|
|
||||||
if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
|
if ((ret = ff_framesync_process_frame(fs, 0)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -323,6 +326,11 @@ int ff_framesync_request_frame(FFFrameSync *fs, AVFilterLink *outlink)
|
||||||
if (fs->eof)
|
if (fs->eof)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
input = fs->in_request;
|
input = fs->in_request;
|
||||||
|
/* Detect status change early */
|
||||||
|
for (i = 0; i < fs->nb_in; i++)
|
||||||
|
if (!ff_framequeue_queued_frames(&ctx->inputs[i]->fifo) &&
|
||||||
|
ctx->inputs[i]->status_in && !ctx->inputs[i]->status_out)
|
||||||
|
input = i;
|
||||||
ret = ff_request_frame(ctx->inputs[input]);
|
ret = ff_request_frame(ctx->inputs[input]);
|
||||||
if (ret == AVERROR_EOF) {
|
if (ret == AVERROR_EOF) {
|
||||||
if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0)
|
if ((ret = ff_framesync_add_frame(fs, input, NULL)) < 0)
|
||||||
|
|
Loading…
Reference in New Issue