From b35c566d4864cb5c785f112b365a429f837d5d1d Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 19 May 2017 09:52:12 +0200 Subject: [PATCH] Bug 1364870: [ffmpeg] only check format if frame has been decoded. r=gerald The format member isn't set when an audio frame hasn't been decoded yet. MozReview-Commit-ID: IgUj6bjVzdF --HG-- extra : rebase_source : bb47fa523384f9a85ee7d0ed5b6de4fe2c73526a --- .../platforms/ffmpeg/FFmpegAudioDecoder.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp index b8dcd8774601..c7521e67f9d3 100644 --- a/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp @@ -153,20 +153,20 @@ FFmpegAudioDecoder::ProcessDecode(MediaRawData* aSample) __func__); } - if (mFrame->format != AV_SAMPLE_FMT_FLT && - mFrame->format != AV_SAMPLE_FMT_FLTP && - mFrame->format != AV_SAMPLE_FMT_S16 && - mFrame->format != AV_SAMPLE_FMT_S16P && - mFrame->format != AV_SAMPLE_FMT_S32 && - mFrame->format != AV_SAMPLE_FMT_S32P) { - return DecodePromise::CreateAndReject( - MediaResult( - NS_ERROR_DOM_MEDIA_DECODE_ERR, - RESULT_DETAIL("FFmpeg audio decoder outputs unsupported audio format")), - __func__); - } - if (decoded) { + if (mFrame->format != AV_SAMPLE_FMT_FLT && + mFrame->format != AV_SAMPLE_FMT_FLTP && + mFrame->format != AV_SAMPLE_FMT_S16 && + mFrame->format != AV_SAMPLE_FMT_S16P && + mFrame->format != AV_SAMPLE_FMT_S32 && + mFrame->format != AV_SAMPLE_FMT_S32P) { + return DecodePromise::CreateAndReject( + MediaResult( + NS_ERROR_DOM_MEDIA_DECODE_ERR, + RESULT_DETAIL( + "FFmpeg audio decoder outputs unsupported audio format")), + __func__); + } uint32_t numChannels = mCodecContext->channels; AudioConfig::ChannelLayout layout(numChannels); if (!layout.IsValid()) {