diff --git a/dom/media/platforms/apple/AppleATDecoder.cpp b/dom/media/platforms/apple/AppleATDecoder.cpp index 29612167ae3c..6d364c25d9ce 100644 --- a/dom/media/platforms/apple/AppleATDecoder.cpp +++ b/dom/media/platforms/apple/AppleATDecoder.cpp @@ -283,6 +283,9 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample) if (mChannelLayout && !mAudioConverter) { AudioConfig in(*mChannelLayout.get(), rate); AudioConfig out(channels, rate); + if (!in.IsValid() || !out.IsValid()) { + return NS_ERROR_FAILURE; + } mAudioConverter = MakeUnique(in, out); } if (mAudioConverter) {