From patchwork Fri Sep 7 07:57:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] avconv: Get the default channel layout before deciding whether to reinit resampling X-Patchwork-Submitter: =?utf-8?q?Martin_Storsj=C3=B6?= X-Patchwork-Id: 26994 Message-Id: <1347004640-32636-1-git-send-email-martin@martin.st> To: libav-devel@libav.org Date: Fri, 7 Sep 2012 10:57:19 +0300 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= List-Id: libav development For demuxers/decoders that reset the channel layout regularly (e.g. rtpdec_qt) to a default value of 0, we avoid reinitializing the resampling needlessly, since the call to guess_input_channel_layout within the resample_changed block would end up with the same channel layout anyway. Does this make the call to guess_input_channel_layout totally redundant, or is there a case where it still is necessary? This fixes reception of rtsp://streams.ymlmedia.com/streams.ymlmedia.com/YML070404s.mov. --- avconv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/avconv.c b/avconv.c index ea73606..e122ee0 100644 --- a/avconv.c +++ b/avconv.c @@ -1150,6 +1150,8 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) rate_emu_sleep(ist); + if (!decoded_frame->channel_layout) + decoded_frame->channel_layout = av_get_default_channel_layout(avctx->channels); resample_changed = ist->resample_sample_fmt != decoded_frame->format || ist->resample_channels != avctx->channels || ist->resample_channel_layout != decoded_frame->channel_layout ||