diff options
author | Lajos Molnar <lajos@google.com> | 2015-04-30 18:46:16 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-05-01 01:59:35 +0000 |
commit | f06cc24ce7aeb5ff6f45b770a15286c95f8cc9ff (patch) | |
tree | 22ce17daecad35ec164ff03caec5e9b02396ef14 /media/libstagefright/MediaCodec.cpp | |
parent | 1de1e25cba872bd4c077c2e394f8ca9c70b65856 (diff) | |
download | frameworks_av-f06cc24ce7aeb5ff6f45b770a15286c95f8cc9ff.zip frameworks_av-f06cc24ce7aeb5ff6f45b770a15286c95f8cc9ff.tar.gz frameworks_av-f06cc24ce7aeb5ff6f45b770a15286c95f8cc9ff.tar.bz2 |
stagefright: MediaCodec: rename mNativeWindow to mSurface
because mNativeWindow is of type sp<Surface>
Bug: 19489395
Change-Id: I5ddc78b04e387915a2293b71195d7a6494986356
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r-- | media/libstagefright/MediaCodec.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 25887ef..9906a10 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -466,7 +466,7 @@ status_t MediaCodec::setCallback(const sp<AMessage> &callback) { status_t MediaCodec::configure( const sp<AMessage> &format, - const sp<Surface> &nativeWindow, + const sp<Surface> &surface, const sp<ICrypto> &crypto, uint32_t flags) { sp<AMessage> msg = new AMessage(kWhatConfigure, this); @@ -478,10 +478,7 @@ status_t MediaCodec::configure( msg->setMessage("format", format); msg->setInt32("flags", flags); - - if (nativeWindow != NULL) { - msg->setObject("native-window", nativeWindow); - } + msg->setObject("surface", surface); if (crypto != NULL) { msg->setPointer("crypto", crypto.get()); @@ -1324,13 +1321,13 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { ALOGV("codec output format changed"); if (mSoftRenderer == NULL && - mNativeWindow != NULL && + mSurface != NULL && (mFlags & kFlagUsesSoftwareRenderer)) { AString mime; CHECK(msg->findString("mime", &mime)); if (mime.startsWithIgnoreCase("video/")) { - mSoftRenderer = new SoftwareRenderer(mNativeWindow); + mSoftRenderer = new SoftwareRenderer(mSurface); } } @@ -1602,22 +1599,20 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { } sp<RefBase> obj; - if (!msg->findObject("native-window", &obj)) { - obj.clear(); - } + CHECK(msg->findObject("surface", &obj)); sp<AMessage> format; CHECK(msg->findMessage("format", &format)); if (obj != NULL) { format->setObject("native-window", obj); - status_t err = setNativeWindow(static_cast<Surface *>(obj.get())); + status_t err = handleSetSurface(static_cast<Surface *>(obj.get())); if (err != OK) { PostReplyWithError(replyID, err); break; } } else { - setNativeWindow(NULL); + handleSetSurface(NULL); } mReplyID = replyID; @@ -2100,7 +2095,7 @@ void MediaCodec::setState(State newState) { mSoftRenderer = NULL; mCrypto.clear(); - setNativeWindow(NULL); + handleSetSurface(NULL); mInputFormat.clear(); mOutputFormat.clear(); @@ -2406,25 +2401,24 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) { return index; } -status_t MediaCodec::setNativeWindow( - const sp<Surface> &surfaceTextureClient) { +status_t MediaCodec::handleSetSurface(const sp<Surface> &surface) { status_t err; - if (mNativeWindow != NULL) { + if (mSurface != NULL) { err = native_window_api_disconnect( - mNativeWindow.get(), NATIVE_WINDOW_API_MEDIA); + mSurface.get(), NATIVE_WINDOW_API_MEDIA); if (err != OK) { ALOGW("native_window_api_disconnect returned an error: %s (%d)", strerror(-err), err); } - mNativeWindow.clear(); + mSurface.clear(); } - if (surfaceTextureClient != NULL) { + if (surface != NULL) { err = native_window_api_connect( - surfaceTextureClient.get(), NATIVE_WINDOW_API_MEDIA); + surface.get(), NATIVE_WINDOW_API_MEDIA); if (err != OK) { ALOGE("native_window_api_connect returned an error: %s (%d)", @@ -2433,7 +2427,7 @@ status_t MediaCodec::setNativeWindow( return err; } - mNativeWindow = surfaceTextureClient; + mSurface = surface; } return OK; |