Bug 932820 - Workaround for ABI changes in OMX interface on HTC devices. r=doublec, a=bajaj
authorEdwin Flores <eflores@mozilla.com>
Wed, 22 Jan 2014 09:59:54 +1300
changeset 175930 9739614a88364c986eb0c898699fce4e6f58d4bf
parent 175929 c612bde706544e34e3d4d95068fd648842839334
child 175931 f109921a8d81d17ebe76dcb8086b5918454dbe5d
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdoublec, bajaj
bugs932820
milestone28.0a2
Bug 932820 - Workaround for ABI changes in OMX interface on HTC devices. r=doublec, a=bajaj 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
@@ -719,30 +719,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;
 
@@ -796,17 +803,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;