Bug 1278574 - [1.3] Allow only a single media decoder (pair) on Android 4.2 and earlier. r=jya,snorp

This commit is contained in:
Eugen Sawin 2016-06-09 15:20:23 +02:00
Родитель 6013f621ff
Коммит 7948d9d8d0
3 изменённых файлов: 20 добавлений и 3 удалений

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

@ -16,7 +16,6 @@
#include "mozilla/Mutex.h"
#include <stdint.h>
#include <algorithm>
#include <list>
using namespace mozilla::media;

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

@ -6,6 +6,10 @@
#ifndef MEDIA_PREFS_H
#define MEDIA_PREFS_H
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
// First time MediaPrefs::GetSingleton() needs to be called on the main thread,
// before any of the methods accessing the values are used, but after
// the Preferences system has been initialized.
@ -120,7 +124,7 @@ private:
DECL_MEDIA_PREF("media.webspeech.recognition.force_enable", WebSpeechRecognitionForceEnabled, bool, false);
DECL_MEDIA_PREF("media.num-decode-threads", MediaThreadPoolDefaultCount, uint32_t, 4);
DECL_MEDIA_PREF("media.decoder.limit", MediaDecoderLimit, uint32_t, -1);
DECL_MEDIA_PREF("media.decoder.limit", MediaDecoderLimit, int32_t, MediaDecoderLimitDefault());
public:
// Manage the singleton:
@ -131,6 +135,21 @@ private:
template<class T> friend class StaticAutoPtr;
static StaticAutoPtr<MediaPrefs> sInstance;
// Default value functions
static int32_t MediaDecoderLimitDefault()
{
#ifdef MOZ_WIDGET_ANDROID
if (AndroidBridge::Bridge() &&
AndroidBridge::Bridge()->GetAPIVersion() < 18) {
// Older Android versions have broken support for multiple simultaneous
// decoders, see bug 1278574.
return 1;
}
#endif
// Otherwise, set no decoder limit.
return -1;
}
// Creating these to avoid having to include Preferences.h in the .h
static void PrefAddVarCache(bool*, const char*, bool);
static void PrefAddVarCache(int32_t*, const char*, int32_t);

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

@ -309,7 +309,6 @@ nsLayoutStatics::Initialize()
#endif
MediaDecoder::InitStatics();
MediaPrefs::GetSingleton();
PromiseDebugging::Init();