summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodec.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2012-07-13 12:48:19 +0300
committerAndreas Huber <andih@google.com>2012-08-07 11:08:12 -0700
commit972f2321583ef4094477271e0fc6a1d05a1a0eea (patch)
treeae5c8ddade5a100486d8a989c7c4d755b7908d60 /media/libstagefright/MediaCodec.cpp
parent97197157cf619fb716710eb67915fdfa93502750 (diff)
downloadframeworks_av-972f2321583ef4094477271e0fc6a1d05a1a0eea.zip
frameworks_av-972f2321583ef4094477271e0fc6a1d05a1a0eea.tar.gz
frameworks_av-972f2321583ef4094477271e0fc6a1d05a1a0eea.tar.bz2
mediacodec: Return an error on getOutputFormat if there is no output format yet
This avoids crashing if calling the public java method MediaCodec.getOutputFormat immediately after MediaCodec.start (as the documentation example shows that one should do!). Change-Id: Icd3dd7ab9ae9e8f2a67cef171ff176735de95f58
Diffstat (limited to 'media/libstagefright/MediaCodec.cpp')
-rw-r--r--media/libstagefright/MediaCodec.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 67f5a22..2060699 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -1118,7 +1118,8 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) {
CHECK(msg->senderAwaitsResponse(&replyID));
if ((mState != STARTED && mState != FLUSHING)
- || (mFlags & kFlagStickyError)) {
+ || (mFlags & kFlagStickyError)
+ || mOutputFormat == NULL) {
sp<AMessage> response = new AMessage;
response->setInt32("err", INVALID_OPERATION);