diff options
author | Jamie Gennis <jgennis@google.com> | 2011-02-24 12:48:17 -0800 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-02-28 12:12:58 -0800 |
commit | 3c14b9745c4afc88cec247d9dd0b003e087cbb52 (patch) | |
tree | 41a11dc48c86b3eb0352f35d3ff389ec14bced8c /media/libstagefright | |
parent | e2ce6458659c6e1bad420357b61dc10cd8bbe2ab (diff) | |
download | frameworks_av-3c14b9745c4afc88cec247d9dd0b003e087cbb52.zip frameworks_av-3c14b9745c4afc88cec247d9dd0b003e087cbb52.tar.gz frameworks_av-3c14b9745c4afc88cec247d9dd0b003e087cbb52.tar.bz2 |
Stagefright: Query buffer usage from the component.
This change makes Stagefright query the gralloc buffer usage flags from
the OMX IL component and passing those flags on to the ANativeWindow.
Change-Id: Ic9af8a9e6df9ff4aadc7355890324d68841bc488
Related-Bug: 3479027
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 12 | ||||
-rw-r--r-- | media/libstagefright/OMXCodec.cpp | 11 |
2 files changed, 18 insertions, 5 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index b0ae3d8..6ab28ea 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); @@ -2286,4 +2293,3 @@ void ACodec::FlushingState::changeStateIfWeOwnAllBuffers() { } } // namespace android - diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 5d502e7..26f4d6c 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; |