Bug 1349128 - Remove duplicated AndroidDecoderModule in mCurrentPDMs if both PDMAndroidMediaCodecEnabled and PDMAndroidMediaCodecPreferred are set to true; r=jya

The AndroidDecoderModule will be added into PDM queue twice if both PDMAndroidMediaCodecEnabled and PDMAndroidMediaCodecPreferred are set to true. It should be inserted into the head of the PDM queue in this case, and appended to the tail if only PDMAndroidMediaCodecEnabled is true.

MozReview-Commit-ID: Fj0z0meeb1V

--HG--
extra : rebase_source : 1d7f2b10fd4360d3f641ad6517e9f95afcb99768
This commit is contained in:
Chun-Min Chang 2017-03-22 14:14:09 +08:00
parent f0a98a30fa
commit ddc78aa48d
2 changed files with 8 additions and 11 deletions

View File

@ -343,13 +343,6 @@ PDMFactory::CreatePDMs()
return;
}
#ifdef MOZ_WIDGET_ANDROID
if(MediaPrefs::PDMAndroidMediaCodecPreferred() &&
MediaPrefs::PDMAndroidMediaCodecEnabled()) {
m = new AndroidDecoderModule();
StartupPDM(m);
}
#endif
#ifdef XP_WIN
if (MediaPrefs::PDMWMFEnabled()) {
m = new WMFDecoderModule();
@ -387,7 +380,7 @@ PDMFactory::CreatePDMs()
#ifdef MOZ_WIDGET_ANDROID
if(MediaPrefs::PDMAndroidMediaCodecEnabled()){
m = new AndroidDecoderModule();
StartupPDM(m);
StartupPDM(m, MediaPrefs::PDMAndroidMediaCodecPreferred());
}
#endif
@ -410,10 +403,14 @@ PDMFactory::CreateNullPDM()
}
bool
PDMFactory::StartupPDM(PlatformDecoderModule* aPDM)
PDMFactory::StartupPDM(PlatformDecoderModule* aPDM, bool aInsertAtBeginning)
{
if (aPDM && NS_SUCCEEDED(aPDM->Startup())) {
mCurrentPDMs.AppendElement(aPDM);
if (aInsertAtBeginning) {
mCurrentPDMs.InsertElementAt(0, aPDM);
} else {
mCurrentPDMs.AppendElement(aPDM);
}
return true;
}
return false;

View File

@ -55,7 +55,7 @@ private:
void CreatePDMs();
void CreateNullPDM();
// Startup the provided PDM and add it to our list if successful.
bool StartupPDM(PlatformDecoderModule* aPDM);
bool StartupPDM(PlatformDecoderModule* aPDM, bool aInsertAtBeginning = false);
// Returns the first PDM in our list supporting the mimetype.
already_AddRefed<PlatformDecoderModule>
GetDecoder(const TrackInfo& aTrackInfo,