Bug 932820 - Workaround for ABI changes in OMX interface on HTC devices r=doublec
authorEdwin Flores <eflores@mozilla.com>
Wed, 22 Jan 2014 09:59:54 +1300
changeset 164516 156dd7431c8ecb39eb8cdaea9cfa7c20927073a3
parent 164515 bc98b7a52884e1df484369bc6c3e6360879d70a9
child 164517 92cb918918805f8943186ce64666ddc9c6cba5c4
push id26048
push userkwierso@gmail.com
push dateWed, 22 Jan 2014 01:11:21 +0000
treeherdermozilla-central@92cb91891880 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec
bugs932820
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 932820 - Workaround for ABI changes in OMX interface on HTC devices r=doublec On some devices, HTC has extended android::OMXCodec with their own HTCOMXCodec which contains some extension that change the ABI. This patch merely adds padding to MediaSource::ReadOptions, as HTCOMXCodec::read modifies an HTC-specific field in ReadOptions which doesn't exist in AOSP.
media/omx-plugin/OmxPlugin.cpp
--- a/media/omx-plugin/OmxPlugin.cpp
+++ b/media/omx-plugin/OmxPlugin.cpp
@@ -871,30 +871,37 @@ bool OmxDecoder::ToVideoFrame(VideoFrame
 }
 
 bool OmxDecoder::ToAudioFrame(AudioFrame *aFrame, int64_t aTimeUs, void *aData, size_t aDataOffset, size_t aSize, int32_t aAudioChannels, int32_t aAudioSampleRate)
 {
   aFrame->Set(aTimeUs, reinterpret_cast<char *>(aData) + aDataOffset, aSize, aAudioChannels, aAudioSampleRate);
   return true;
 }
 
+class ReadOptions : public MediaSource::ReadOptions
+{
+  // HTC have their own version of ReadOptions with extra fields. If we don't
+  // have this here, HTCOMXCodec will corrupt our stack.
+  uint32_t sadface[4];
+};
+
 bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aSeekTimeUs,
                            BufferCallback *aBufferCallback)
 {
   MOZ_ASSERT(aSeekTimeUs >= -1);
 
   if (!mVideoSource.get())
     return false;
 
   ReleaseVideoBuffer();
 
   status_t err;
 
   if (aSeekTimeUs != -1) {
-    MediaSource::ReadOptions options;
+    ReadOptions options;
     options.setSeekTo(aSeekTimeUs);
     err = mVideoSource->read(&mVideoBuffer, &options);
   } else {
     err = mVideoSource->read(&mVideoBuffer);
   }
 
   aFrame->mSize = 0;
 
@@ -948,17 +955,17 @@ bool OmxDecoder::ReadAudio(AudioFrame *a
   status_t err;
   if (mAudioMetadataRead && aSeekTimeUs == -1) {
     // Use the data read into the buffer during metadata time
     err = OK;
   }
   else {
     ReleaseAudioBuffer();
     if (aSeekTimeUs != -1) {
-      MediaSource::ReadOptions options;
+      ReadOptions options;
       options.setSeekTo(aSeekTimeUs);
       err = mAudioSource->read(&mAudioBuffer, &options);
     } else {
       err = mAudioSource->read(&mAudioBuffer);
     }
   }
   mAudioMetadataRead = false;