diff --git a/dom/media/omx/MediaCodecReader.cpp b/dom/media/omx/MediaCodecReader.cpp index b0bdbac92486..2bad150d6152 100644 --- a/dom/media/omx/MediaCodecReader.cpp +++ b/dom/media/omx/MediaCodecReader.cpp @@ -33,6 +33,7 @@ #include "MediaStreamSource.h" #include "MediaTaskQueue.h" #include "MP3FrameParser.h" +#include "nsMimeTypes.h" #include "nsThreadUtils.h" #include "ImageContainer.h" #include "SharedThreadPool.h" @@ -688,7 +689,9 @@ MediaCodecReader::ReadMetadata(MediaInfo* aInfo, return NS_ERROR_FAILURE; } - if (!TriggerIncrementalParser()) { + bool incrementalParserNeeded = + mDecoder->GetResource()->GetContentType().EqualsASCII(AUDIO_MP3); + if (incrementalParserNeeded && !TriggerIncrementalParser()) { return NS_ERROR_FAILURE; } @@ -1419,10 +1422,10 @@ MediaCodecReader::TriggerIncrementalParser() mParsedDataLength = INT64_C(0); // MP3 file duration - mMP3FrameParser = new MP3FrameParser(mDecoder->GetResource()->GetLength()); const char* mime = nullptr; if (mMetaData->findCString(kKeyMIMEType, &mime) && !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) { + mMP3FrameParser = new MP3FrameParser(mDecoder->GetResource()->GetLength()); { MonitorAutoUnlock monUnlock(mParserMonitor); // trigger parsing logic and wait for finishing parsing data in the beginning.