mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-11 18:09:36 +00:00
lavfi/af_join: partially fix scheduling.
This commit is contained in:
parent
67d3f5296e
commit
d0b82d798d
@ -78,11 +78,13 @@ static const AVOption join_options[] = {
|
|||||||
|
|
||||||
AVFILTER_DEFINE_CLASS(join);
|
AVFILTER_DEFINE_CLASS(join);
|
||||||
|
|
||||||
|
static int try_push_frame(AVFilterContext *ctx);
|
||||||
|
|
||||||
static int filter_frame(AVFilterLink *link, AVFrame *frame)
|
static int filter_frame(AVFilterLink *link, AVFrame *frame)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = link->dst;
|
AVFilterContext *ctx = link->dst;
|
||||||
JoinContext *s = ctx->priv;
|
JoinContext *s = ctx->priv;
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < ctx->nb_inputs; i++)
|
for (i = 0; i < ctx->nb_inputs; i++)
|
||||||
if (link == ctx->inputs[i])
|
if (link == ctx->inputs[i])
|
||||||
@ -91,7 +93,17 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
|
|||||||
av_assert0(!s->input_frames[i]);
|
av_assert0(!s->input_frames[i]);
|
||||||
s->input_frames[i] = frame;
|
s->input_frames[i] = frame;
|
||||||
|
|
||||||
return 0;
|
/* request the same number of samples on all inputs */
|
||||||
|
/* FIXME that means a frame arriving asynchronously on a different input
|
||||||
|
will not have the requested number of samples */
|
||||||
|
if (i == 0) {
|
||||||
|
int nb_samples = s->input_frames[0]->nb_samples;
|
||||||
|
|
||||||
|
for (j = 1; !i && j < ctx->nb_inputs; j++)
|
||||||
|
ctx->inputs[j]->request_samples = nb_samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
return try_push_frame(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_maps(AVFilterContext *ctx)
|
static int parse_maps(AVFilterContext *ctx)
|
||||||
@ -387,27 +399,31 @@ static int join_request_frame(AVFilterLink *outlink)
|
|||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
AVFilterContext *ctx = outlink->src;
|
||||||
JoinContext *s = ctx->priv;
|
JoinContext *s = ctx->priv;
|
||||||
AVFrame *frame;
|
int i;
|
||||||
int linesize = INT_MAX;
|
|
||||||
int nb_samples = 0;
|
|
||||||
int nb_buffers = 0;
|
|
||||||
int i, j, ret;
|
|
||||||
|
|
||||||
/* get a frame on each input */
|
/* get a frame on each input */
|
||||||
for (i = 0; i < ctx->nb_inputs; i++) {
|
for (i = 0; i < ctx->nb_inputs; i++) {
|
||||||
AVFilterLink *inlink = ctx->inputs[i];
|
AVFilterLink *inlink = ctx->inputs[i];
|
||||||
|
if (!s->input_frames[i])
|
||||||
|
return ff_request_frame(inlink);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!s->input_frames[i] &&
|
static int try_push_frame(AVFilterContext *ctx)
|
||||||
(ret = ff_request_frame(inlink)) < 0)
|
{
|
||||||
return ret;
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
|
JoinContext *s = ctx->priv;
|
||||||
|
AVFrame *frame;
|
||||||
|
int linesize = INT_MAX;
|
||||||
|
int nb_samples = INT_MAX;
|
||||||
|
int nb_buffers = 0;
|
||||||
|
int i, j, ret;
|
||||||
|
|
||||||
/* request the same number of samples on all inputs */
|
for (i = 0; i < ctx->nb_inputs; i++) {
|
||||||
if (i == 0) {
|
if (!s->input_frames[i])
|
||||||
nb_samples = s->input_frames[0]->nb_samples;
|
return 0;
|
||||||
|
nb_samples = FFMIN(nb_samples, s->input_frames[i]->nb_samples);
|
||||||
for (j = 1; !i && j < ctx->nb_inputs; j++)
|
|
||||||
ctx->inputs[j]->request_samples = nb_samples;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup the output frame */
|
/* setup the output frame */
|
||||||
|
Loading…
Reference in New Issue
Block a user