summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-04-08 17:43:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-04-08 17:43:33 -0700
commit0741b1ae22ecb5f6ac449bf85ef06e05c8d8f438 (patch)
treec4c8bb845c6a05c446c895341f6ed32b18a7f5a6 /media
parent6cab9a6e3fc660ca9c2b32e01f86c71da222c181 (diff)
parent0fb4e73f5fd107b0ebd1c7a1a25dc40d99cf0705 (diff)
downloadframeworks_base-0741b1ae22ecb5f6ac449bf85ef06e05c8d8f438.zip
frameworks_base-0741b1ae22ecb5f6ac449bf85ef06e05c8d8f438.tar.gz
frameworks_base-0741b1ae22ecb5f6ac449bf85ef06e05c8d8f438.tar.bz2
am 0fb4e73f: am 3a9f5143: am 66380f76: Stagefright: authenticate ANativeWindow.
* commit '0fb4e73f5fd107b0ebd1c7a1a25dc40d99cf0705': Stagefright: authenticate ANativeWindow.
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/OMXCodec.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index c278992..06352f4 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1593,6 +1593,11 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) {
return allocateOutputBuffersFromNativeWindow();
}
+ if (mEnableGrallocUsageProtected && portIndex == kPortIndexOutput) {
+ LOGE("protected output buffers must be stent to an ANativeWindow");
+ return PERMISSION_DENIED;
+ }
+
OMX_PARAM_PORTDEFINITIONTYPE def;
InitOMXParams(&def);
def.nPortIndex = portIndex;
@@ -1761,6 +1766,25 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
usage |= GRALLOC_USAGE_PROTECTED;
}
+ // Make sure to check whether either Stagefright or the video decoder
+ // requested protected buffers.
+ if (usage & GRALLOC_USAGE_PROTECTED) {
+ // Verify that the ANativeWindow sends images directly to
+ // SurfaceFlinger.
+ int queuesToNativeWindow = 0;
+ err = mNativeWindow->query(
+ mNativeWindow.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
+ &queuesToNativeWindow);
+ if (err != 0) {
+ LOGE("error authenticating native window: %d", err);
+ return err;
+ }
+ if (queuesToNativeWindow != 1) {
+ LOGE("native window could not be authenticated");
+ return PERMISSION_DENIED;
+ }
+ }
+
LOGV("native_window_set_usage usage=0x%x", usage);
err = native_window_set_usage(
mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);