diff options
author | Chong Zhang <chz@google.com> | 2015-01-07 16:14:34 -0800 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-01-07 17:08:43 -0800 |
commit | 1713460104b86f6be3a5d9993d9ace864d889b2d (patch) | |
tree | 47be834572c94f418cd6d087e953a53a9d655127 /media/libstagefright/ACodec.cpp | |
parent | 5db7897ddd32e3ec3ab45ecdb6f21b6265e7e14a (diff) | |
download | frameworks_av-1713460104b86f6be3a5d9993d9ace864d889b2d.zip frameworks_av-1713460104b86f6be3a5d9993d9ace864d889b2d.tar.gz frameworks_av-1713460104b86f6be3a5d9993d9ace864d889b2d.tar.bz2 |
mark any copyrighted content as protected to disable capture
bug: 18916274
Change-Id: I23f096b51433bf18a10dc5fe6dc6b75c3881c340
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index e1b3b4d..794e365 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -670,7 +670,7 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( usage = 0; } - if (mFlags & kFlagIsSecure) { + if (mFlags & kFlagIsGrallocUsageProtected) { usage |= GRALLOC_USAGE_PROTECTED; } @@ -1262,6 +1262,16 @@ status_t ACodec::configureCodec( mStoreMetaDataInOutputBuffers = false; if (video && !encoder) { inputFormat->setInt32("adaptive-playback", false); + + int32_t usageProtected; + if (msg->findInt32("protected", &usageProtected) && usageProtected) { + if (!haveNativeWindow) { + ALOGE("protected output buffers must be sent to an ANativeWindow"); + return PERMISSION_DENIED; + } + mFlags |= kFlagIsGrallocUsageProtected; + mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown; + } } if (!encoder && video && haveNativeWindow) { sp<NativeWindowWrapper> windowWrapper( @@ -4627,6 +4637,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) { if (componentName.endsWith(".secure")) { mCodec->mFlags |= kFlagIsSecure; + mCodec->mFlags |= kFlagIsGrallocUsageProtected; mCodec->mFlags |= kFlagPushBlankBuffersToNativeWindowOnShutdown; } |