Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-09-14 10:49:05 +08:00
commit 0c6e087291
55 changed files with 320 additions and 34 deletions

View file

@ -18,7 +18,9 @@
#ifdef MOZ_APPLEMEDIA
#include "AppleDecoderModule.h"
#endif
#ifdef MOZ_GMP
#include "GMPDecoderModule.h"
#endif
#include "mozilla/CDMProxy.h"
#include "mozilla/ClearOnShutdown.h"
@ -221,9 +223,11 @@ PDMFactory::CreateDecoder(const CreateDecoderParams& aParams)
if (mFFmpegFailedToLoad) {
diagnostics->SetFFmpegFailedToLoad();
}
#ifdef MOZ_GMP
if (mGMPPDMFailedToStartup) {
diagnostics->SetGMPPDMFailedToStartup();
}
#endif
}
for (auto& current : mCurrentPDMs) {
@ -393,12 +397,14 @@ PDMFactory::CreatePDMs()
m = new AgnosticDecoderModule();
StartupPDM(m);
#ifdef MOZ_GMP
if (MediaPrefs::PDMGMPEnabled()) {
m = new GMPDecoderModule();
mGMPPDMFailedToStartup = !StartupPDM(m);
} else {
mGMPPDMFailedToStartup = false;
}
#endif
}
void
@ -431,9 +437,11 @@ PDMFactory::GetDecoder(const TrackInfo& aTrackInfo,
if (mFFmpegFailedToLoad) {
aDiagnostics->SetFFmpegFailedToLoad();
}
#ifdef MOZ_GMP
if (mGMPPDMFailedToStartup) {
aDiagnostics->SetGMPPDMFailedToStartup();
}
#endif
}
RefPtr<PlatformDecoderModule> pdm;

View file

@ -70,7 +70,9 @@ private:
bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
#ifdef MOZ_GMP
bool mGMPPDMFailedToStartup = false;
#endif
void EnsureInit() const;
template<class T> friend class StaticAutoPtr;

View file

@ -16,7 +16,9 @@
#include "mozilla/layers/KnowsCompositor.h"
#include "nsTArray.h"
#include "mozilla/RefPtr.h"
#ifdef MOZ_GMP
#include "GMPService.h"
#endif
#include <queue>
#include "MediaResult.h"
@ -38,7 +40,9 @@ class RemoteDecoderModule;
class MediaDataDecoder;
class MediaDataDecoderCallback;
class TaskQueue;
#ifdef MOZ_EME
class CDMProxy;
#endif
static LazyLogModule sPDMLog("PlatformDecoderModule");
@ -81,7 +85,9 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
layers::ImageContainer* mImageContainer = nullptr;
MediaResult* mError = nullptr;
RefPtr<layers::KnowsCompositor> mKnowsCompositor;
#ifdef MOZ_GMP
RefPtr<GMPCrashHelper> mCrashHelper;
#endif
bool mUseBlankDecoder = false;
private:
@ -90,7 +96,9 @@ private:
void Set(DecoderDoctorDiagnostics* aDiagnostics) { mDiagnostics = aDiagnostics; }
void Set(layers::ImageContainer* aImageContainer) { mImageContainer = aImageContainer; }
void Set(MediaResult* aError) { mError = aError; }
#ifdef MOZ_GMP
void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; }
#endif
void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; }
void Set(layers::KnowsCompositor* aKnowsCompositor) { mKnowsCompositor = aKnowsCompositor; }
template <typename T1, typename T2, typename... Ts>

View file

@ -29,11 +29,15 @@ UNIFIED_SOURCES += [
]
DIRS += [
'agnostic/eme',
'agnostic/gmp',
'omx'
]
if CONFIG['MOZ_EME']:
DIRS += ['agnostic/eme']
if CONFIG['MOZ_GMP']:
DIRS += ['agnostic/gmp']
if CONFIG['MOZ_WMF']:
DIRS += [ 'wmf' ];

View file

@ -25,7 +25,9 @@
#include "IMFYCbCrImage.h"
#include "mozilla/WindowsVersion.h"
#include "nsPrintfCString.h"
#ifdef MOZ_GMP
#include "GMPUtils.h" // For SplitAt. TODO: Move SplitAt to a central place.
#endif
#include "MP4Decoder.h"
#include "VPXDecoder.h"
#include "mozilla/SyncRunnable.h"
@ -66,6 +68,23 @@ const CLSID CLSID_WebmMfVpxDec =
namespace mozilla {
#ifndef MOZ_GMP
// Utility function only used when not building GMP
// XXXMC: Perhaps make this available globally?
void
SplitAt(const char* aDelims,
const nsACString& aInput,
nsTArray<nsCString>& aOutTokens)
{
nsAutoCString str(aInput);
char* end = str.BeginWriting();
const char* start = nullptr;
while (!!(start = NS_strtok(aDelims, &end))) {
aOutTokens.AppendElement(nsCString(start));
}
}
#endif
LayersBackend
GetCompositorBackendType(layers::KnowsCompositor* aKnowsCompositor)
{

View file

@ -25,7 +25,9 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM,
, mTaskQueue(aParams.mTaskQueue)
, mCallback(aParams.mCallback)
, mDecoder(nullptr)
#ifdef MOZ_GMP
, mGMPCrashHelper(aParams.mCrashHelper)
#endif
, mNeedAVCC(aPDM->DecoderNeedsConversion(aParams.mConfig)
== PlatformDecoderModule::ConversionRequired::kNeedAVCC)
, mLastError(NS_OK)
@ -201,8 +203,12 @@ H264Converter::CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics)
mCallback,
aDiagnostics,
mImageContainer,
#ifdef MOZ_GMP
mKnowsCompositor,
mGMPCrashHelper
#else
mKnowsCompositor
#endif
});
if (!mDecoder) {

View file

@ -62,7 +62,9 @@ private:
MediaDataDecoderCallback* mCallback;
RefPtr<MediaDataDecoder> mDecoder;
MozPromiseRequestHolder<InitPromise> mInitPromiseRequest;
#ifdef MOZ_GMP
RefPtr<GMPCrashHelper> mGMPCrashHelper;
#endif
bool mNeedAVCC;
nsresult mLastError;
bool mNeedKeyframe = true;