Bug 1208922. Part 4 - remove AbstractMediaDecoder::GetCDMProxy() and devirtualize MediaDecoder::SetCDMProxy(). r=cpearce.

This commit is contained in:
JW Wang 2015-09-27 18:59:08 +08:00
Родитель 395e17fb4f
Коммит 489900ad10
7 изменённых файлов: 3 добавлений и 70 удалений

Просмотреть файл

@ -163,11 +163,6 @@ public:
// Observe and it should never be called directly.
NS_IMETHOD Observe(nsISupports *aSubject, const char * aTopic, const char16_t * aData) override
{ MOZ_CRASH("Forbidden method"); return NS_OK; }
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) { return NS_ERROR_NOT_IMPLEMENTED; }
virtual CDMProxy* GetCDMProxy() { return nullptr; }
#endif
};
class MetadataContainer

Просмотреть файл

@ -1441,7 +1441,7 @@ MediaDecoder::RequestCDMProxy() const
return mCDMProxyPromise;
}
nsresult
void
MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
{
MOZ_ASSERT(NS_IsMainThread());
@ -1455,18 +1455,10 @@ MediaDecoder::SetCDMProxy(CDMProxy* aProxy)
self->mCDMProxyPromiseHolder.ResolveIfExists(proxy, __func__);
});
caps.CallOnMainThreadWhenCapsAvailable(r);
return NS_OK;
return;
}
}
mCDMProxyPromiseHolder.ResolveIfExists(proxy, __func__);
return NS_OK;
}
CDMProxy*
MediaDecoder::GetCDMProxy()
{
GetReentrantMonitor().AssertCurrentThreadIn();
return mProxy;
}
#endif

Просмотреть файл

@ -670,11 +670,7 @@ public:
// rejected when this decoder is about to shut down.
nsRefPtr<CDMProxyPromise> RequestCDMProxy() const;
// This takes the decoder monitor.
virtual nsresult SetCDMProxy(CDMProxy* aProxy) override;
// Decoder monitor must be held.
virtual CDMProxy* GetCDMProxy() override;
void SetCDMProxy(CDMProxy* aProxy);
#endif
#ifdef MOZ_RAW
@ -824,7 +820,6 @@ private:
ReentrantMonitor mReentrantMonitor;
#ifdef MOZ_EME
nsRefPtr<CDMProxy> mProxy;
MozPromiseHolder<CDMProxyPromise> mCDMProxyPromiseHolder;
nsRefPtr<CDMProxyPromise> mCDMProxyPromise;
#endif

Просмотреть файл

@ -51,25 +51,6 @@ MediaDecoderStateMachine* MP4Decoder::CreateStateMachine()
return new MediaDecoderStateMachine(this, reader);
}
#ifdef MOZ_EME
nsresult
MP4Decoder::SetCDMProxy(CDMProxy* aProxy)
{
nsresult rv = MediaDecoder::SetCDMProxy(aProxy);
NS_ENSURE_SUCCESS(rv, rv);
if (aProxy) {
// The MediaFormatReader can't decrypt EME content until it has a CDMProxy,
// and the CDMProxy knows the capabilities of the CDM. The MediaFormatReader
// remains in "waiting for resources" state until then.
CDMCaps::AutoLock caps(aProxy->Capabilites());
nsCOMPtr<nsIRunnable> task(
NS_NewRunnableMethod(this, &MediaDecoder::NotifyWaitingForResourcesStatusChanged));
caps.CallOnMainThreadWhenCapsAvailable(task);
}
return NS_OK;
}
#endif
static bool
IsSupportedAudioCodec(const nsAString& aCodec,
bool& aOutContainsAAC,

Просмотреть файл

@ -25,10 +25,6 @@ public:
virtual MediaDecoderStateMachine* CreateStateMachine() override;
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) override;
#endif
// Returns true if aMIMEType is a type that we think we can render with the
// a MP4 platform decoder backend. If aCodecs is non emtpy, it is filled
// with a comma-delimited list of codecs to check support for. Notes in

Просмотреть файл

@ -231,28 +231,6 @@ MediaSourceDecoder::GetMozDebugReaderData(nsAString& aString)
mDemuxer->GetMozDebugReaderData(aString);
}
#ifdef MOZ_EME
nsresult
MediaSourceDecoder::SetCDMProxy(CDMProxy* aProxy)
{
nsresult rv = MediaDecoder::SetCDMProxy(aProxy);
NS_ENSURE_SUCCESS(rv, rv);
if (aProxy) {
// The sub readers can't decrypt EME content until they have a CDMProxy,
// and the CDMProxy knows the capabilities of the CDM. The MediaSourceReader
// remains in "waiting for resources" state until then. We need to kick the
// reader out of waiting if the CDM gets added with known capabilities.
CDMCaps::AutoLock caps(aProxy->Capabilites());
if (!caps.AreCapsKnown()) {
nsCOMPtr<nsIRunnable> task(
NS_NewRunnableMethod(this, &MediaDecoder::NotifyWaitingForResourcesStatusChanged));
caps.CallOnMainThreadWhenCapsAvailable(task);
}
}
return NS_OK;
}
#endif
double
MediaSourceDecoder::GetDuration()
{

Просмотреть файл

@ -66,10 +66,6 @@ public:
void SetMediaSourceDuration(double aDuration, MSRangeRemovalAction aAction);
double GetMediaSourceDuration();
#ifdef MOZ_EME
virtual nsresult SetCDMProxy(CDMProxy* aProxy) override;
#endif
MediaSourceDemuxer* GetDemuxer()
{
return mDemuxer;