diff options
author | Andreas Huber <andih@google.com> | 2010-05-20 10:37:06 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-05-20 10:37:06 -0700 |
commit | 1919e5af3d8eb8bcf08e50efae2e79eaf065cf6b (patch) | |
tree | 45b94c851309676baddec07b7879f97b59d024c7 /media | |
parent | dc737ca986ed9055b4bb39c67d470b6886522ca6 (diff) | |
download | frameworks_base-1919e5af3d8eb8bcf08e50efae2e79eaf065cf6b.zip frameworks_base-1919e5af3d8eb8bcf08e50efae2e79eaf065cf6b.tar.gz frameworks_base-1919e5af3d8eb8bcf08e50efae2e79eaf065cf6b.tar.bz2 |
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.
Change-Id: I5cba02ee85a41e43c2623053de40f26e2cf2efe4
related-to-bug: 2699505
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 7 | ||||
-rw-r--r-- | media/libstagefright/StagefrightMetadataRetriever.cpp | 7 | ||||
-rw-r--r-- | media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp | 11 |
3 files changed, 20 insertions, 5 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index f668caa..274dad9 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 2968917..258be74 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 40009f8..8350f7a 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); |