summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Huber <andih@google.com> 2010-05-20 11:16:28 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-05-20 11:16:28 -0700
commit2130fc82c7d5f6ed6521d494483d338decaeaa80 (patch)
tree6339ed611cdc10909b46591224b1c99651b36ee4
parent175305081174e21ca57ff38b61ecb72d276eadf1 (diff)
parentc6a16327328cf04066ce948c3fbad34fdf1fbff4 (diff)
am c6a16327: am 3c16154a: am 2723e092: Merge "Better handling of codec initialization failure in the player and thumbnail extractor. Return a runtime error instead of asserting if the software MPEG4/H.263 decoder fails to initialize." into froyo
-rw-r--r--cmds/stagefright/stagefright.cpp7
-rw-r--r--media/libstagefright/AwesomePlayer.cpp7
-rw-r--r--media/libstagefright/StagefrightMetadataRetriever.cpp7
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp11
4 files changed, 26 insertions, 6 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 4405da6f81ad..b838f320776f 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -75,7 +75,12 @@ static void playSource(OMXClient *client, const sp<MediaSource> &source) {
}
}
- rawSource->start();
+ status_t err = rawSource->start();
+
+ if (err != OK) {
+ fprintf(stderr, "rawSource returned error %d (0x%08x)\n", err, err);
+ return;
+ }
if (gPlaybackAudio) {
AudioPlayer *player = new AudioPlayer(NULL);
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index f668caacc239..274dad930bad 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -822,7 +822,12 @@ status_t AwesomePlayer::initVideoDecoder() {
CHECK(mVideoTrack->getFormat()->findInt32(kKeyWidth, &mVideoWidth));
CHECK(mVideoTrack->getFormat()->findInt32(kKeyHeight, &mVideoHeight));
- mVideoSource->start();
+ status_t err = mVideoSource->start();
+
+ if (err != OK) {
+ mVideoSource.clear();
+ return err;
+ }
}
return mVideoSource != NULL ? OK : UNKNOWN_ERROR;
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 29689177b711..258be7486748 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -120,7 +120,11 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
return NULL;
}
- decoder->start();
+ status_t err = decoder->start();
+ if (err != OK) {
+ LOGW("OMXCodec::start returned error %d (0x%08x)\n", err, err);
+ return NULL;
+ }
// Read one output buffer, ignore format change notifications
// and spurious empty buffers.
@@ -134,7 +138,6 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
}
MediaBuffer *buffer = NULL;
- status_t err;
do {
if (buffer != NULL) {
buffer->release();
diff --git a/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp b/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
index 40009f8f316a..8350f7a57c9e 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
@@ -120,9 +120,16 @@ status_t M4vH263Decoder::start(MetaData *) {
vol_size = 0;
}
- CHECK_EQ(PV_TRUE, PVInitVideoDecoder(
- mHandle, vol_data, &vol_size, 1, mWidth, mHeight, mode));
+
+ Bool success = PVInitVideoDecoder(
+ mHandle, vol_data, &vol_size, 1, mWidth, mHeight, mode);
if (vol_data[0]) free(vol_data[0]);
+
+ if (success != PV_TRUE) {
+ LOGW("PVInitVideoDecoder failed. Unsupported content?");
+ return ERROR_UNSUPPORTED;
+ }
+
MP4DecodingMode actualMode = PVGetDecBitstreamMode(mHandle);
CHECK_EQ(mode, actualMode);