Loading media/codec2/hidl/1.0/utils/include/codec2/hidl/1.0/types.h +16 −3 Original line number Diff line number Diff line Loading @@ -206,10 +206,23 @@ private: std::mutex mMutex; sp<ClientManager> mSenderManager; sp<IClientManager> mReceiverManager; int64_t mReceiverConnectionId; int64_t mSourceConnectionId; std::chrono::steady_clock::time_point mLastSent; std::chrono::steady_clock::duration mRefreshInterval; struct Connection { int64_t receiverConnectionId; std::chrono::steady_clock::time_point lastSent; Connection(int64_t receiverConnectionId, std::chrono::steady_clock::time_point lastSent) : receiverConnectionId(receiverConnectionId), lastSent(lastSent) { } }; // Map of connections. // // The key is the connection id. One sender-receiver pair may have multiple // connections. std::map<int64_t, Connection> mConnections; }; // std::list<std::unique_ptr<C2Work>> -> WorkBundle Loading media/codec2/hidl/1.0/utils/types.cpp +35 −23 Original line number Diff line number Diff line Loading @@ -969,8 +969,6 @@ DefaultBufferPoolSender::DefaultBufferPoolSender( const sp<IClientManager>& receiverManager, std::chrono::steady_clock::duration refreshInterval) : mReceiverManager(receiverManager), mSourceConnectionId(0), mLastSent(std::chrono::steady_clock::now()), mRefreshInterval(refreshInterval) { } Loading @@ -980,6 +978,7 @@ void DefaultBufferPoolSender::setReceiver( std::lock_guard<std::mutex> lock(mMutex); if (mReceiverManager != receiverManager) { mReceiverManager = receiverManager; mConnections.clear(); } mRefreshInterval = refreshInterval; } Loading @@ -987,12 +986,16 @@ void DefaultBufferPoolSender::setReceiver( ResultStatus DefaultBufferPoolSender::send( const std::shared_ptr<BufferPoolData>& bpData, BufferStatusMessage* bpMessage) { int64_t connectionId = bpData->mConnectionId; if (connectionId == 0) { LOG(WARNING) << "registerSender -- invalid sender connection id (0)."; return ResultStatus::CRITICAL_ERROR; } std::lock_guard<std::mutex> lock(mMutex); if (!mReceiverManager) { LOG(ERROR) << "No access to receiver's BufferPool."; return ResultStatus::NOT_FOUND; } ResultStatus rs; std::lock_guard<std::mutex> lock(mMutex); if (!mSenderManager) { mSenderManager = ClientManager::getInstance(); if (!mSenderManager) { Loading @@ -1000,21 +1003,17 @@ ResultStatus DefaultBufferPoolSender::send( return ResultStatus::CRITICAL_ERROR; } } int64_t connectionId = bpData->mConnectionId; int64_t receiverConnectionId{0}; auto foundConnection = mConnections.find(connectionId); bool isNewConnection = foundConnection == mConnections.end(); std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); std::chrono::steady_clock::duration interval = now - mLastSent; if (mSourceConnectionId == 0 || mSourceConnectionId != connectionId || interval > mRefreshInterval) { if (isNewConnection || (now - foundConnection->second.lastSent > mRefreshInterval)) { // Initialize the bufferpool connection. mSourceConnectionId = connectionId; if (mSourceConnectionId == 0) { return ResultStatus::CRITICAL_ERROR; } int64_t receiverConnectionId; rs = mSenderManager->registerSender(mReceiverManager, ResultStatus rs = mSenderManager->registerSender(mReceiverManager, connectionId, &receiverConnectionId); if ((rs != ResultStatus::OK) && (rs != ResultStatus::ALREADY_EXISTS)) { Loading @@ -1022,30 +1021,43 @@ ResultStatus DefaultBufferPoolSender::send( << static_cast<int32_t>(rs) << "."; return rs; } else if (receiverConnectionId == 0) { LOG(WARNING) << "registerSender -- " "invalid receiver connection id (0)."; return ResultStatus::CRITICAL_ERROR; } else { mReceiverConnectionId = receiverConnectionId; if (isNewConnection) { foundConnection = mConnections.try_emplace( connectionId, receiverConnectionId, now).first; } else { foundConnection->second.receiverConnectionId = receiverConnectionId; } } } else { receiverConnectionId = foundConnection->second.receiverConnectionId; } uint64_t transactionId; int64_t timestampUs; rs = mSenderManager->postSend( mReceiverConnectionId, bpData, &transactionId, ×tampUs); ResultStatus rs = mSenderManager->postSend( receiverConnectionId, bpData, &transactionId, ×tampUs); if (rs != ResultStatus::OK) { LOG(ERROR) << "ClientManager::postSend -- returned error: " << static_cast<int32_t>(rs) << "."; mConnections.erase(foundConnection); return rs; } if (!bpMessage) { LOG(ERROR) << "Null output parameter for BufferStatusMessage."; mConnections.erase(foundConnection); return ResultStatus::CRITICAL_ERROR; } bpMessage->connectionId = mReceiverConnectionId; bpMessage->connectionId = receiverConnectionId; bpMessage->bufferId = bpData->mId; bpMessage->transactionId = transactionId; bpMessage->timestampUs = timestampUs; mLastSent = now; foundConnection->second.lastSent = now; return rs; } Loading media/extractors/mp4/MPEG4Extractor.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -6679,6 +6679,12 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { // The smallest valid chunk is 16 bytes long in this case. return false; } if (chunkSize > INT64_MAX) { // reject overly large chunk sizes that could // be interpreted as negative ALOGE("chunk size too large"); return false; } } else if (chunkSize < 8) { // The smallest valid chunk is 8 bytes long. Loading Loading @@ -6734,7 +6740,10 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { case FOURCC("moov"): { moovAtomEndOffset = offset + chunkSize; if (__builtin_add_overflow(offset, chunkSize, &moovAtomEndOffset)) { ALOGE("chunk size + offset would overflow"); return false; } done = true; break; Loading @@ -6744,7 +6753,10 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { break; } offset += chunkSize; if (__builtin_add_overflow(offset, chunkSize, &offset)) { ALOGE("chunk size + offset would overflow"); return false; } } if (!foundGoodFileType) { Loading media/libaaudio/examples/input_monitor/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ cc_test { cflags: ["-Wall", "-Werror"], shared_libs: ["libaaudio"], header_libs: ["libaaudio_example_utils"], pack_relocations: false, } cc_test { Loading @@ -15,5 +14,4 @@ cc_test { cflags: ["-Wall", "-Werror"], shared_libs: ["libaaudio"], header_libs: ["libaaudio_example_utils"], pack_relocations: false, } media/libaaudio/examples/loopback/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,4 @@ cc_test { "libaudioutils", ], header_libs: ["libaaudio_example_utils"], pack_relocations: false, } Loading
media/codec2/hidl/1.0/utils/include/codec2/hidl/1.0/types.h +16 −3 Original line number Diff line number Diff line Loading @@ -206,10 +206,23 @@ private: std::mutex mMutex; sp<ClientManager> mSenderManager; sp<IClientManager> mReceiverManager; int64_t mReceiverConnectionId; int64_t mSourceConnectionId; std::chrono::steady_clock::time_point mLastSent; std::chrono::steady_clock::duration mRefreshInterval; struct Connection { int64_t receiverConnectionId; std::chrono::steady_clock::time_point lastSent; Connection(int64_t receiverConnectionId, std::chrono::steady_clock::time_point lastSent) : receiverConnectionId(receiverConnectionId), lastSent(lastSent) { } }; // Map of connections. // // The key is the connection id. One sender-receiver pair may have multiple // connections. std::map<int64_t, Connection> mConnections; }; // std::list<std::unique_ptr<C2Work>> -> WorkBundle Loading
media/codec2/hidl/1.0/utils/types.cpp +35 −23 Original line number Diff line number Diff line Loading @@ -969,8 +969,6 @@ DefaultBufferPoolSender::DefaultBufferPoolSender( const sp<IClientManager>& receiverManager, std::chrono::steady_clock::duration refreshInterval) : mReceiverManager(receiverManager), mSourceConnectionId(0), mLastSent(std::chrono::steady_clock::now()), mRefreshInterval(refreshInterval) { } Loading @@ -980,6 +978,7 @@ void DefaultBufferPoolSender::setReceiver( std::lock_guard<std::mutex> lock(mMutex); if (mReceiverManager != receiverManager) { mReceiverManager = receiverManager; mConnections.clear(); } mRefreshInterval = refreshInterval; } Loading @@ -987,12 +986,16 @@ void DefaultBufferPoolSender::setReceiver( ResultStatus DefaultBufferPoolSender::send( const std::shared_ptr<BufferPoolData>& bpData, BufferStatusMessage* bpMessage) { int64_t connectionId = bpData->mConnectionId; if (connectionId == 0) { LOG(WARNING) << "registerSender -- invalid sender connection id (0)."; return ResultStatus::CRITICAL_ERROR; } std::lock_guard<std::mutex> lock(mMutex); if (!mReceiverManager) { LOG(ERROR) << "No access to receiver's BufferPool."; return ResultStatus::NOT_FOUND; } ResultStatus rs; std::lock_guard<std::mutex> lock(mMutex); if (!mSenderManager) { mSenderManager = ClientManager::getInstance(); if (!mSenderManager) { Loading @@ -1000,21 +1003,17 @@ ResultStatus DefaultBufferPoolSender::send( return ResultStatus::CRITICAL_ERROR; } } int64_t connectionId = bpData->mConnectionId; int64_t receiverConnectionId{0}; auto foundConnection = mConnections.find(connectionId); bool isNewConnection = foundConnection == mConnections.end(); std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); std::chrono::steady_clock::duration interval = now - mLastSent; if (mSourceConnectionId == 0 || mSourceConnectionId != connectionId || interval > mRefreshInterval) { if (isNewConnection || (now - foundConnection->second.lastSent > mRefreshInterval)) { // Initialize the bufferpool connection. mSourceConnectionId = connectionId; if (mSourceConnectionId == 0) { return ResultStatus::CRITICAL_ERROR; } int64_t receiverConnectionId; rs = mSenderManager->registerSender(mReceiverManager, ResultStatus rs = mSenderManager->registerSender(mReceiverManager, connectionId, &receiverConnectionId); if ((rs != ResultStatus::OK) && (rs != ResultStatus::ALREADY_EXISTS)) { Loading @@ -1022,30 +1021,43 @@ ResultStatus DefaultBufferPoolSender::send( << static_cast<int32_t>(rs) << "."; return rs; } else if (receiverConnectionId == 0) { LOG(WARNING) << "registerSender -- " "invalid receiver connection id (0)."; return ResultStatus::CRITICAL_ERROR; } else { mReceiverConnectionId = receiverConnectionId; if (isNewConnection) { foundConnection = mConnections.try_emplace( connectionId, receiverConnectionId, now).first; } else { foundConnection->second.receiverConnectionId = receiverConnectionId; } } } else { receiverConnectionId = foundConnection->second.receiverConnectionId; } uint64_t transactionId; int64_t timestampUs; rs = mSenderManager->postSend( mReceiverConnectionId, bpData, &transactionId, ×tampUs); ResultStatus rs = mSenderManager->postSend( receiverConnectionId, bpData, &transactionId, ×tampUs); if (rs != ResultStatus::OK) { LOG(ERROR) << "ClientManager::postSend -- returned error: " << static_cast<int32_t>(rs) << "."; mConnections.erase(foundConnection); return rs; } if (!bpMessage) { LOG(ERROR) << "Null output parameter for BufferStatusMessage."; mConnections.erase(foundConnection); return ResultStatus::CRITICAL_ERROR; } bpMessage->connectionId = mReceiverConnectionId; bpMessage->connectionId = receiverConnectionId; bpMessage->bufferId = bpData->mId; bpMessage->transactionId = transactionId; bpMessage->timestampUs = timestampUs; mLastSent = now; foundConnection->second.lastSent = now; return rs; } Loading
media/extractors/mp4/MPEG4Extractor.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -6679,6 +6679,12 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { // The smallest valid chunk is 16 bytes long in this case. return false; } if (chunkSize > INT64_MAX) { // reject overly large chunk sizes that could // be interpreted as negative ALOGE("chunk size too large"); return false; } } else if (chunkSize < 8) { // The smallest valid chunk is 8 bytes long. Loading Loading @@ -6734,7 +6740,10 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { case FOURCC("moov"): { moovAtomEndOffset = offset + chunkSize; if (__builtin_add_overflow(offset, chunkSize, &moovAtomEndOffset)) { ALOGE("chunk size + offset would overflow"); return false; } done = true; break; Loading @@ -6744,7 +6753,10 @@ static bool BetterSniffMPEG4(DataSourceHelper *source, float *confidence) { break; } offset += chunkSize; if (__builtin_add_overflow(offset, chunkSize, &offset)) { ALOGE("chunk size + offset would overflow"); return false; } } if (!foundGoodFileType) { Loading
media/libaaudio/examples/input_monitor/Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ cc_test { cflags: ["-Wall", "-Werror"], shared_libs: ["libaaudio"], header_libs: ["libaaudio_example_utils"], pack_relocations: false, } cc_test { Loading @@ -15,5 +14,4 @@ cc_test { cflags: ["-Wall", "-Werror"], shared_libs: ["libaaudio"], header_libs: ["libaaudio_example_utils"], pack_relocations: false, }
media/libaaudio/examples/loopback/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,4 @@ cc_test { "libaudioutils", ], header_libs: ["libaaudio_example_utils"], pack_relocations: false, }