SM_ENTER_CRITICAL_SECTION(&ducking_mutex);
for (i = 0 ; i < SOUND_DUCKING_ARR_MAX ; i++) {
- if (ducking_arr[i] && ducking_arr[i]->pa_info.index == pa_index)
+ if (ducking_arr[i] && ducking_arr[i]->pa_info.index == pa_index) {
+ LOGI("ducking state changed [i:%d,ducked:%u]", pa_index, is_ducked);
+ if (ducking_arr[i]->user_cb)
+ ducking_arr[i]->user_cb((sound_stream_ducking_h)ducking_arr[i], is_ducked, ducking_arr[i]->user_data);
+ else
+ LOGW("no user callback for pa_index %d", pa_index);
break;
- }
-
- if (i < SOUND_DUCKING_ARR_MAX) {
- LOGI("ducking state changed [i:%d,ducked:%u]", pa_index, is_ducked);
-
- if (ducking_arr[i]->user_cb)
- ducking_arr[i]->user_cb((sound_stream_ducking_h)ducking_arr[i], is_ducked, ducking_arr[i]->user_data);
- else
- LOGW("no user callback for pa_index %d", pa_index);
- } else {
- LOGE("could not found for pa_index %d", pa_index);
+ }
}
SM_LEAVE_CRITICAL_SECTION(&ducking_mutex);