Loading media/libstagefright/include/OMX.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -166,13 +166,13 @@ private: Mutex mLock; Mutex mLock; OMXMaster *mMaster; OMXMaster *mMaster; int32_t mNodeCounter; size_t mNodeCounter; KeyedVector<wp<IBinder>, OMXNodeInstance *> mLiveNodes; KeyedVector<wp<IBinder>, OMXNodeInstance *> mLiveNodes; KeyedVector<node_id, OMXNodeInstance *> mNodeIDToInstance; KeyedVector<node_id, OMXNodeInstance *> mNodeIDToInstance; KeyedVector<node_id, sp<CallbackDispatcher> > mDispatchers; KeyedVector<node_id, sp<CallbackDispatcher> > mDispatchers; node_id makeNodeID(OMXNodeInstance *instance); node_id makeNodeID_l(OMXNodeInstance *instance); OMXNodeInstance *findInstance(node_id node); OMXNodeInstance *findInstance(node_id node); sp<CallbackDispatcher> findDispatcher(node_id node); sp<CallbackDispatcher> findDispatcher(node_id node); Loading media/libstagefright/omx/OMX.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,9 @@ namespace android { namespace android { // node ids are created by concatenating the pid with a 16-bit counter static size_t kMaxNodeInstances = (1 << 16); //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // This provides the underlying Thread used by CallbackDispatcher. // This provides the underlying Thread used by CallbackDispatcher. Loading Loading @@ -237,6 +240,11 @@ status_t OMX::allocateNode( *node = 0; *node = 0; if (mNodeIDToInstance.size() == kMaxNodeInstances) { // all possible node IDs are in use return NO_MEMORY; } OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name); OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name); OMX_COMPONENTTYPE *handle; OMX_COMPONENTTYPE *handle; Loading @@ -252,7 +260,7 @@ status_t OMX::allocateNode( return StatusFromOMXError(err); return StatusFromOMXError(err); } } *node = makeNodeID(instance); *node = makeNodeID_l(instance); mDispatchers.add(*node, new CallbackDispatcher(instance)); mDispatchers.add(*node, new CallbackDispatcher(instance)); instance->setHandle(*node, handle); instance->setHandle(*node, handle); Loading Loading @@ -690,10 +698,17 @@ OMX_ERRORTYPE OMX::OnFillBufferDone( return OMX_ErrorNone; return OMX_ErrorNone; } } OMX::node_id OMX::makeNodeID(OMXNodeInstance *instance) { OMX::node_id OMX::makeNodeID_l(OMXNodeInstance *instance) { // mLock is already held. // mLock is already held. node_id node = (node_id)++mNodeCounter; node_id prefix = node_id(getpid() << 16); node_id node = 0; do { if (++mNodeCounter >= kMaxNodeInstances) { mNodeCounter = 0; // OK to use because we're combining with the pid } node = node_id(prefix | mNodeCounter); } while (mNodeIDToInstance.indexOfKey(node) >= 0); mNodeIDToInstance.add(node, instance); mNodeIDToInstance.add(node, instance); return node; return node; Loading Loading
media/libstagefright/include/OMX.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -166,13 +166,13 @@ private: Mutex mLock; Mutex mLock; OMXMaster *mMaster; OMXMaster *mMaster; int32_t mNodeCounter; size_t mNodeCounter; KeyedVector<wp<IBinder>, OMXNodeInstance *> mLiveNodes; KeyedVector<wp<IBinder>, OMXNodeInstance *> mLiveNodes; KeyedVector<node_id, OMXNodeInstance *> mNodeIDToInstance; KeyedVector<node_id, OMXNodeInstance *> mNodeIDToInstance; KeyedVector<node_id, sp<CallbackDispatcher> > mDispatchers; KeyedVector<node_id, sp<CallbackDispatcher> > mDispatchers; node_id makeNodeID(OMXNodeInstance *instance); node_id makeNodeID_l(OMXNodeInstance *instance); OMXNodeInstance *findInstance(node_id node); OMXNodeInstance *findInstance(node_id node); sp<CallbackDispatcher> findDispatcher(node_id node); sp<CallbackDispatcher> findDispatcher(node_id node); Loading
media/libstagefright/omx/OMX.cpp +18 −3 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,9 @@ namespace android { namespace android { // node ids are created by concatenating the pid with a 16-bit counter static size_t kMaxNodeInstances = (1 << 16); //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // This provides the underlying Thread used by CallbackDispatcher. // This provides the underlying Thread used by CallbackDispatcher. Loading Loading @@ -237,6 +240,11 @@ status_t OMX::allocateNode( *node = 0; *node = 0; if (mNodeIDToInstance.size() == kMaxNodeInstances) { // all possible node IDs are in use return NO_MEMORY; } OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name); OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name); OMX_COMPONENTTYPE *handle; OMX_COMPONENTTYPE *handle; Loading @@ -252,7 +260,7 @@ status_t OMX::allocateNode( return StatusFromOMXError(err); return StatusFromOMXError(err); } } *node = makeNodeID(instance); *node = makeNodeID_l(instance); mDispatchers.add(*node, new CallbackDispatcher(instance)); mDispatchers.add(*node, new CallbackDispatcher(instance)); instance->setHandle(*node, handle); instance->setHandle(*node, handle); Loading Loading @@ -690,10 +698,17 @@ OMX_ERRORTYPE OMX::OnFillBufferDone( return OMX_ErrorNone; return OMX_ErrorNone; } } OMX::node_id OMX::makeNodeID(OMXNodeInstance *instance) { OMX::node_id OMX::makeNodeID_l(OMXNodeInstance *instance) { // mLock is already held. // mLock is already held. node_id node = (node_id)++mNodeCounter; node_id prefix = node_id(getpid() << 16); node_id node = 0; do { if (++mNodeCounter >= kMaxNodeInstances) { mNodeCounter = 0; // OK to use because we're combining with the pid } node = node_id(prefix | mNodeCounter); } while (mNodeIDToInstance.indexOfKey(node) >= 0); mNodeIDToInstance.add(node, instance); mNodeIDToInstance.add(node, instance); return node; return node; Loading