CAudioIO: Update as per sound-manager echo-cancellation API change
[platform/core/api/audio-io.git] / src / cpp / CAudioIO.cpp
index 093e7c2..0d7bc43 100644 (file)
@@ -225,18 +225,12 @@ void CAudioIO::setStreamInfo(sound_stream_info_h stream_info) {
     getAudioInfo().setAudioIndex(index);
 
     if (mDirection == CAudioInfo::EAudioDirection::AUDIO_DIRECTION_IN) {
-        sound_device_h device = NULL;
+        int device_id;
 
-        if ((errorCode = sound_manager_get_echo_cancel_reference_device(stream_info, &device) != SOUND_MANAGER_ERROR_NONE))
+        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) {
-            int id;
-
-            if ((errorCode = sound_manager_get_device_id(device, &id) != SOUND_MANAGER_ERROR_NONE))
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_INVALID_OPERATION, "Can't get device id [ret:%d]", errorCode); //LCOV_EXCL_LINE
-
-            getAudioInfo().bindEchoCancelReferenceDeviceId(id);
-        }
+        if (device_id != SOUND_MANAGER_STREAM_NO_REFERENCE_DEVICE)
+            getAudioInfo().bindEchoCancelReferenceDeviceId(device_id);
     }
 }