diff options
author | Wei Jia <wjia@google.com> | 2015-09-28 11:32:23 -0700 |
---|---|---|
committer | Wei Jia <wjia@google.com> | 2015-10-07 11:27:32 -0700 |
commit | 4a03d784f7c0e3a9685d182eee92ba6580eaf5a1 (patch) | |
tree | a7356ea6c85c6d1b4b45e0288f43b4f9fe9edae4 /media/libstagefright | |
parent | 74d1927e4122a1748f89ca2ef79406fc06ee94b2 (diff) | |
download | frameworks_av-4a03d784f7c0e3a9685d182eee92ba6580eaf5a1.zip frameworks_av-4a03d784f7c0e3a9685d182eee92ba6580eaf5a1.tar.gz frameworks_av-4a03d784f7c0e3a9685d182eee92ba6580eaf5a1.tar.bz2 |
DO NOT MERGE - OMX: allow only secure codec to remotely call allocateBuffer.
Bug: 24310423
Change-Id: Iebcfc58b447f925ec2134898060af2ef227266a3
(cherry picked from commit 8dde7269a5356503d2b283234b6cb46d0c3f214e)
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/include/OMX.h | 2 | ||||
-rw-r--r-- | media/libstagefright/include/OMXNodeInstance.h | 7 | ||||
-rw-r--r-- | media/libstagefright/omx/OMX.cpp | 7 | ||||
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 3 |
4 files changed, 16 insertions, 3 deletions
diff --git a/media/libstagefright/include/OMX.h b/media/libstagefright/include/OMX.h index 31a5077..2bc3759 100644 --- a/media/libstagefright/include/OMX.h +++ b/media/libstagefright/include/OMX.h @@ -126,6 +126,8 @@ public: virtual void binderDied(const wp<IBinder> &the_late_who); + virtual bool isSecure(IOMX::node_id node); + OMX_ERRORTYPE OnEvent( node_id node, OMX_IN OMX_EVENTTYPE eEvent, diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h index 339179e..30d9584 100644 --- a/media/libstagefright/include/OMXNodeInstance.h +++ b/media/libstagefright/include/OMXNodeInstance.h @@ -31,7 +31,7 @@ struct GraphicBufferSource; struct OMXNodeInstance { OMXNodeInstance( - OMX *owner, const sp<IOMXObserver> &observer); + OMX *owner, const sp<IOMXObserver> &observer, const char *name); void setHandle(OMX::node_id node_id, OMX_HANDLETYPE handle); @@ -110,6 +110,10 @@ struct OMXNodeInstance { const void *data, size_t size); + bool isSecure() const { + return mIsSecure; + } + void onMessage(const omx_message &msg); void onObserverDied(OMXMaster *master); void onGetHandleFailed(); @@ -125,6 +129,7 @@ private: OMX_HANDLETYPE mHandle; sp<IOMXObserver> mObserver; bool mDying; + bool mIsSecure; // Lock only covers mGraphicBufferSource. We can't always use mLock // because of rare instances where we'd end up locking it recursively. diff --git a/media/libstagefright/omx/OMX.cpp b/media/libstagefright/omx/OMX.cpp index 84a0e10..415910a 100644 --- a/media/libstagefright/omx/OMX.cpp +++ b/media/libstagefright/omx/OMX.cpp @@ -185,6 +185,11 @@ void OMX::binderDied(const wp<IBinder> &the_late_who) { instance->onObserverDied(mMaster); } +bool OMX::isSecure(node_id node) { + OMXNodeInstance *instance = findInstance(node); + return (instance == NULL ? false : instance->isSecure()); +} + bool OMX::livesLocally(node_id node, pid_t pid) { return pid == getpid(); } @@ -223,7 +228,7 @@ status_t OMX::allocateNode( *node = 0; - OMXNodeInstance *instance = new OMXNodeInstance(this, observer); + OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name); OMX_COMPONENTTYPE *handle; OMX_ERRORTYPE err = mMaster->makeComponentInstance( diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 4fe41c9..577e804 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -90,12 +90,13 @@ OMX_CALLBACKTYPE OMXNodeInstance::kCallbacks = { }; OMXNodeInstance::OMXNodeInstance( - OMX *owner, const sp<IOMXObserver> &observer) + OMX *owner, const sp<IOMXObserver> &observer, const char *name) : mOwner(owner), mNodeID(NULL), mHandle(NULL), mObserver(observer), mDying(false) { + mIsSecure = AString(name).endsWith(".secure"); } OMXNodeInstance::~OMXNodeInstance() { |