Quoting Luca Barbato (2015-07-26 09:41:24) > Keep the resampling context always consistent > > Bug-Id: 876 > CC: [email protected] > --- > libavcodec/opusdec.c | 41 +++++++++++++++++++++-------------------- > 1 file changed, 21 insertions(+), 20 deletions(-) > > diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c > index 771922e..34bb40a 100644 > --- a/libavcodec/opusdec.c > +++ b/libavcodec/opusdec.c > @@ -442,6 +442,26 @@ finish: > return output_samples; > } > > +static av_cold void opus_decode_flush(AVCodecContext *ctx) > +{ > + OpusContext *c = ctx->priv_data; > + int i; > + > + for (i = 0; i < c->nb_streams; i++) { > + OpusStreamContext *s = &c->streams[i]; > + > + memset(&s->packet, 0, sizeof(s->packet)); > + s->delayed_samples = 0; > + > + if (s->celt_delay) > + av_audio_fifo_drain(s->celt_delay, > av_audio_fifo_size(s->celt_delay)); > + avresample_close(s->avr); > + > + ff_silk_flush(s->silk); > + ff_celt_flush(s->celt); > + } > +} > + > static int opus_decode_packet(AVCodecContext *avctx, void *data, > int *got_frame_ptr, AVPacket *avpkt) > { > @@ -516,6 +536,7 @@ static int opus_decode_packet(AVCodecContext *avctx, void > *data, > if (decoded_samples && ret != decoded_samples) { > av_log(avctx, AV_LOG_ERROR, "Different numbers of decoded > samples " > "in a multi-channel stream\n"); > + opus_decode_flush(avctx);
No, turns out this is actually a valid situation. I'll send a patch that handles it properly. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
