diff options
author | Andreas Huber <andih@google.com> | 2010-10-06 16:43:57 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-10-07 09:19:25 -0700 |
commit | 2b82e9652ba049e754c2cc74e381282f231d5fbf (patch) | |
tree | 8b4d7249f6a0ae009088918f19d17be00d36ea10 /media/libstagefright/AwesomePlayer.cpp | |
parent | 0bcae473ba1cd1d72e7cef8fbab449db060dc8d7 (diff) | |
download | frameworks_av-2b82e9652ba049e754c2cc74e381282f231d5fbf.zip frameworks_av-2b82e9652ba049e754c2cc74e381282f231d5fbf.tar.gz frameworks_av-2b82e9652ba049e754c2cc74e381282f231d5fbf.tar.bz2 |
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.
Change-Id: I1b8fe68c1766299844fe84ebbff49cb8b3e4cc7c
related-to-bug: 3070094
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 bfc23d4..3d0d108 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1571,21 +1571,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."); + } } } |