Bug 1148699 - Fix race in CDM Session IDs - r=cpearce

This commit is contained in:
Edwin Flores 2015-03-28 20:03:32 +13:00
Родитель 4573209c4a
Коммит dd924e1125
2 изменённых файлов: 9 добавлений и 12 удалений

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

@ -749,18 +749,6 @@ MP4Reader::Update(TrackType aTrack)
mFoundSPSForTelemetry = AccumulateSPSTelemetry(extradata); mFoundSPSForTelemetry = AccumulateSPSTelemetry(extradata);
} }
if (sample && sample->mMp4Sample && sample->mMp4Sample->crypto.valid) {
CryptoSample& crypto = sample->mMp4Sample->crypto;
MOZ_ASSERT(crypto.session_ids.IsEmpty());
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
nsRefPtr<CDMProxy> proxy = mDecoder->GetCDMProxy();
MOZ_ASSERT(proxy);
proxy->GetSessionIdsForKeyId(crypto.key, crypto.session_ids);
}
if (sample) { if (sample) {
decoder.mDecoder->Input(sample->mMp4Sample.forget()); decoder.mDecoder->Input(sample->mMp4Sample.forget());
if (aTrack == kVideo) { if (aTrack == kVideo) {

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

@ -89,6 +89,9 @@ public:
return NS_OK; return NS_OK;
} }
mProxy->GetSessionIdsForKeyId(aSample->crypto.key,
aSample->crypto.session_ids);
mProxy->Decrypt(aSample, new DeliverDecrypted(this, mTaskQueue)); mProxy->Decrypt(aSample, new DeliverDecrypted(this, mTaskQueue));
return NS_OK; return NS_OK;
} }
@ -162,6 +165,7 @@ public:
EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue) EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue)
: MediaDataDecoderProxy(aProxyThread, aCallback) : MediaDataDecoderProxy(aProxyThread, aCallback)
, mSamplesWaitingForKey(new SamplesWaitingForKey(this, aTaskQueue, aProxy)) , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aTaskQueue, aProxy))
, mProxy(aProxy)
{ {
} }
@ -170,6 +174,7 @@ public:
private: private:
nsRefPtr<SamplesWaitingForKey> mSamplesWaitingForKey; nsRefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
nsRefPtr<CDMProxy> mProxy;
}; };
nsresult nsresult
@ -179,6 +184,9 @@ EMEMediaDataDecoderProxy::Input(mp4_demuxer::MP4Sample* aSample)
return NS_OK; return NS_OK;
} }
mProxy->GetSessionIdsForKeyId(aSample->crypto.key,
aSample->crypto.session_ids);
return MediaDataDecoderProxy::Input(aSample); return MediaDataDecoderProxy::Input(aSample);
} }
@ -189,6 +197,7 @@ EMEMediaDataDecoderProxy::Shutdown()
mSamplesWaitingForKey->BreakCycles(); mSamplesWaitingForKey->BreakCycles();
mSamplesWaitingForKey = nullptr; mSamplesWaitingForKey = nullptr;
mProxy = nullptr;
return rv; return rv;
} }