diff --git a/services/audiomanager/managersource/include/dmic_dev.h b/services/audiomanager/managersource/include/dmic_dev.h index cfb8a76d793840881e20763243289887f3285b16..d2278ed1e2971b31b05ed1a419e9b88aee7ae489 100644 --- a/services/audiomanager/managersource/include/dmic_dev.h +++ b/services/audiomanager/managersource/include/dmic_dev.h @@ -105,6 +105,7 @@ private: std::mutex channelWaitMutex_; std::condition_variable channelWaitCond_; int32_t curPort_ = 0; + int32_t streamId_ = 100; std::atomic isTransReady_ = false; std::atomic isOpened_ = false; std::shared_ptr micTrans_ = nullptr; diff --git a/services/audiomanager/managersource/include/dspeaker_dev.h b/services/audiomanager/managersource/include/dspeaker_dev.h index 057c095aaec11f09787431cf6bb17e74af8bca05..f812a0c346847ef76dbe70afcc8a82a53d53560a 100644 --- a/services/audiomanager/managersource/include/dspeaker_dev.h +++ b/services/audiomanager/managersource/include/dspeaker_dev.h @@ -93,6 +93,7 @@ private: std::atomic isTransReady_ = false; std::atomic isOpened_ = false; int32_t curPort_ = 0; + int32_t streamId_ = 0; std::shared_ptr speakerTrans_ = nullptr; // Speaker render parameters diff --git a/services/audiomanager/managersource/src/dmic_dev.cpp b/services/audiomanager/managersource/src/dmic_dev.cpp index d18d84fdc09265adf30d156d252a284f2d84bbb2..236c8443632cff8d80f87a15e1e6ca2babd72a4d 100644 --- a/services/audiomanager/managersource/src/dmic_dev.cpp +++ b/services/audiomanager/managersource/src/dmic_dev.cpp @@ -142,6 +142,7 @@ int32_t DMicDev::CreateStream(const int32_t streamId) cbObj->NotifyEvent(event); DAudioHisysevent::GetInstance().SysEventWriteBehavior(DAUDIO_OPEN, devId_, std::to_string(dhId_), "daudio mic device open success."); + streamId_ = streamId; cJSON_Delete(jParam); cJSON_free(jsonData); return DH_SUCCESS; @@ -500,9 +501,10 @@ AudioParam DMicDev::GetAudioParam() const int32_t DMicDev::NotifyHdfAudioEvent(const AudioEvent &event, const int32_t portId) { - int32_t ret = DAudioHdiHandler::GetInstance().NotifyEvent(devId_, portId, 0, event); + int32_t ret = DAudioHdiHandler::GetInstance().NotifyEvent(devId_, portId, streamId_, event); if (ret != DH_SUCCESS) { - DHLOGE("Notify event: %{public}d, result: %{public}s.", event.type, event.content.c_str()); + DHLOGE("Notify event: %{public}d, result: %{public}s, streamId: %{public}d.", + event.type, event.content.c_str(), streamId_); } return DH_SUCCESS; } diff --git a/services/audiomanager/managersource/src/dspeaker_dev.cpp b/services/audiomanager/managersource/src/dspeaker_dev.cpp index a37c9df4000d82c7925874319c9a4efcccf274bb..3f67c41fa9115e3f7d8992d63a82dafb2f968110 100644 --- a/services/audiomanager/managersource/src/dspeaker_dev.cpp +++ b/services/audiomanager/managersource/src/dspeaker_dev.cpp @@ -126,6 +126,7 @@ int32_t DSpeakerDev::CreateStream(const int32_t streamId) cbObj->NotifyEvent(event); DAudioHisysevent::GetInstance().SysEventWriteBehavior(DAUDIO_OPEN, devId_, std::to_string(dhId_), "daudio spk device open success."); + streamId_ = streamId; cJSON_Delete(jParam); cJSON_free(jsonData); return DH_SUCCESS; @@ -429,9 +430,10 @@ int32_t DSpeakerDev::SendMessage(uint32_t type, std::string content, std::string int32_t DSpeakerDev::NotifyHdfAudioEvent(const AudioEvent &event, const int32_t portId) { - int32_t ret = DAudioHdiHandler::GetInstance().NotifyEvent(devId_, portId, 0, event); + int32_t ret = DAudioHdiHandler::GetInstance().NotifyEvent(devId_, portId, streamId_, event); if (ret != DH_SUCCESS) { - DHLOGE("Notify event: %{public}d, result: %{public}s.", event.type, event.content.c_str()); + DHLOGE("Notify event: %{public}d, result: %{public}s, streamId: %{public}d.", + event.type, event.content.c_str(), streamId_); } return DH_SUCCESS; }