summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jamie Gennis <jgennis@google.com> 2011-03-01 11:41:29 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2011-03-01 11:41:29 -0800
commit7fc013753bdaddd429ffbc13ba33cc405f4ebcee (patch)
tree38b831ba27c1a2d24034118b4bc09bc9d96d57f8
parent2f6409686f4ecced13474db9307fcd33a805b2bf (diff)
parent94c59802c055d5f45f143896e59a3dc860cdc1b2 (diff)
Merge "Stagefright: Query buffer usage from the component."
-rw-r--r--media/libstagefright/ACodec.cpp11
-rw-r--r--media/libstagefright/OMXCodec.cpp11
2 files changed, 18 insertions, 4 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 2bbb32048bce..e43cdaaf6208 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -440,10 +440,17 @@ status_t ACodec::allocateOutputBuffersFromNativeWindow() {
}
// Set up the native window.
- // XXX TODO: Get the gralloc usage flags from the OMX plugin!
+ OMX_U32 usage = 0;
+ err = mOMX->getGraphicBufferUsage(mNode, kPortIndexOutput, &usage);
+ if (err != 0) {
+ LOGW("querying usage flags from OMX IL component failed: %d", err);
+ // XXX: Currently this error is logged, but not fatal.
+ usage = 0;
+ }
+
err = native_window_set_usage(
mNativeWindow.get(),
- GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
+ usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
if (err != 0) {
LOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 00b13104a332..5f40893193d5 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1753,9 +1753,16 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
}
// Set up the native window.
- // XXX TODO: Get the gralloc usage flags from the OMX plugin!
+ OMX_U32 usage = 0;
+ err = mOMX->getGraphicBufferUsage(mNode, kPortIndexOutput, &usage);
+ if (err != 0) {
+ LOGW("querying usage flags from OMX IL component failed: %d", err);
+ // XXX: Currently this error is logged, but not fatal.
+ usage = 0;
+ }
+
err = native_window_set_usage(
- mNativeWindow.get(), GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
+ mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
if (err != 0) {
LOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
return err;