commit | 3e7f0777e4d7dfc6cd4fbf5eaba0e27e0a4cf8ac | [log] [tgz] |
---|---|---|
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | Wed Feb 05 15:04:08 2025 -0800 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Feb 05 15:04:08 2025 -0800 |
tree | 14f7b429d7241f907ba9313ab1950da004a9203b | |
parent | 042dd0f794660f3823ffa071507456c06634b0ee [diff] | |
parent | 0cdd9a51e4785ab6e22ea2f5d4112755d867cc84 [diff] |
Merge "audio: Fix MonoPipe ownership in StreamRemoteSubmix" into main am: 0cdd9a51e4 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3479190 Change-Id: I0f7d73713265950d1d7bcdc64f6111607fda83eb Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp index cef0ea6..f8ead16 100644 --- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
@@ -283,6 +283,15 @@ } return ::android::OK; } + // get and hold the sink because 'MonoPipeReader' does not hold a strong pointer to it. + sp<MonoPipe> sink = mCurrentRoute->getSink(); + if (sink == nullptr) { + if (++mReadErrorCount < kMaxErrorLogs) { + LOG(ERROR) << __func__ + << ": the sink has been released! (not all errors will be logged)"; + } + return ::android::OK; + } mReadErrorCount = 0; LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount