Commit e4c0f258 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '9bfc6e02'

* commit '9bfc6e02':
  afifo: fix request_samples on the last frame in certain cases
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 645d0384 9bfc6e02
...@@ -183,20 +183,10 @@ static int return_audio_frame(AVFilterContext *ctx) ...@@ -183,20 +183,10 @@ static int return_audio_frame(AVFilterContext *ctx)
} }
while (s->out->nb_samples < s->allocated_samples) { while (s->out->nb_samples < s->allocated_samples) {
int len = FFMIN(s->allocated_samples - s->out->nb_samples, int len;
head->nb_samples);
av_samples_copy(s->out->extended_data, head->extended_data,
s->out->nb_samples, 0, len, nb_channels,
link->format);
s->out->nb_samples += len;
if (len == head->nb_samples) { if (!s->root.next) {
av_frame_free(&head); ret = ff_request_frame(ctx->inputs[0]);
queue_pop(s);
if (!s->root.next &&
(ret = ff_request_frame(ctx->inputs[0])) < 0) {
if (ret == AVERROR_EOF) { if (ret == AVERROR_EOF) {
av_samples_set_silence(s->out->extended_data, av_samples_set_silence(s->out->extended_data,
s->out->nb_samples, s->out->nb_samples,
...@@ -205,10 +195,22 @@ static int return_audio_frame(AVFilterContext *ctx) ...@@ -205,10 +195,22 @@ static int return_audio_frame(AVFilterContext *ctx)
nb_channels, link->format); nb_channels, link->format);
s->out->nb_samples = s->allocated_samples; s->out->nb_samples = s->allocated_samples;
break; break;
} } else if (ret < 0)
return ret; return ret;
} }
head = s->root.next->frame; head = s->root.next->frame;
len = FFMIN(s->allocated_samples - s->out->nb_samples,
head->nb_samples);
av_samples_copy(s->out->extended_data, head->extended_data,
s->out->nb_samples, 0, len, nb_channels,
link->format);
s->out->nb_samples += len;
if (len == head->nb_samples) {
av_frame_free(&head);
queue_pop(s);
} else { } else {
buffer_offset(link, head, len); buffer_offset(link, head, len);
} }
......
...@@ -51,7 +51,7 @@ fate-filter-join: SRC2 = $(TARGET_PATH)/tests/data/asynth-44100-3.wav ...@@ -51,7 +51,7 @@ fate-filter-join: SRC2 = $(TARGET_PATH)/tests/data/asynth-44100-3.wav
fate-filter-join: tests/data/asynth-44100-2.wav tests/data/asynth-44100-3.wav fate-filter-join: tests/data/asynth-44100-2.wav tests/data/asynth-44100-3.wav
fate-filter-join: CMD = md5 -i $(SRC1) -i $(SRC2) -filter_complex join=channel_layout=5 -f s16le fate-filter-join: CMD = md5 -i $(SRC1) -i $(SRC2) -filter_complex join=channel_layout=5 -f s16le
fate-filter-join: CMP = oneline fate-filter-join: CMP = oneline
fate-filter-join: REF = 38fa1b18b0c46d77df6f17bfc4f078dd fate-filter-join: REF = 409e66fc5ece4ddea4aa16bc47026bb0
FATE_AFILTER-$(call ALLYES, WAV_DEMUXER PCM_S16LE_DECODER PCM_S16LE_ENCODER PCM_S16LE_MUXER APERMS_FILTER VOLUME_FILTER) += fate-filter-volume FATE_AFILTER-$(call ALLYES, WAV_DEMUXER PCM_S16LE_DECODER PCM_S16LE_ENCODER PCM_S16LE_MUXER APERMS_FILTER VOLUME_FILTER) += fate-filter-volume
fate-filter-volume: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav fate-filter-volume: SRC = $(TARGET_PATH)/tests/data/asynth-44100-2.wav
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment