Bug 1134434 - Fire loadedmetadata before encrypted event on encrypted MP4s - r=cpearce

This commit is contained in:
Edwin Flores
2015-03-23 15:31:15 +13:00
parent 7667517fd1
commit e53ddec380
10 changed files with 217 additions and 144 deletions

View File

@@ -3066,7 +3066,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags)
{
mMediaInfo = *aInfo;
mIsEncrypted = aInfo->mIsEncrypted;
mIsEncrypted = aInfo->IsEncrypted();
mTags = aTags.forget();
mLoadedDataFired = false;
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
@@ -3086,6 +3086,14 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
ProcessMediaFragmentURI();
mDecoder->SetFragmentEndTime(mFragmentEnd);
}
if (mIsEncrypted) {
if (!mMediaSource) {
DecodeError();
return;
}
DispatchEncrypted(aInfo->mCrypto.mInitData, aInfo->mCrypto.mType);
}
// Expose the tracks to JS directly.
for (OutputMediaStream& out : mOutputStreams) {