Bug 904177 - Add media.omx.async.enabled preference. r=sotaro, r=cpearce

This commit is contained in:
Bruce Sun 2014-07-16 15:40:05 +08:00
parent 6fa2b606f3
commit 95530384be
5 changed files with 29 additions and 0 deletions

View File

@ -42,6 +42,10 @@
#include "MediaOmxReader.h"
#include "nsIPrincipal.h"
#include "mozilla/dom/HTMLMediaElement.h"
#if ANDROID_VERSION >= 16
#include "MediaCodecDecoder.h"
#include "MediaCodecReader.h"
#endif
#endif
#ifdef NECKO_PROTOCOL_rtsp
#include "RtspOmxDecoder.h"
@ -537,7 +541,13 @@ InstantiateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
return nullptr;
}
}
#if ANDROID_VERSION >= 16
decoder = MediaDecoder::IsOmxAsyncEnabled()
? static_cast<MediaDecoder*>(new MediaCodecDecoder())
: static_cast<MediaDecoder*>(new MediaOmxDecoder());
#else
decoder = new MediaOmxDecoder();
#endif
return decoder.forget();
}
#endif
@ -627,7 +637,13 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
#endif
#ifdef MOZ_OMX_DECODER
if (IsOmxSupportedType(aType)) {
#if ANDROID_VERSION >= 16
decoderReader = MediaDecoder::IsOmxAsyncEnabled()
? static_cast<MediaDecoderReader*>(new MediaCodecReader(aDecoder))
: static_cast<MediaDecoderReader*>(new MediaOmxReader(aDecoder));
#else
decoderReader = new MediaOmxReader(aDecoder);
#endif
} else
#endif
#ifdef MOZ_ANDROID_OMX

View File

@ -1717,6 +1717,16 @@ MediaDecoder::IsOmxEnabled()
{
return Preferences::GetBool("media.omx.enabled", false);
}
bool
MediaDecoder::IsOmxAsyncEnabled()
{
#if ANDROID_VERSION >= 16
return Preferences::GetBool("media.omx.async.enabled", false);
#else
return false;
#endif
}
#endif
#ifdef MOZ_ANDROID_OMX

1
content/media/MediaDecoder.h Executable file → Normal file
View File

@ -873,6 +873,7 @@ public:
#ifdef MOZ_OMX_DECODER
static bool IsOmxEnabled();
static bool IsOmxAsyncEnabled();
#endif
#ifdef MOZ_ANDROID_OMX

View File

@ -8,6 +8,7 @@ EXPORTS += [
'IMediaResourceManagerClient.h',
'IMediaResourceManagerDeathNotifier.h',
'IMediaResourceManagerService.h',
'MediaResourceHandler.h',
'MediaResourceManagerClient.h',
'MediaResourceManagerService.h',
]

View File

@ -50,6 +50,7 @@ if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
if int(CONFIG['ANDROID_VERSION']) >= 16:
EXPORTS += [
'I420ColorConverterHelper.h',
'MediaCodecDecoder.h',
'MediaCodecProxy.h',
'MediaCodecReader.h',