From 1de1e25cba872bd4c077c2e394f8ca9c70b65856 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Thu, 30 Apr 2015 18:18:34 -0700 Subject: stagefright: remove NativeWindowWrapper Now that Surface and SurfaceTextureClient are the same and Surface, it does not add value. Bug: 19489395 Change-Id: I016ecd1cf5cc51ce6244b6fa34ecd75f84e3db01 --- .../nuplayer/NuPlayerDecoder.cpp | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp index 3c4d695..376c93a 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp @@ -33,6 +33,8 @@ #include #include +#include + #include "avc_utils.h" #include "ATSParser.h" @@ -42,10 +44,10 @@ NuPlayer::Decoder::Decoder( const sp ¬ify, const sp &source, const sp &renderer, - const sp &nativeWindow, + const sp &surface, const sp &ccDecoder) : DecoderBase(notify), - mNativeWindow(nativeWindow), + mSurface(surface), mSource(source), mRenderer(renderer), mCCDecoder(ccDecoder), @@ -178,14 +180,9 @@ void NuPlayer::Decoder::onConfigure(const sp &format) { mIsAudio = !strncasecmp("audio/", mime.c_str(), 6); mIsVideoAVC = !strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime.c_str()); - sp surface = NULL; - if (mNativeWindow != NULL) { - surface = mNativeWindow->getSurfaceTextureClient(); - } - mComponentName = mime; mComponentName.append(" decoder"); - ALOGV("[%s] onConfigure (surface=%p)", mComponentName.c_str(), surface.get()); + ALOGV("[%s] onConfigure (surface=%p)", mComponentName.c_str(), mSurface.get()); mCodec = MediaCodec::CreateByType(mCodecLooper, mime.c_str(), false /* encoder */); int32_t secure = 0; @@ -210,17 +207,17 @@ void NuPlayer::Decoder::onConfigure(const sp &format) { mCodec->getName(&mComponentName); status_t err; - if (mNativeWindow != NULL) { + if (mSurface != NULL) { // disconnect from surface as MediaCodec will reconnect err = native_window_api_disconnect( - surface.get(), NATIVE_WINDOW_API_MEDIA); + mSurface.get(), NATIVE_WINDOW_API_MEDIA); // We treat this as a warning, as this is a preparatory step. // Codec will try to connect to the surface, which is where // any error signaling will occur. ALOGW_IF(err != OK, "failed to disconnect from surface: %d", err); } err = mCodec->configure( - format, surface, NULL /* crypto */, 0 /* flags */); + format, mSurface, NULL /* crypto */, 0 /* flags */); if (err != OK) { ALOGE("Failed to configure %s decoder (err=%d)", mComponentName.c_str(), err); mCodec->release(); @@ -337,12 +334,10 @@ void NuPlayer::Decoder::onShutdown(bool notifyComplete) { mCodec = NULL; ++mBufferGeneration; - if (mNativeWindow != NULL) { + if (mSurface != NULL) { // reconnect to surface as MediaCodec disconnected from it status_t error = - native_window_api_connect( - mNativeWindow->getNativeWindow().get(), - NATIVE_WINDOW_API_MEDIA); + native_window_api_connect(mSurface.get(), NATIVE_WINDOW_API_MEDIA); ALOGW_IF(error != NO_ERROR, "[%s] failed to connect to native window, error=%d", mComponentName.c_str(), error); -- cgit v1.1