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 af0ad8013a562d5f08d7e5d5c79be08a0da0f58d..f362340eaa3ff5095d78bf917ff28f17c1428f1e 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;