Loading hal/audio_extn/keep_alive.c 100755 → 100644 +6 −3 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ void audio_extn_keep_alive_init(struct audio_device *adev) ka.userdata = adev; ka.state = STATE_IDLE; ka.pcm = NULL; pthread_condattr_t attr; if (property_get_bool("vendor.audio.keep_alive.disabled", false)) { ALOGE("keep alive disabled"); ka.state = STATE_DISABLED; Loading @@ -127,9 +128,12 @@ void audio_extn_keep_alive_init(struct audio_device *adev) ka.done = false; ka.prev_mode = KEEP_ALIVE_OUT_NONE; ka.active_devices = AUDIO_DEVICE_NONE; pthread_mutex_init(&ka.lock, (const pthread_mutexattr_t *) NULL); pthread_cond_init(&ka.cond, (const pthread_condattr_t *) NULL); pthread_cond_init(&ka.wake_up_cond, (const pthread_condattr_t *) NULL); pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&ka.wake_up_cond, &attr); pthread_mutex_init(&ka.sleep_lock, (const pthread_mutexattr_t *) NULL); list_init(&ka.cmd_list); if (pthread_create(&ka.thread, (const pthread_attr_t *) NULL, Loading Loading @@ -434,9 +438,8 @@ static void * keep_alive_loop(void * context __unused) * Hence a short burst of silence periodically. */ pthread_mutex_lock(&ka.sleep_lock); clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += SILENCE_INTERVAL; ts.tv_nsec = 0; if (!ka.done) pthread_cond_timedwait(&ka.wake_up_cond, Loading hal/audio_extn/spkr_protection.c +10 −8 Original line number Diff line number Diff line Loading @@ -846,9 +846,8 @@ static int spkr_calibrate(int t0_spk_1, int t0_spk_2) goto exit; } cleanup = true; clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_AFTER_CALIB_START/1000); ts.tv_nsec = 0; pthread_mutex_lock(&handle.mutex_spkr_prot); pthread_mutex_unlock(&adev->lock); acquire_device = true; Loading Loading @@ -963,9 +962,8 @@ static void spkr_calibrate_wait() { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += WAKEUP_MIN_IDLE_CHECK; ts.tv_nsec = 0; pthread_mutex_lock(&handle.cal_wait_cond_mutex); pthread_cond_timedwait(&handle.cal_wait_condition, &handle.cal_wait_cond_mutex, &ts); Loading Loading @@ -1570,6 +1568,7 @@ void audio_extn_spkr_prot_init(void *adev) { char value[PROPERTY_VALUE_MAX]; int result = 0; pthread_condattr_t attr; ALOGD("%s: Initialize speaker protection module", __func__); memset(&handle, 0, sizeof(handle)); if (!adev) { Loading @@ -1593,15 +1592,18 @@ void audio_extn_spkr_prot_init(void *adev) handle.trigger_cal = false; /* HAL for speaker protection is always calibrating for stereo usecase*/ vi_feed_no_channels = spkr_vi_channels(adev); pthread_cond_init(&handle.cal_wait_condition, NULL); pthread_mutex_init(&handle.cal_wait_cond_mutex, NULL); pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&handle.cal_wait_condition, &attr); pthread_mutex_init(&handle.cal_wait_cond_mutex, NULL); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if (is_wsa_present()) { if (platform_spkr_prot_is_wsa_analog_mode(adev) == 1) { ALOGD("%s: WSA analog mode", __func__); pcm_config_skr_prot.channels = WSA_ANALOG_MODE_CHANNELS; } pthread_cond_init(&handle.spkr_calib_cancel, NULL); pthread_cond_init(&handle.spkr_calib_cancel, &attr); pthread_cond_init(&handle.spkr_calibcancel_ack, NULL); pthread_mutex_init(&handle.mutex_spkr_prot, NULL); pthread_mutex_init(&handle.spkr_calib_cancelack_mutex, NULL); Loading @@ -1619,7 +1621,7 @@ void audio_extn_spkr_prot_init(void *adev) ALOGD("%s: WSA spkr calibration thread is not created", __func__); } pthread_cond_init(&handle.spkr_prot_thermalsync, NULL); pthread_cond_init(&handle.spkr_calib_cancel, NULL); pthread_cond_init(&handle.spkr_calib_cancel, &attr); pthread_cond_init(&handle.spkr_calibcancel_ack, NULL); pthread_mutex_init(&handle.mutex_spkr_prot, NULL); pthread_mutex_init(&handle.spkr_calib_cancelack_mutex, NULL); Loading mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -158,9 +158,14 @@ void omx_aac_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -305,6 +310,7 @@ omx_aac_aenc::omx_aac_aenc(): m_tmp_meta_buf(NULL), { int cond_ret = 0; component_Role.nSize = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_aac_pb_stats, 0, sizeof(m_aac_pb_stats)); Loading Loading @@ -350,7 +356,10 @@ omx_aac_aenc::omx_aac_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010, 2014, 2016-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010, 2014, 2016-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -149,9 +149,14 @@ void omx_amr_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -295,6 +300,7 @@ omx_amr_aenc::omx_amr_aenc(): m_tmp_meta_buf(NULL), { int cond_ret = 0; component_Role.nSize = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_pcm_param, 0, sizeof(m_pcm_param)); Loading Loading @@ -340,7 +346,10 @@ omx_amr_aenc::omx_amr_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010, 2014-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010, 2014-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -149,9 +149,14 @@ void omx_evrc_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -292,6 +297,7 @@ omx_evrc_aenc::omx_evrc_aenc(): m_tmp_meta_buf(NULL), m_ipc_to_cmd_th(NULL) { int cond_ret = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_evrc_param, 0, sizeof(m_evrc_param)); Loading Loading @@ -337,7 +343,10 @@ omx_evrc_aenc::omx_evrc_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading Loading
hal/audio_extn/keep_alive.c 100755 → 100644 +6 −3 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ void audio_extn_keep_alive_init(struct audio_device *adev) ka.userdata = adev; ka.state = STATE_IDLE; ka.pcm = NULL; pthread_condattr_t attr; if (property_get_bool("vendor.audio.keep_alive.disabled", false)) { ALOGE("keep alive disabled"); ka.state = STATE_DISABLED; Loading @@ -127,9 +128,12 @@ void audio_extn_keep_alive_init(struct audio_device *adev) ka.done = false; ka.prev_mode = KEEP_ALIVE_OUT_NONE; ka.active_devices = AUDIO_DEVICE_NONE; pthread_mutex_init(&ka.lock, (const pthread_mutexattr_t *) NULL); pthread_cond_init(&ka.cond, (const pthread_condattr_t *) NULL); pthread_cond_init(&ka.wake_up_cond, (const pthread_condattr_t *) NULL); pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&ka.wake_up_cond, &attr); pthread_mutex_init(&ka.sleep_lock, (const pthread_mutexattr_t *) NULL); list_init(&ka.cmd_list); if (pthread_create(&ka.thread, (const pthread_attr_t *) NULL, Loading Loading @@ -434,9 +438,8 @@ static void * keep_alive_loop(void * context __unused) * Hence a short burst of silence periodically. */ pthread_mutex_lock(&ka.sleep_lock); clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += SILENCE_INTERVAL; ts.tv_nsec = 0; if (!ka.done) pthread_cond_timedwait(&ka.wake_up_cond, Loading
hal/audio_extn/spkr_protection.c +10 −8 Original line number Diff line number Diff line Loading @@ -846,9 +846,8 @@ static int spkr_calibrate(int t0_spk_1, int t0_spk_2) goto exit; } cleanup = true; clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_AFTER_CALIB_START/1000); ts.tv_nsec = 0; pthread_mutex_lock(&handle.mutex_spkr_prot); pthread_mutex_unlock(&adev->lock); acquire_device = true; Loading Loading @@ -963,9 +962,8 @@ static void spkr_calibrate_wait() { struct timespec ts; clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += WAKEUP_MIN_IDLE_CHECK; ts.tv_nsec = 0; pthread_mutex_lock(&handle.cal_wait_cond_mutex); pthread_cond_timedwait(&handle.cal_wait_condition, &handle.cal_wait_cond_mutex, &ts); Loading Loading @@ -1570,6 +1568,7 @@ void audio_extn_spkr_prot_init(void *adev) { char value[PROPERTY_VALUE_MAX]; int result = 0; pthread_condattr_t attr; ALOGD("%s: Initialize speaker protection module", __func__); memset(&handle, 0, sizeof(handle)); if (!adev) { Loading @@ -1593,15 +1592,18 @@ void audio_extn_spkr_prot_init(void *adev) handle.trigger_cal = false; /* HAL for speaker protection is always calibrating for stereo usecase*/ vi_feed_no_channels = spkr_vi_channels(adev); pthread_cond_init(&handle.cal_wait_condition, NULL); pthread_mutex_init(&handle.cal_wait_cond_mutex, NULL); pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&handle.cal_wait_condition, &attr); pthread_mutex_init(&handle.cal_wait_cond_mutex, NULL); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if (is_wsa_present()) { if (platform_spkr_prot_is_wsa_analog_mode(adev) == 1) { ALOGD("%s: WSA analog mode", __func__); pcm_config_skr_prot.channels = WSA_ANALOG_MODE_CHANNELS; } pthread_cond_init(&handle.spkr_calib_cancel, NULL); pthread_cond_init(&handle.spkr_calib_cancel, &attr); pthread_cond_init(&handle.spkr_calibcancel_ack, NULL); pthread_mutex_init(&handle.mutex_spkr_prot, NULL); pthread_mutex_init(&handle.spkr_calib_cancelack_mutex, NULL); Loading @@ -1619,7 +1621,7 @@ void audio_extn_spkr_prot_init(void *adev) ALOGD("%s: WSA spkr calibration thread is not created", __func__); } pthread_cond_init(&handle.spkr_prot_thermalsync, NULL); pthread_cond_init(&handle.spkr_calib_cancel, NULL); pthread_cond_init(&handle.spkr_calib_cancel, &attr); pthread_cond_init(&handle.spkr_calibcancel_ack, NULL); pthread_mutex_init(&handle.mutex_spkr_prot, NULL); pthread_mutex_init(&handle.spkr_calib_cancelack_mutex, NULL); Loading
mm-audio/aenc-aac/qdsp6/src/omx_aac_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -158,9 +158,14 @@ void omx_aac_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -305,6 +310,7 @@ omx_aac_aenc::omx_aac_aenc(): m_tmp_meta_buf(NULL), { int cond_ret = 0; component_Role.nSize = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_aac_pb_stats, 0, sizeof(m_aac_pb_stats)); Loading Loading @@ -350,7 +356,10 @@ omx_aac_aenc::omx_aac_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading
mm-audio/aenc-amrnb/qdsp6/src/omx_amr_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010, 2014, 2016-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010, 2014, 2016-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -149,9 +149,14 @@ void omx_amr_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -295,6 +300,7 @@ omx_amr_aenc::omx_amr_aenc(): m_tmp_meta_buf(NULL), { int cond_ret = 0; component_Role.nSize = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_pcm_param, 0, sizeof(m_pcm_param)); Loading Loading @@ -340,7 +346,10 @@ omx_amr_aenc::omx_amr_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading
mm-audio/aenc-evrc/qdsp6/src/omx_evrc_aenc.cpp +12 −3 Original line number Diff line number Diff line /*-------------------------------------------------------------------------- Copyright (c) 2010, 2014-2017, The Linux Foundation. All rights reserved. Copyright (c) 2010, 2014-2018, The Linux Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Loading Loading @@ -149,9 +149,14 @@ void omx_evrc_aenc::wait_for_event() pthread_mutex_lock(&m_event_lock); while (0 == m_is_event_done) { clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_MONOTONIC, &ts); ts.tv_sec += (SLEEP_MS/1000); ts.tv_nsec += ((SLEEP_MS%1000) * 1000000); if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } rc = pthread_cond_timedwait(&cond, &m_event_lock, &ts); if (rc == ETIMEDOUT && !m_is_event_done) { DEBUG_PRINT("Timed out waiting for flush"); Loading Loading @@ -292,6 +297,7 @@ omx_evrc_aenc::omx_evrc_aenc(): m_tmp_meta_buf(NULL), m_ipc_to_cmd_th(NULL) { int cond_ret = 0; pthread_condattr_t attr; memset(&m_cmp, 0, sizeof(m_cmp)); memset(&m_cb, 0, sizeof(m_cb)); memset(&m_evrc_param, 0, sizeof(m_evrc_param)); Loading Loading @@ -337,7 +343,10 @@ omx_evrc_aenc::omx_evrc_aenc(): m_tmp_meta_buf(NULL), pthread_mutexattr_init(&in_buf_count_lock_attr); pthread_mutex_init(&in_buf_count_lock, &in_buf_count_lock_attr); if ((cond_ret = pthread_cond_init (&cond, NULL)) != 0) pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if ((cond_ret = pthread_cond_init (&cond, &attr)) != 0) { DEBUG_PRINT_ERROR("pthread_cond_init returns non zero for cond\n"); if (cond_ret == EAGAIN) Loading