Loading media/codec2/sfplugin/C2OMXNode.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -287,7 +287,7 @@ status_t C2OMXNode::emptyBuffer( return UNKNOWN_ERROR; } (void)mBufferIdsInUse.emplace(index, buffer); mBufferIdsInUse.lock()->emplace(index, buffer); return OK; } Loading Loading @@ -327,13 +327,19 @@ void C2OMXNode::onInputBufferDone(c2_cntr64_t index) { ALOGD("Buffer source not set (index=%llu)", index.peekull()); return; } auto it = mBufferIdsInUse.find(index.peeku()); if (it == mBufferIdsInUse.end()) { int32_t bufferId = 0; { decltype(mBufferIdsInUse)::Locked bufferIds(mBufferIdsInUse); auto it = bufferIds->find(index.peeku()); if (it == bufferIds->end()) { ALOGV("Untracked input index %llu (maybe already removed)", index.peekull()); return; } (void)mBufferSource->onInputBufferEmptied(it->second, -1); (void)mBufferIdsInUse.erase(it); bufferId = it->second; (void)bufferIds->erase(it); } (void)mBufferSource->onInputBufferEmptied(bufferId, -1); } } // namespace android media/codec2/sfplugin/C2OMXNode.h +3 −2 Original line number Diff line number Diff line Loading @@ -20,9 +20,10 @@ #include <atomic> #include <android/IOMXBufferSource.h> #include <codec2/hidl/client.h> #include <media/stagefright/foundation/Mutexed.h> #include <media/IOMX.h> #include <media/OMXBuffer.h> #include <codec2/hidl/client.h> namespace android { Loading Loading @@ -111,7 +112,7 @@ private: c2_cntr64_t mPrevInputTimestamp; // input timestamp for previous frame c2_cntr64_t mPrevCodecTimestamp; // adjusted (codec) timestamp for previous frame std::map<uint64_t, buffer_id> mBufferIdsInUse; Mutexed<std::map<uint64_t, buffer_id>> mBufferIdsInUse; }; } // namespace android Loading Loading
media/codec2/sfplugin/C2OMXNode.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -287,7 +287,7 @@ status_t C2OMXNode::emptyBuffer( return UNKNOWN_ERROR; } (void)mBufferIdsInUse.emplace(index, buffer); mBufferIdsInUse.lock()->emplace(index, buffer); return OK; } Loading Loading @@ -327,13 +327,19 @@ void C2OMXNode::onInputBufferDone(c2_cntr64_t index) { ALOGD("Buffer source not set (index=%llu)", index.peekull()); return; } auto it = mBufferIdsInUse.find(index.peeku()); if (it == mBufferIdsInUse.end()) { int32_t bufferId = 0; { decltype(mBufferIdsInUse)::Locked bufferIds(mBufferIdsInUse); auto it = bufferIds->find(index.peeku()); if (it == bufferIds->end()) { ALOGV("Untracked input index %llu (maybe already removed)", index.peekull()); return; } (void)mBufferSource->onInputBufferEmptied(it->second, -1); (void)mBufferIdsInUse.erase(it); bufferId = it->second; (void)bufferIds->erase(it); } (void)mBufferSource->onInputBufferEmptied(bufferId, -1); } } // namespace android
media/codec2/sfplugin/C2OMXNode.h +3 −2 Original line number Diff line number Diff line Loading @@ -20,9 +20,10 @@ #include <atomic> #include <android/IOMXBufferSource.h> #include <codec2/hidl/client.h> #include <media/stagefright/foundation/Mutexed.h> #include <media/IOMX.h> #include <media/OMXBuffer.h> #include <codec2/hidl/client.h> namespace android { Loading Loading @@ -111,7 +112,7 @@ private: c2_cntr64_t mPrevInputTimestamp; // input timestamp for previous frame c2_cntr64_t mPrevCodecTimestamp; // adjusted (codec) timestamp for previous frame std::map<uint64_t, buffer_id> mBufferIdsInUse; Mutexed<std::map<uint64_t, buffer_id>> mBufferIdsInUse; }; } // namespace android Loading