Bug 1239610 - Remove GonkNativeWindowClient usage from OmxDecoder r=jolin
authorSotaro Ikeda <sotaro.ikeda.g@gmail.com>
Fri, 15 Jan 2016 00:32:33 -0800
changeset 322086 841c1b4622bd93303ed011d01f4a0e950a53eb17
parent 322085 fe0896c1584a6ad0db8231b69f8171c46103f6cf
child 322087 96166e9cc7cc28b2aa46bd95d71655b1621fd436
push id9530
push userdmitchell@mozilla.com
push dateFri, 15 Jan 2016 19:42:24 +0000
bugs1239610
milestone46.0a1
Bug 1239610 - Remove GonkNativeWindowClient usage from OmxDecoder r=jolin
dom/media/omx/OmxDecoder.cpp
dom/media/omx/OmxDecoder.h
--- a/dom/media/omx/OmxDecoder.cpp
+++ b/dom/media/omx/OmxDecoder.cpp
@@ -14,16 +14,22 @@
 #include <stagefright/MetaData.h>
 #include <stagefright/OMXClient.h>
 #include <stagefright/OMXCodec.h>
 #include <OMX.h>
 #if MOZ_WIDGET_GONK && ANDROID_VERSION >= 17
 #include <ui/Fence.h>
 #endif
 
+#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
+#include <gui/Surface.h>
+#else
+#include <gui/SurfaceTextureClient.h>
+#endif
+
 #include "mozilla/layers/GrallocTextureClient.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Types.h"
 #include "mozilla/Monitor.h"
 #include "nsMimeTypes.h"
 #include "MPAPI.h"
 #include "mozilla/Logging.h"
@@ -226,21 +232,21 @@ OmxDecoder::AllocateMediaResources()
     sp<IGonkGraphicBufferConsumer> consumer;
     GonkBufferQueue::createBufferQueue(&producer, &consumer);
     mNativeWindow = new GonkNativeWindow(consumer);
 #else
     mNativeWindow = new GonkNativeWindow();
 #endif
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
-    mNativeWindowClient = new GonkNativeWindowClient(producer);
+    mNativeWindowClient = new Surface(producer);
 #elif defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
-    mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow->getBufferQueue());
+    mNativeWindowClient = new Surface(mNativeWindow->getBufferQueue());
 #else
-    mNativeWindowClient = new GonkNativeWindowClient(mNativeWindow);
+    mNativeWindowClient = new SurfaceTextureClient(mNativeWindow);
 #endif
 
     // Experience with OMX codecs is that only the HW decoders are
     // worth bothering with, at least on the platforms where this code
     // is currently used, and for formats this code is currently used
     // for (h.264).  So if we don't get a hardware decoder, just give
     // up.
 #ifdef MOZ_OMX_WEBM_DECODER
--- a/dom/media/omx/OmxDecoder.h
+++ b/dom/media/omx/OmxDecoder.h
@@ -1,17 +1,16 @@
 #include <set>
 #include <stagefright/foundation/ABase.h>
 #include <stagefright/foundation/AHandlerReflector.h>
 #include <stagefright/foundation/ALooper.h>
 #include <utils/RefBase.h>
 #include <stagefright/MediaExtractor.h>
 
 #include "GonkNativeWindow.h"
-#include "GonkNativeWindowClient.h"
 #include "mozilla/layers/FenceUtils.h"
 #include "MP3FrameParser.h"
 #include "MPAPI.h"
 #include "MediaOmxCommonReader.h"
 #include "AbstractMediaDecoder.h"
 #include "OMXCodecProxy.h"
 
 namespace android {
@@ -37,17 +36,18 @@ class OmxDecoder : public RefBase {
   };
 
   enum {
     kNotifyPostReleaseVideoBuffer = 'noti',
   };
 
   AbstractMediaDecoder *mDecoder;
   sp<GonkNativeWindow> mNativeWindow;
-  sp<GonkNativeWindowClient> mNativeWindowClient;
+  sp<ANativeWindow> mNativeWindowClient;
+
   sp<MediaSource> mVideoTrack;
   sp<OMXCodecProxy> mVideoSource;
   sp<MediaSource> mAudioOffloadTrack;
   sp<MediaSource> mAudioTrack;
   sp<MediaSource> mAudioSource;
   int32_t mDisplayWidth;
   int32_t mDisplayHeight;
   int32_t mVideoWidth;