Bug 1340942. Part 3 - pass Data& to DoCreateDecoder. r=gerald

MozReview-Commit-ID: ABHu0tp57AM

--HG--
extra : rebase_source : bcd7979839dfd8773f8cca89a225932a3afe35e9
extra : source : ebde79529e6725fd46ffefbdda375ece5a7689a8
This commit is contained in:
JW Wang 2017-02-17 15:17:22 +08:00
Родитель 47716779ec
Коммит a9cf757728
1 изменённых файлов: 10 добавлений и 11 удалений

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

@ -252,7 +252,7 @@ private:
} mAudio, mVideo;
void RunStage(Data& aData);
MediaResult DoCreateDecoder(TrackType aTrack);
MediaResult DoCreateDecoder(Data& aData);
void DoInitDecoder(TrackType aTrack);
// guaranteed to be valid by the owner.
@ -351,7 +351,7 @@ MediaFormatReader::DecoderFactory::RunStage(Data& aData)
MOZ_ASSERT(!aData.mDecoder);
MOZ_ASSERT(!aData.mInitRequest.Exists());
MediaResult rv = DoCreateDecoder(aData.mTrack);
MediaResult rv = DoCreateDecoder(aData);
if (NS_FAILED(rv)) {
NS_WARNING("Error constructing decoders");
aData.mToken = nullptr;
@ -375,10 +375,9 @@ MediaFormatReader::DecoderFactory::RunStage(Data& aData)
}
MediaResult
MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData)
{
auto& ownerData = mOwner->GetDecoderData(aTrack);
auto& data = aTrack == TrackInfo::kAudioTrack ? mAudio : mVideo;
auto& ownerData = aData.mOwnerData;
auto decoderCreatingError = "error creating audio decoder";
MediaResult result =
@ -392,9 +391,9 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
}
}
switch (aTrack) {
switch (aData.mTrack) {
case TrackInfo::kAudioTrack: {
data.mDecoder = mOwner->mPlatform->CreateDecoder({
aData.mDecoder = mOwner->mPlatform->CreateDecoder({
ownerData.mInfo
? *ownerData.mInfo->GetAsAudioInfo()
: *ownerData.mOriginalInfo->GetAsAudioInfo(),
@ -402,7 +401,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
mOwner->mCrashHelper,
ownerData.mIsBlankDecode,
&result,
aTrack,
TrackInfo::kAudioTrack,
&mOwner->OnTrackWaitingForKeyProducer()
});
break;
@ -411,7 +410,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
case TrackType::kVideoTrack: {
// Decoders use the layers backend to decide if they can use hardware decoding,
// so specify LAYERS_NONE if we want to forcibly disable it.
data.mDecoder = mOwner->mPlatform->CreateDecoder({
aData.mDecoder = mOwner->mPlatform->CreateDecoder({
ownerData.mInfo
? *ownerData.mInfo->GetAsVideoInfo()
: *ownerData.mOriginalInfo->GetAsVideoInfo(),
@ -421,7 +420,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
mOwner->mCrashHelper,
ownerData.mIsBlankDecode,
&result,
aTrack,
TrackType::kVideoTrack,
&mOwner->OnTrackWaitingForKeyProducer()
});
break;
@ -431,7 +430,7 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack)
break;
}
if (data.mDecoder) {
if (aData.mDecoder) {
return NS_OK;
}