summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-07 14:02:01 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-07 14:02:01 -0700
commit45bd1159fa34b51ba077e0cde760d171ca092552 (patch)
tree679c5f55c40aa310039761a7f22bb861d648b9c4 /media
parentc0c2076e9a4dfd3b30b988d4ddd78abf9ed83166 (diff)
parent02654f01bc6bd2e581b4a1d2409ecea217294fa2 (diff)
downloadframeworks_base-45bd1159fa34b51ba077e0cde760d171ca092552.zip
frameworks_base-45bd1159fa34b51ba077e0cde760d171ca092552.tar.gz
frameworks_base-45bd1159fa34b51ba077e0cde760d171ca092552.tar.bz2
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 '02654f01bc6bd2e581b4a1d2409ecea217294fa2' into gingerbread-plus-aosp * commit '02654f01bc6bd2e581b4a1d2409ecea217294fa2': 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')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp37
-rw-r--r--media/libstagefright/OMXCodec.cpp16
-rw-r--r--media/libstagefright/StagefrightMetadataRetriever.cpp14
3 files changed, 51 insertions, 16 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.");
+ }
}
}
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 76c8870..e6cdac1 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -346,7 +346,8 @@ static int CompareSoftwareCodecsFirst(
}
// static
-uint32_t OMXCodec::getComponentQuirks(const char *componentName) {
+uint32_t OMXCodec::getComponentQuirks(
+ const char *componentName, bool isEncoder) {
uint32_t quirks = 0;
if (!strcmp(componentName, "OMX.PV.avcdec")) {
@@ -404,6 +405,13 @@ uint32_t OMXCodec::getComponentQuirks(const char *componentName) {
quirks |= kInputBufferSizesAreBogus;
}
+ if (!strncmp(componentName, "OMX.SEC.", 8) && !isEncoder) {
+ // These output buffers contain no video data, just some
+ // opaque information that allows the overlay to display their
+ // contents.
+ quirks |= kOutputBuffersAreUnreadable;
+ }
+
return quirks;
}
@@ -490,7 +498,7 @@ sp<MediaSource> OMXCodec::Create(
LOGV("Successfully allocated OMX node '%s'", componentName);
sp<OMXCodec> codec = new OMXCodec(
- omx, node, getComponentQuirks(componentName),
+ omx, node, getComponentQuirks(componentName, createEncoder),
createEncoder, mime, componentName,
source);
@@ -1747,6 +1755,10 @@ void OMXCodec::on_message(const omx_message &msg) {
buffer->meta_data()->setInt32(kKeyIsCodecConfig, true);
}
+ if (mQuirks & kOutputBuffersAreUnreadable) {
+ buffer->meta_data()->setInt32(kKeyIsUnreadable, true);
+ }
+
buffer->meta_data()->setPointer(
kKeyPlatformPrivate,
msg.u.extended_buffer_data.platform_private);
diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp
index 9d89c20..af9c70c 100644
--- a/media/libstagefright/StagefrightMetadataRetriever.cpp
+++ b/media/libstagefright/StagefrightMetadataRetriever.cpp
@@ -159,6 +159,20 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
LOGV("successfully decoded video frame.");
+ int32_t unreadable;
+ if (buffer->meta_data()->findInt32(kKeyIsUnreadable, &unreadable)
+ && unreadable != 0) {
+ LOGV("video frame is unreadable, decoder does not give us access "
+ "to the video data.");
+
+ buffer->release();
+ buffer = NULL;
+
+ decoder->stop();
+
+ return NULL;
+ }
+
int64_t timeUs;
CHECK(buffer->meta_data()->findInt64(kKeyTime, &timeUs));
if (thumbNailTime >= 0) {