avauddec: Check planar-ness of frame rather than context
authorArun Raghavan <arun@asymptotic.io>
Tue, 27 Oct 2020 10:33:29 +0000 (06:33 -0400)
committerArun Raghavan <arun@asymptotic.io>
Tue, 27 Oct 2020 11:08:12 +0000 (07:08 -0400)
The check seems to be to present to verify that the decoded frame
matches the format we expect. The actual check for the layout of the
frame was being performed against the context instead.

The check fails at least for avdec_aptx_hd, where the AVCodecContext has
the sample format set to AV_SAMPLE_FMT_NONE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/107>

ext/libav/gstavauddec.c

index 91ee8e3..6801bbd 100644 (file)
@@ -492,7 +492,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec,
     channels = ffmpegdec->info.channels;
     nsamples = ffmpegdec->frame->nb_samples;
     byte_per_sample = ffmpegdec->info.finfo->width / 8;
-    planar = av_sample_fmt_is_planar (ffmpegdec->context->sample_fmt);
+    planar = av_sample_fmt_is_planar (ffmpegdec->frame->format);
 
     g_return_val_if_fail (ffmpegdec->info.layout == (planar ?
             GST_AUDIO_LAYOUT_NON_INTERLEAVED : GST_AUDIO_LAYOUT_INTERLEAVED),