diff --git a/services/audiohdiproxy/src/daudio_manager_callback.cpp b/services/audiohdiproxy/src/daudio_manager_callback.cpp index 17860e1178968b54ba39c6829d46526dc2fff7ed..a8203b1bb519e2f92df232ab4997b33153a97711 100644 --- a/services/audiohdiproxy/src/daudio_manager_callback.cpp +++ b/services/audiohdiproxy/src/daudio_manager_callback.cpp @@ -150,6 +150,18 @@ int32_t DAudioManagerCallback::NotifyEvent(const std::string& adpName, int32_t d case AudioEventHDF::AUDIO_EVENT_CHANGE_PLAY_STATUS: newEvent.type = AudioEventType::CHANGE_PLAY_STATUS; break; + case AudioEventHDF::AUDIO_EVENT_MMAP_START_SPK: + newEvent.type = AudioEventType::MMAP_SPK_START; + break; + case AudioEventHDF::AUDIO_EVENT_MMAP_STOP_SPK: + newEvent.type = AudioEventType::MMAP_SPK_STOP; + break; + case AudioEventHDF::AUDIO_EVENT_MMAP_START_MIC: + newEvent.type = AudioEventType::MMAP_MIC_START; + break; + case AudioEventHDF::AUDIO_EVENT_MMAP_STOP_MIC: + newEvent.type = AudioEventType::MMAP_MIC_STOP; + break; case AudioEventHDF::AUDIO_EVENT_START: newEvent.type = AudioEventType::AUDIO_START; break; @@ -223,21 +235,37 @@ int32_t DAudioManagerCallback::ReadStreamData(const std::string &adpName, int32_ int32_t DAudioManagerCallback::ReadMmapPosition(const std::string &adpName, int32_t devId, uint64_t &frames, OHOS::HDI::DistributedAudio::Audioext::V1_0::CurrentTime &time) { - (void) adpName; - (void) devId; - (void) frames; - (void) time; + DHLOGI("Read mmap position"); + if (callback_ == nullptr) { + DHLOGE("Regisiter hdi callback id nullptr."); + return HDF_FAILURE; + } + CurrentTimeHDF timeHdf; + int32_t ret = callback_->ReadMmapPosition(adpName, devId, frames, timeHdf); + if (ret != DH_SUCCESS) { + DHLOGE("Read mmap position failed."); + return HDF_FAILURE; + } + time.tvSec = timeHdf.tvSec; + time.tvNSec = timeHdf.tvNSec; + DHLOGI("Read mmap position success."); return HDF_SUCCESS; } int32_t DAudioManagerCallback::RefreshAshmemInfo(const std::string &adpName, int32_t devId, int fd, int32_t ashmemLength, int32_t lengthPerTrans) { - (void) adpName; - (void) devId; - (void) fd; - (void) ashmemLength; - (void) lengthPerTrans; + DHLOGI("Refresh ashmem info."); + if (callback_ == nullptr) { + DHLOGE("Regisiter hdi callback id nullptr."); + return HDF_FAILURE; + } + int32_t ret = callback_->RefreshAshmemInfo(adpName, devId, fd, ashmemLength, lengthPerTrans); + if (ret != DH_SUCCESS) { + DHLOGE("Refresh ashmem info failed."); + return HDF_FAILURE; + } + DHLOGI("Refresh ashmem info success."); return HDF_SUCCESS; } } // DistributedHardware diff --git a/services/common/audioparam/audio_event.h b/services/common/audioparam/audio_event.h index 9850537a8155b0ed32238a6ef3d47eb4125e1c37..3a6178e8ef633620a982058766d0dd099c8501cd 100644 --- a/services/common/audioparam/audio_event.h +++ b/services/common/audioparam/audio_event.h @@ -86,6 +86,10 @@ typedef enum { AUDIO_EVENT_RENDER_STATE_CHANGE = 11, AUDIO_EVENT_MUTE_SET = 12, AUDIO_EVENT_CHANGE_PLAY_STATUS = 13, + AUDIO_EVENT_MMAP_START_SPK = 14, + AUDIO_EVENT_MMAP_STOP_SPK = 15, + AUDIO_EVENT_MMAP_START_MIC = 16, + AUDIO_EVENT_MMAP_STOP_MIC = 17, AUDIO_EVENT_START = 18, AUDIO_EVENT_STOP = 19, } AudioEventHDF;