mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-01 22:49:21 +00:00
af_asyncts: fix request_frame() behavior.
Make sure that an output frame has really been produced before returning 0.
This commit is contained in:
parent
0dd283faca
commit
6f834293d3
@ -37,6 +37,9 @@ typedef struct ASyncContext {
|
|||||||
int resample;
|
int resample;
|
||||||
float min_delta_sec;
|
float min_delta_sec;
|
||||||
int max_comp;
|
int max_comp;
|
||||||
|
|
||||||
|
/* set by filter_samples() to signal an output frame to request_frame() */
|
||||||
|
int got_output;
|
||||||
} ASyncContext;
|
} ASyncContext;
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(ASyncContext, x)
|
#define OFFSET(x) offsetof(ASyncContext, x)
|
||||||
@ -117,9 +120,13 @@ static int request_frame(AVFilterLink *link)
|
|||||||
{
|
{
|
||||||
AVFilterContext *ctx = link->src;
|
AVFilterContext *ctx = link->src;
|
||||||
ASyncContext *s = ctx->priv;
|
ASyncContext *s = ctx->priv;
|
||||||
int ret = ff_request_frame(ctx->inputs[0]);
|
int ret = 0;
|
||||||
int nb_samples;
|
int nb_samples;
|
||||||
|
|
||||||
|
s->got_output = 0;
|
||||||
|
while (ret >= 0 && !s->got_output)
|
||||||
|
ret = ff_request_frame(ctx->inputs[0]);
|
||||||
|
|
||||||
/* flush the fifo */
|
/* flush the fifo */
|
||||||
if (ret == AVERROR_EOF && (nb_samples = avresample_get_delay(s->avr))) {
|
if (ret == AVERROR_EOF && (nb_samples = avresample_get_delay(s->avr))) {
|
||||||
AVFilterBufferRef *buf = ff_get_audio_buffer(link, AV_PERM_WRITE,
|
AVFilterBufferRef *buf = ff_get_audio_buffer(link, AV_PERM_WRITE,
|
||||||
@ -206,6 +213,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
|
|||||||
delta, nb_channels, buf->format);
|
delta, nb_channels, buf->format);
|
||||||
}
|
}
|
||||||
ff_filter_samples(outlink, buf_out);
|
ff_filter_samples(outlink, buf_out);
|
||||||
|
s->got_output = 1;
|
||||||
} else {
|
} else {
|
||||||
av_log(ctx, AV_LOG_WARNING, "Non-monotonous timestamps, dropping "
|
av_log(ctx, AV_LOG_WARNING, "Non-monotonous timestamps, dropping "
|
||||||
"whole buffer.\n");
|
"whole buffer.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user