OSDN Git Service

MediaCodec: move to UNINITIALIZED state on codec error
authorLajos Molnar <lajos@google.com>
Mon, 31 Mar 2014 19:30:01 +0000 (12:30 -0700)
committerLajos Molnar <lajos@google.com>
Tue, 1 Apr 2014 00:14:22 +0000 (17:14 -0700)
ACodec moves to Uninitialized state after receiving codec error.
Make MediaCodec also move to the same state, so stop() and
release() will work correctly.

Bug: 13675112
Change-Id: I1c7e8b274f68345fc0e6a55c70dff6c7a4fb2e72

media/libstagefright/MediaCodec.cpp

index e0419ca..601dccf 100644 (file)
@@ -603,6 +603,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
                             postActivityNotificationIfPossible();
 
                             cancelPendingDequeueOperations();
+                            setState(UNINITIALIZED);
                             break;
                         }
 
@@ -612,6 +613,7 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
 
                             mFlags |= kFlagStickyError;
                             postActivityNotificationIfPossible();
+                            setState(UNINITIALIZED);
                             break;
                         }
                     }