Bug 1239610 - Remove GonkNativeWindowClient usage from OmxDecoder r=jolin
--- 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;