зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322650 - Make video decoding work with new SurfaceTexture API r=jolin
MozReview-Commit-ID: EXQ5YDSMMGL
This commit is contained in:
Родитель
83de9ddd9d
Коммит
e92f96eef9
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "AndroidBridge.h"
|
||||
#include "AndroidDecoderModule.h"
|
||||
#include "AndroidSurfaceTexture.h"
|
||||
#include "JavaCallbacksSupport.h"
|
||||
#include "SimpleMap.h"
|
||||
#include "GLImages.h"
|
||||
|
@ -134,7 +133,7 @@ public:
|
|||
|
||||
if (size > 0) {
|
||||
RefPtr<layers::Image> img = new SurfaceTextureImage(
|
||||
mDecoder->mSurfaceTexture.get(), inputInfo.mImageSize,
|
||||
mDecoder->mSurfaceHandle, inputInfo.mImageSize,
|
||||
gl::OriginPos::BottomLeft);
|
||||
|
||||
RefPtr<VideoData> v = VideoData::CreateFromImage(
|
||||
|
@ -177,18 +176,12 @@ public:
|
|||
|
||||
RefPtr<InitPromise> Init() override
|
||||
{
|
||||
mSurfaceTexture = AndroidSurfaceTexture::Create();
|
||||
if (!mSurfaceTexture) {
|
||||
NS_WARNING("Failed to create SurfaceTexture for video decode\n");
|
||||
return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
__func__);
|
||||
jni::Object::LocalRef surf = SurfaceAllocator::AcquireSurface(mConfig.mImage.width, mConfig.mImage.height, false);
|
||||
if (!surf) {
|
||||
return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
|
||||
}
|
||||
|
||||
if (!jni::IsFennec()) {
|
||||
NS_WARNING("Remote decoding not supported in non-Fennec environment\n");
|
||||
return InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
__func__);
|
||||
}
|
||||
mSurfaceHandle = GeckoSurface::LocalRef(GeckoSurface::Ref::From(surf))->GetHandle();
|
||||
|
||||
// Register native methods.
|
||||
JavaCallbacksSupport::Init();
|
||||
|
@ -197,9 +190,10 @@ public:
|
|||
JavaCallbacksSupport::AttachNative(
|
||||
mJavaCallbacks, mozilla::MakeUnique<CallbacksSupport>(this));
|
||||
|
||||
auto surfRef = Surface::LocalRef(Surface::Ref::From(surf));
|
||||
mJavaDecoder = CodecProxy::Create(false, // false indicates to create a decoder and true denotes encoder
|
||||
mFormat,
|
||||
mSurfaceTexture->JavaSurface(),
|
||||
surfRef,
|
||||
mJavaCallbacks,
|
||||
mDrmStubId);
|
||||
if (mJavaDecoder == nullptr) {
|
||||
|
@ -239,7 +233,7 @@ public:
|
|||
private:
|
||||
layers::ImageContainer* mImageContainer;
|
||||
const VideoInfo mConfig;
|
||||
RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
|
||||
AndroidSurfaceTextureHandle mSurfaceHandle;
|
||||
SimpleMap<InputInfo> mInputInfos;
|
||||
bool mIsCodecSupportAdaptivePlayback = false;
|
||||
};
|
||||
|
@ -411,7 +405,6 @@ RemoteDataDecoder::CreateVideoDecoder(const CreateDecoderParams& aParams,
|
|||
const nsString& aDrmStubId,
|
||||
CDMProxy* aProxy)
|
||||
{
|
||||
|
||||
const VideoInfo& config = aParams.VideoConfig();
|
||||
MediaFormat::LocalRef format;
|
||||
NS_ENSURE_SUCCESS(
|
||||
|
|
|
@ -38,6 +38,14 @@
|
|||
|
||||
<application>
|
||||
<!-- New child services must also be added to the Fennec AndroidManifest.xml.in -->
|
||||
<service
|
||||
android:name="org.mozilla.gecko.media.MediaManager"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:process=":media"
|
||||
android:isolatedProcess="false">
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="org.mozilla.gecko.process.GeckoServiceChildProcess$geckomediaplugin"
|
||||
android:enabled="true"
|
||||
|
|
Загрузка…
Ссылка в новой задаче