author | Chris Pearce <cpearce@mozilla.com> |
Thu, 01 Dec 2016 11:23:27 +1300 | |
changeset 343150 | 18975ff8fe825b839820b1e975b6faff58efabfd |
parent 343149 | 53680343b6a21cb89981dd583f31b0ee72253995 |
child 343151 | 2670e3095f9446ac8f3eb4fd44fa666b9ac0ce47 |
push id | 31371 |
push user | cbook@mozilla.com |
push date | Thu, 16 Feb 2017 12:15:11 +0000 |
treeherder | mozilla-central@8c8b54b13be7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwwang |
bugs | 1339755 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/gmp/DecryptJob.cpp +++ b/dom/media/gmp/DecryptJob.cpp @@ -1,17 +1,32 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "DecryptJob.h" +#include "mozilla/Atomics.h" namespace mozilla { +static Atomic<uint32_t> sDecryptJobInstanceCount(0u); + +DecryptJob::DecryptJob(MediaRawData* aSample) + : mId(++sDecryptJobInstanceCount ) + , mSample(aSample) +{ +} + +RefPtr<DecryptPromise> +DecryptJob::Ensure() +{ + return mPromise.Ensure(__func__); +} + void DecryptJob::PostResult(DecryptStatus aResult) { nsTArray<uint8_t> empty; PostResult(aResult, empty); } void
--- a/dom/media/gmp/DecryptJob.h +++ b/dom/media/gmp/DecryptJob.h @@ -10,31 +10,25 @@ #include "mozilla/CDMProxy.h" namespace mozilla { class DecryptJob { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DecryptJob) - explicit DecryptJob(MediaRawData* aSample) - : mId(0) - , mSample(aSample) - { - } + explicit DecryptJob(MediaRawData* aSample); void PostResult(DecryptStatus aResult, const nsTArray<uint8_t>& aDecryptedData); void PostResult(DecryptStatus aResult); - RefPtr<DecryptPromise> Ensure() { - return mPromise.Ensure(__func__); - } + RefPtr<DecryptPromise> Ensure(); - uint32_t mId; + const uint32_t mId; RefPtr<MediaRawData> mSample; private: ~DecryptJob() {} MozPromiseHolder<DecryptPromise> mPromise; }; } // namespace mozilla
--- a/dom/media/gmp/GMPCDMProxy.cpp +++ b/dom/media/gmp/GMPCDMProxy.cpp @@ -32,17 +32,16 @@ GMPCDMProxy::GMPCDMProxy(dom::MediaKeys* bool aDistinctiveIdentifierRequired, bool aPersistentStateRequired) : CDMProxy(aKeys, aKeySystem, aDistinctiveIdentifierRequired, aPersistentStateRequired) , mCrashHelper(aCrashHelper) , mCDM(nullptr) - , mDecryptionJobCount(0) , mShutdownCalled(false) , mDecryptorId(0) , mCreatePromiseId(0) { MOZ_ASSERT(NS_IsMainThread()); MOZ_COUNT_CTOR(GMPCDMProxy); } @@ -705,17 +704,16 @@ GMPCDMProxy::gmp_Decrypt(RefPtr<DecryptJ { MOZ_ASSERT(IsOnOwnerThread()); if (!mCDM) { aJob->PostResult(AbortedErr); return; } - aJob->mId = ++mDecryptionJobCount; nsTArray<uint8_t> data; data.AppendElements(aJob->mSample->Data(), aJob->mSample->Size()); mCDM->Decrypt(aJob->mId, aJob->mSample->mCrypto, data, aJob->mSample->mDuration); mDecryptionJobs.AppendElement(aJob.forget()); } void GMPCDMProxy::gmp_Decrypted(uint32_t aId,
--- a/dom/media/gmp/GMPCDMProxy.h +++ b/dom/media/gmp/GMPCDMProxy.h @@ -213,23 +213,16 @@ private: GMPDecryptorProxy* mCDM; UniquePtr<GMPCDMCallbackProxy> mCallback; // Decryption jobs sent to CDM, awaiting result. // GMP thread only. nsTArray<RefPtr<DecryptJob>> mDecryptionJobs; - // Number of buffers we've decrypted. Used to uniquely identify - // decryption jobs sent to CDM. Note we can't just use the length of - // mDecryptionJobs as that shrinks as jobs are completed and removed - // from it. - // GMP thread only. - uint32_t mDecryptionJobCount; - // True if GMPCDMProxy::gmp_Shutdown was called. // GMP thread only. bool mShutdownCalled; uint32_t mDecryptorId; PromiseId mCreatePromiseId; };