diff options
author | Andreas Huber <andih@google.com> | 2010-10-10 11:16:01 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-10 11:16:01 -0700 |
commit | 79e0ac144ca9bb771e2c6b1954c882da12a4bea8 (patch) | |
tree | 6c2597e62ec99a3dcbb9f80d884dd87f1f1cf6e3 /media/libstagefright/AwesomePlayer.cpp | |
parent | 2b37ced30f89437c804c3945b901019b86d210ae (diff) | |
parent | 712a002fa3a507158c9ae3435b843edd3a69d7e8 (diff) | |
download | frameworks_av-79e0ac144ca9bb771e2c6b1954c882da12a4bea8.zip frameworks_av-79e0ac144ca9bb771e2c6b1954c882da12a4bea8.tar.gz frameworks_av-79e0ac144ca9bb771e2c6b1954c882da12a4bea8.tar.bz2 |
am 45bd1159: am 02654f01: Merge "On this particular device the hardware video decoder spits out buffers that don\'t actually contain our video data, so we cannot use them to restore the video frame after suspend/resume." into gingerbread
Merge commit '45bd1159fa34b51ba077e0cde760d171ca092552'
* commit '45bd1159fa34b51ba077e0cde760d171ca092552':
On this particular device the hardware video decoder spits out buffers that don't actually contain our video data, so we cannot use them to restore the video frame after suspend/resume.
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 4f5ff75..89dada0 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1593,21 +1593,30 @@ status_t AwesomePlayer::suspend() { if (mLastVideoBuffer) { size_t size = mLastVideoBuffer->range_length(); + if (size) { - state->mLastVideoFrameSize = size; - state->mLastVideoFrame = malloc(size); - memcpy(state->mLastVideoFrame, - (const uint8_t *)mLastVideoBuffer->data() - + mLastVideoBuffer->range_offset(), - size); - - state->mVideoWidth = mVideoWidth; - state->mVideoHeight = mVideoHeight; - - sp<MetaData> meta = mVideoSource->getFormat(); - CHECK(meta->findInt32(kKeyColorFormat, &state->mColorFormat)); - CHECK(meta->findInt32(kKeyWidth, &state->mDecodedWidth)); - CHECK(meta->findInt32(kKeyHeight, &state->mDecodedHeight)); + int32_t unreadable; + if (!mLastVideoBuffer->meta_data()->findInt32( + kKeyIsUnreadable, &unreadable) + || unreadable == 0) { + state->mLastVideoFrameSize = size; + state->mLastVideoFrame = malloc(size); + memcpy(state->mLastVideoFrame, + (const uint8_t *)mLastVideoBuffer->data() + + mLastVideoBuffer->range_offset(), + size); + + state->mVideoWidth = mVideoWidth; + state->mVideoHeight = mVideoHeight; + + sp<MetaData> meta = mVideoSource->getFormat(); + CHECK(meta->findInt32(kKeyColorFormat, &state->mColorFormat)); + CHECK(meta->findInt32(kKeyWidth, &state->mDecodedWidth)); + CHECK(meta->findInt32(kKeyHeight, &state->mDecodedHeight)); + } else { + LOGV("Unable to save last video frame, we have no access to " + "the decoded video data."); + } } } |