Bug 1301059: Do not use H264Converter when video decode is suspended. r?jya
MozReview-Commit-ID: FWvn3Xkalsl
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -262,17 +262,17 @@ PDMFactory::CreateDecoderWithPDM(Platfor
TimeDuration::FromMilliseconds(MediaPrefs::PDMFuzzingInterval()));
callbackWrapper->SetDontDelayInputExhausted(!MediaPrefs::PDMFuzzingDelayInputExhausted());
callback = callbackWrapper.get();
}
CreateDecoderParams params = aParams;
params.mCallback = callback;
- if (MP4Decoder::IsH264(config.mMimeType)) {
+ if (MP4Decoder::IsH264(config.mMimeType) && !aParams.mUseBlankDecoder) {
RefPtr<H264Converter> h = new H264Converter(aPDM, params);
const nsresult rv = h->GetLastError();
if (NS_SUCCEEDED(rv) || rv == NS_ERROR_NOT_INITIALIZED) {
// The H264Converter either successfully created the wrapped decoder,
// or there wasn't enough AVCC data to do so. Otherwise, there was some
// problem, for example WMF DLLs were missing.
m = h.forget();
}
--- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp
@@ -6,16 +6,17 @@
#include "ImageContainer.h"
#include "MediaDecoderReader.h"
#include "MediaInfo.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/mozalloc.h" // for operator new, and new (fallible)
#include "mozilla/RefPtr.h"
#include "mozilla/TaskQueue.h"
+#include "mp4_demuxer/AnnexB.h"
#include "mp4_demuxer/H264.h"
#include "MP4Decoder.h"
#include "nsAutoPtr.h"
#include "nsRect.h"
#include "PlatformDecoderModule.h"
#include "ReorderQueue.h"
#include "TimeUnits.h"
#include "VideoUtils.h"
@@ -29,17 +30,19 @@ class BlankMediaDataDecoder : public Med
public:
BlankMediaDataDecoder(BlankMediaDataCreator* aCreator,
const CreateDecoderParams& aParams)
: mCreator(aCreator)
, mCallback(aParams.mCallback)
, mMaxRefFrames(aParams.mConfig.GetType() == TrackInfo::kVideoTrack &&
MP4Decoder::IsH264(aParams.mConfig.mMimeType)
- ? mp4_demuxer::H264::ComputeMaxRefFrames(aParams.VideoConfig().mExtraData)
+ ? mp4_demuxer::AnnexB::HasSPS(aParams.VideoConfig().mExtraData)
+ ? mp4_demuxer::H264::ComputeMaxRefFrames(aParams.VideoConfig().mExtraData)
+ : 16
: 0)
, mType(aParams.mConfig.GetType())
{
}
RefPtr<InitPromise> Init() override {
return InitPromise::CreateAndResolve(mType, __func__);
}