diff --git a/configure.in b/configure.in index d69c5b48a71..26c745a8c96 100644 --- a/configure.in +++ b/configure.in @@ -278,7 +278,7 @@ if test -n "$gonkdir" ; then AC_DEFINE(MOZ_OMX_ENCODER) AC_SUBST(MOZ_AUDIO_OFFLOAD) AC_DEFINE(MOZ_AUDIO_OFFLOAD) - MOZ_FMP4= + MOZ_FMP4=1 MOZ_B2G_CAMERA=1 if test -d "$gonkdir/system/bluetoothd"; then MOZ_B2G_BT=1 diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp index 6a70a11be54..968cba3084f 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp @@ -8,6 +8,7 @@ #include #include #include "GonkVideoDecoderManager.h" +#include "GrallocImages.h" #include "MediaDecoderReader.h" #include "ImageContainer.h" #include "VideoUtils.h" @@ -45,7 +46,6 @@ GonkVideoDecoderManager::GonkVideoDecoderManager( const VideoInfo& aConfig) : mImageContainer(aImageContainer) , mColorConverterBufferSize(0) - , mNativeWindow(nullptr) , mPendingReleaseItemsLock("GonkVideoDecoderManager::mPendingReleaseItemsLock") , mNeedsCopyBuffer(false) { @@ -122,7 +122,13 @@ GonkVideoDecoderManager::Init() uint32_t capability = MediaCodecProxy::kEmptyCapability; if (mDecoder->getCapability(&capability) == OK && (capability & MediaCodecProxy::kCanExposeGraphicBuffer)) { +#if ANDROID_VERSION >= 21 + sp consumer; + GonkBufferQueue::createBufferQueue(&mGraphicBufferProducer, &consumer); + mNativeWindow = new GonkNativeWindow(consumer); +#else mNativeWindow = new GonkNativeWindow(); +#endif } mVideoCodecRequest.Begin(mDecoder->AsyncAllocateVideoMediaCodec() @@ -604,7 +610,11 @@ GonkVideoDecoderManager::codecReserved() // the video decoding. format->setInt32("moz-use-undequeued-bufs", 1); if (mNativeWindow != nullptr) { +#if ANDROID_VERSION >= 21 + surface = new Surface(mGraphicBufferProducer); +#else surface = new Surface(mNativeWindow->getBufferQueue()); +#endif } mDecoder->configure(format, surface, nullptr, 0); mDecoder->Prepare(); diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.h b/dom/media/platforms/gonk/GonkVideoDecoderManager.h index 0f35b170452..496b6f5da0c 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.h +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.h @@ -116,6 +116,10 @@ private: size_t mColorConverterBufferSize; android::sp mNativeWindow; +#if ANDROID_VERSION >= 21 + android::sp mGraphicBufferProducer; +#endif + enum { kNotifyPostReleaseBuffer = 'nprb', };