Bug 1041882 - Remove Froyo-specific OMX plugin support. r=snorp

This commit is contained in:
Mike Taylor 2015-09-26 09:06:00 +02:00
parent 550979e1ec
commit 444e21024a
2 changed files with 8 additions and 38 deletions

View File

@ -26,21 +26,12 @@
#define MAX_DECODER_NAME_LEN 256 #define MAX_DECODER_NAME_LEN 256
#define AVC_MIME_TYPE "video/avc" #define AVC_MIME_TYPE "video/avc"
#if !defined(MOZ_ANDROID_FROYO)
#define DEFAULT_STAGEFRIGHT_FLAGS OMXCodec::kClientNeedsFramebuffer #define DEFAULT_STAGEFRIGHT_FLAGS OMXCodec::kClientNeedsFramebuffer
#else
#define DEFAULT_STAGEFRIGHT_FLAGS 0
#endif
#undef LOG #undef LOG
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "OmxPlugin" , ## args) #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "OmxPlugin" , ## args)
#if defined(MOZ_ANDROID_FROYO) || defined(MOZ_ANDROID_GB) #if !defined(MOZ_ANDROID_GB) && !defined(MOZ_ANDROID_HC)
// Android versions 2.x.x have common API differences
#define MOZ_ANDROID_V2_X_X
#endif
#if !defined(MOZ_ANDROID_V2_X_X) && !defined(MOZ_ANDROID_HC)
#define MOZ_ANDROID_V4_OR_ABOVE #define MOZ_ANDROID_V4_OR_ABOVE
#endif #endif
@ -242,8 +233,6 @@ GetDefaultStagefrightFlags(PluginHost *aPluginHost)
{ {
uint32_t flags = DEFAULT_STAGEFRIGHT_FLAGS; uint32_t flags = DEFAULT_STAGEFRIGHT_FLAGS;
#if !defined(MOZ_ANDROID_FROYO)
char hardware[256] = ""; char hardware[256] = "";
aPluginHost->GetSystemInfoString("hardware", hardware, sizeof(hardware)); aPluginHost->GetSystemInfoString("hardware", hardware, sizeof(hardware));
@ -260,8 +249,6 @@ GetDefaultStagefrightFlags(PluginHost *aPluginHost)
LOG("Hardware %s; using default flags %#x\n", hardware, flags); LOG("Hardware %s; using default flags %#x\n", hardware, flags);
#endif
return flags; return flags;
} }
@ -281,7 +268,7 @@ static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
int32_t flags = 0; int32_t flags = 0;
aPluginHost->GetIntPref("media.stagefright.omxcodec.flags", &flags); aPluginHost->GetIntPref("media.stagefright.omxcodec.flags", &flags);
if (flags != 0) { if (flags != 0) {
#if !defined(MOZ_ANDROID_V2_X_X) #if !defined(MOZ_ANDROID_GB)
LOG("media.stagefright.omxcodec.flags=%d", flags); LOG("media.stagefright.omxcodec.flags=%d", flags);
if ((flags & OMXCodec::kHardwareCodecsOnly) != 0) { if ((flags & OMXCodec::kHardwareCodecsOnly) != 0) {
LOG("FORCE HARDWARE DECODING"); LOG("FORCE HARDWARE DECODING");
@ -446,7 +433,7 @@ static sp<MediaSource> CreateVideoSource(PluginHost* aPluginHost,
// Throw away the videoSource and try again with new flags. // Throw away the videoSource and try again with new flags.
LOG("Falling back to software decoder"); LOG("Falling back to software decoder");
videoSource.clear(); videoSource.clear();
#if defined(MOZ_ANDROID_V2_X_X) #if defined(MOZ_ANDROID_GB)
flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kPreferSoftwareCodecs; flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kPreferSoftwareCodecs;
#else #else
flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kSoftwareCodecsOnly; flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kSoftwareCodecsOnly;
@ -521,11 +508,6 @@ bool OmxDecoder::Init()
sp<MediaSource> videoTrack; sp<MediaSource> videoTrack;
sp<MediaSource> videoSource; sp<MediaSource> videoSource;
if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != nullptr) { if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != nullptr) {
#if defined(MOZ_ANDROID_FROYO)
// Allow up to 720P video.
sp<MetaData> meta = extractor->getTrackMetaData(videoTrackIndex);
meta->setInt32(kKeyMaxInputSize, (1280 * 720 * 3) / 2);
#endif
videoSource = CreateVideoSource(mPluginHost, omx, videoTrack); videoSource = CreateVideoSource(mPluginHost, omx, videoTrack);
if (videoSource == nullptr) { if (videoSource == nullptr) {
LOG("OMXCodec failed to initialize video decoder for \"%s\"", videoMime); LOG("OMXCodec failed to initialize video decoder for \"%s\"", videoMime);
@ -623,7 +605,7 @@ bool OmxDecoder::SetVideoFormat() {
// slice height. Stagefright only seems to use its kKeyStride and // slice height. Stagefright only seems to use its kKeyStride and
// kKeySliceHeight to initialize camera video formats. // kKeySliceHeight to initialize camera video formats.
#if defined(DEBUG) && !defined(MOZ_ANDROID_FROYO) #if defined(DEBUG)
int32_t unexpected; int32_t unexpected;
if (format->findInt32(kKeyStride, &unexpected)) if (format->findInt32(kKeyStride, &unexpected))
LOG("Expected kKeyWidth, but found kKeyStride %d", unexpected); LOG("Expected kKeyWidth, but found kKeyStride %d", unexpected);
@ -651,7 +633,7 @@ bool OmxDecoder::SetVideoFormat() {
} }
// Gingerbread does not support the kKeyCropRect key // Gingerbread does not support the kKeyCropRect key
#if !defined(MOZ_ANDROID_V2_X_X) #if !defined(MOZ_ANDROID_GB)
if (!format->findRect(kKeyCropRect, &mVideoCropLeft, &mVideoCropTop, if (!format->findRect(kKeyCropRect, &mVideoCropLeft, &mVideoCropTop,
&mVideoCropRight, &mVideoCropBottom)) { &mVideoCropRight, &mVideoCropBottom)) {
#endif #endif
@ -660,7 +642,7 @@ bool OmxDecoder::SetVideoFormat() {
mVideoCropRight = mVideoStride - 1; mVideoCropRight = mVideoStride - 1;
mVideoCropBottom = mVideoSliceHeight - 1; mVideoCropBottom = mVideoSliceHeight - 1;
LOG("crop rect not available, assuming no cropping"); LOG("crop rect not available, assuming no cropping");
#if !defined(MOZ_ANDROID_V2_X_X) #if !defined(MOZ_ANDROID_GB)
} }
#endif #endif
@ -675,14 +657,10 @@ bool OmxDecoder::SetVideoFormat() {
MOZ_ASSERT(mVideoWidth > 0 && mVideoWidth <= mVideoStride); MOZ_ASSERT(mVideoWidth > 0 && mVideoWidth <= mVideoStride);
MOZ_ASSERT(mVideoHeight > 0 && mVideoHeight <= mVideoSliceHeight); MOZ_ASSERT(mVideoHeight > 0 && mVideoHeight <= mVideoSliceHeight);
#if !defined(MOZ_ANDROID_FROYO)
if (!format->findInt32(kKeyRotation, &mVideoRotation)) { if (!format->findInt32(kKeyRotation, &mVideoRotation)) {
#endif
mVideoRotation = 0; mVideoRotation = 0;
#if !defined(MOZ_ANDROID_FROYO)
LOG("rotation not available, assuming 0"); LOG("rotation not available, assuming 0");
} }
#endif
if (mVideoRotation != 0 && mVideoRotation != 90 && if (mVideoRotation != 0 && mVideoRotation != 90 &&
mVideoRotation != 180 && mVideoRotation != 270) { mVideoRotation != 180 && mVideoRotation != 270) {
@ -842,7 +820,7 @@ bool OmxDecoder::ToVideoFrame_ColorConverter(VideoFrame *aFrame, int64_t aTimeUs
aFrame->mSize = mVideoWidth * mVideoHeight * 2; aFrame->mSize = mVideoWidth * mVideoHeight * 2;
#if defined(MOZ_ANDROID_V2_X_X) #if defined(MOZ_ANDROID_GB)
mColorConverter->convert(mVideoWidth, mVideoHeight, mColorConverter->convert(mVideoWidth, mVideoHeight,
aData, 0 /* srcSkip */, aData, 0 /* srcSkip */,
buffer, mVideoWidth * 2); buffer, mVideoWidth * 2);
@ -895,9 +873,6 @@ bool OmxDecoder::ToVideoFrame_I420ColorConverter(VideoFrame *aFrame, int64_t aTi
bool OmxDecoder::ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame, BufferCallback *aBufferCallback) { bool OmxDecoder::ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame, BufferCallback *aBufferCallback) {
switch (mVideoColorFormat) { switch (mVideoColorFormat) {
// Froyo support is best handled with the android color conversion code. I
// get corrupted videos when using our own routines below.
#if !defined(MOZ_ANDROID_FROYO)
case OMX_COLOR_FormatYUV420Planar: // e.g. Asus Transformer, Stagefright's software decoder case OMX_COLOR_FormatYUV420Planar: // e.g. Asus Transformer, Stagefright's software decoder
ToVideoFrame_YUV420Planar(aFrame, aTimeUs, aData, aSize, aKeyFrame); ToVideoFrame_YUV420Planar(aFrame, aTimeUs, aData, aSize, aKeyFrame);
break; break;
@ -919,7 +894,6 @@ bool OmxDecoder::ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData,
case OMX_COLOR_Format16bitRGB565: case OMX_COLOR_Format16bitRGB565:
return ToVideoFrame_RGB565(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback); return ToVideoFrame_RGB565(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback);
break; break;
#endif
default: default:
if (!ToVideoFrame_ColorConverter(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback) && if (!ToVideoFrame_ColorConverter(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback) &&
!ToVideoFrame_I420ColorConverter(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback)) { !ToVideoFrame_I420ColorConverter(aFrame, aTimeUs, aData, aSize, aKeyFrame, aBufferCallback)) {

View File

@ -81,11 +81,7 @@ MOZ_EXPORT MediaSource::ReadOptions::ReadOptions()
{ {
} }
MOZ_EXPORT void MediaSource::ReadOptions::setSeekTo(int64_t time_us MOZ_EXPORT void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode)
#if !defined(MOZ_ANDROID_FROYO)
, SeekMode mode
#endif
)
{ {
} }