diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index 46d3ecde8ed..9ce212a4f4a 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -214,6 +214,8 @@ public: // that the format of the next input sample is about to change. // If video decoder, aConfig will be a VideoInfo object. // If audio decoder, aConfig will be a AudioInfo object. + // It is not safe to store a reference to this object and the decoder must + // make a copy. virtual nsresult ConfigurationChanged(const TrackInfo& aConfig) { return NS_OK; diff --git a/dom/media/platforms/wrappers/H264Converter.cpp b/dom/media/platforms/wrappers/H264Converter.cpp index 4afdd44f851..104c3c92fc8 100644 --- a/dom/media/platforms/wrappers/H264Converter.cpp +++ b/dom/media/platforms/wrappers/H264Converter.cpp @@ -22,6 +22,7 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM, FlushableTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) : mPDM(aPDM) + , mOriginalConfig(aConfig) , mCurrentConfig(aConfig) , mLayersBackend(aLayersBackend) , mImageContainer(aImageContainer) @@ -139,7 +140,7 @@ H264Converter::CreateDecoder() } UpdateConfigFromExtraData(mCurrentConfig.mExtraData); - mDecoder = mPDM->CreateVideoDecoder(mCurrentConfig, + mDecoder = mPDM->CreateVideoDecoder(mNeedAVCC ? mCurrentConfig : mOriginalConfig, mLayersBackend, mImageContainer, mVideoTaskQueue, diff --git a/dom/media/platforms/wrappers/H264Converter.h b/dom/media/platforms/wrappers/H264Converter.h index 132a3f8e9dc..bba2ac6349f 100644 --- a/dom/media/platforms/wrappers/H264Converter.h +++ b/dom/media/platforms/wrappers/H264Converter.h @@ -53,6 +53,7 @@ private: void OnDecoderInitFailed(MediaDataDecoder::DecoderFailureReason aReason); RefPtr mPDM; + const VideoInfo& mOriginalConfig; VideoInfo mCurrentConfig; layers::LayersBackend mLayersBackend; RefPtr mImageContainer;