assert(__mIsInit);
assert(state >= CAudioInfo::EAudioIOState::AUDIO_IO_STATE_NONE && state < CAudioInfo::EAudioIOState::AUDIO_IO_STATE_MAX);
- mStatePrev = mState;
- mState = state;
mByPolicy = byPolicy;
if (mState == mStatePrev)
mStateChangedCallback.onStateChanged(mState, mStatePrev, mByPolicy, mStateChangedCallback.mUserData);
}
+void CAudioIO::setState(CAudioInfo::EAudioIOState state) {
+ mStatePrev = mState;
+ mState = state;
+}
+
void CAudioIO::onStateChanged(CAudioInfo::EAudioIOState state) {
onStateChanged(state, false);
}
if (!__mIsInit || !IsReady())
THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
- std::lock_guard<std::mutex> guard(mMutex);
AUDIO_IO_LOGD("pause");
mpPulseAudioClient->cork(true);
}
if (!__mIsInit || !IsReady())
THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
- std::lock_guard<std::mutex> guard(mMutex);
mpPulseAudioClient->cork(false);
}
if (!__mIsInit || !IsReady())
THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Did not initialize or prepare CAudioIO"); //LCOV_EXCL_LINE
- std::unique_lock<std::mutex> defer_mutex(mMutex, std::defer_lock);
- if (!mpPulseAudioClient->isInThread())
- defer_mutex.lock();
mpPulseAudioClient->flush();
}
if ((errorCode = sound_manager_get_index_from_stream_information(stream_info, &index)) != SOUND_MANAGER_ERROR_NONE)
THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Parameter stream_info->index is invalid [ret:%d]", errorCode); //LCOV_EXCL_LINE
getAudioInfo().setAudioIndex(index);
+
+ if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN) {
+ int device_id;
+
+ if ((errorCode = sound_manager_get_echo_cancel_reference_device(stream_info, &device_id) != SOUND_MANAGER_ERROR_NONE))
+ THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_ARGUMENT, "Can't get reference device [ret:%d]", errorCode); //LCOV_EXCL_LINE
+
+ if (device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE)
+ getAudioInfo().bindEchoCancelReferenceDeviceId(device_id);
+ }
}