From f490e2f8e8149407b978d3bb803fb0312d9ad2be Mon Sep 17 00:00:00 2001 From: fengyulong Date: Thu, 11 Sep 2025 22:17:14 +0800 Subject: [PATCH] resolve OnCapture State(false) not call Signed-off-by: fengyulong --- .../source/bluetooth_audio_capture_source.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frameworks/native/hdiadapter_new/source/bluetooth_audio_capture_source.cpp b/frameworks/native/hdiadapter_new/source/bluetooth_audio_capture_source.cpp index af0ad8013a..f362340eaa 100644 --- a/frameworks/native/hdiadapter_new/source/bluetooth_audio_capture_source.cpp +++ b/frameworks/native/hdiadapter_new/source/bluetooth_audio_capture_source.cpp @@ -568,7 +568,11 @@ int32_t BluetoothAudioCaptureSource::DoStop(void) #endif CHECK_AND_RETURN_RET_LOG(audioCapture_ != nullptr, ERR_INVALID_HANDLE, "capture is nullptr"); CHECK_AND_RETURN_RET(IsValidState(), ERR_INVALID_HANDLE); - CHECK_AND_RETURN_RET_LOG(started_, ERR_OPERATION_FAILED, "not start, invalid state"); + if (!started_) { + AUDIO_ERR_LOG("not start, invalid state"); + callback_.OnCaptureState(false); + return ERR_OPERATION_FAILED; + } int32_t ret = audioCapture_->control.Stop(reinterpret_cast(audioCapture_)); CHECK_AND_RETURN_RET_LOG(ret >= 0, ERR_OPERATION_FAILED, "stop fail"); started_ = false; -- Gitee