diff --git a/bluetooth/audio/hal/hdi_passthrough/src/audio_bluetooth_manager.cpp b/bluetooth/audio/hal/hdi_passthrough/src/audio_bluetooth_manager.cpp index 1ce719beba..e3d80dba69 100644 --- a/bluetooth/audio/hal/hdi_passthrough/src/audio_bluetooth_manager.cpp +++ b/bluetooth/audio/hal/hdi_passthrough/src/audio_bluetooth_manager.cpp @@ -29,7 +29,7 @@ using namespace bluetooth; sptr g_proxy_ = nullptr; static sptr g_btA2dpSrcObserverCallbacks = nullptr; -int g_playState = false; +int g_playState = A2DP_NOT_PLAYING; RawAddress g_device; static void AudioOnConnectionStateChanged(const RawAddress &device, int state) @@ -148,6 +148,10 @@ int WriteFrame(const uint8_t *data, uint32_t size) HDF_LOGE("audio_bluetooth_manager %{public}s: g_proxy_ is null", __func__); return RET_BAD_STATUS; } + if (g_playState == A2DP_NOT_PLAYING) { + HDF_LOGE("audio_bluetooth_manager %{public}s: playState is not Streaming", __func__); + return RET_BAD_STATUS; + } return g_proxy_->WriteFrame(data, size); }