diff options
author | Gilbok Lee <gilbok.lee@samsung.com> | 2017-02-23 20:34:26 +0900 |
---|---|---|
committer | Gilbok Lee <gilbok.lee@samsung.com> | 2017-02-23 20:34:33 +0900 |
commit | e3f3fa005f30c4fe7700c7d59c5ce2057f8d10b7 (patch) | |
tree | 2a502c1df5dd38b93abffec66c269a5894dba023 | |
parent | ff9cfd540f5ae4add469091c87c8faf0081cf37f (diff) | |
parent | 6dc9533f4ce0743cd0834937513a8fd308e70f16 (diff) | |
download | libmm-radio-e3f3fa005f30c4fe7700c7d59c5ce2057f8d10b7.tar.gz libmm-radio-e3f3fa005f30c4fe7700c7d59c5ce2057f8d10b7.tar.bz2 libmm-radio-e3f3fa005f30c4fe7700c7d59c5ce2057f8d10b7.zip |
Merge branch 'tizen_3.0' into tizen
Change-Id: I74a928f48ee29a62d1eee19ea1912355814a154d
-rwxr-xr-x | packaging/libmm-radio.spec | 2 | ||||
-rw-r--r-- | src/include/mm_radio_utils.h | 17 | ||||
-rw-r--r-- | src/mm_radio.c | 11 | ||||
-rw-r--r-- | src/mm_radio_priv_emulator.c | 21 | ||||
-rw-r--r-- | src/mm_radio_priv_hal.c | 89 | ||||
-rw-r--r-- | src/mm_radio_sound_focus.c | 20 |
6 files changed, 89 insertions, 71 deletions
diff --git a/packaging/libmm-radio.spec b/packaging/libmm-radio.spec index 6e5c404..4c31c5e 100755 --- a/packaging/libmm-radio.spec +++ b/packaging/libmm-radio.spec @@ -1,6 +1,6 @@ Name: libmm-radio Summary: Multimedia Framework Radio Library -Version: 0.2.20 +Version: 0.2.22 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/src/include/mm_radio_utils.h b/src/include/mm_radio_utils.h index d368a60..32bc957 100644 --- a/src/include/mm_radio_utils.h +++ b/src/include/mm_radio_utils.h @@ -29,6 +29,7 @@ /* radio log */ #define MMRADIO_LOG_FENTER debug_fenter #define MMRADIO_LOG_FLEAVE debug_fleave +#define MMRADIO_LOG_INFO debug_msg #define MMRADIO_LOG_DEBUG debug_log #define MMRADIO_LOG_ERROR debug_error #define MMRADIO_LOG_WARNING debug_warning @@ -60,7 +61,7 @@ do { \ #define MMRADIO_CHECK_INSTANCE(x_radio) \ do { \ if (!x_radio) { \ - debug_error("radio instance is NULL\n"); \ + MMRADIO_LOG_ERROR("radio instance is NULL\n"); \ return MM_ERROR_RADIO_NOT_INITIALIZED; \ } \ } while (0) @@ -68,7 +69,7 @@ do { \ #define MMRADIO_CHECK_ARG(x_radio) \ do { \ if (!x_radio) { \ - debug_error("argument is NULL\n"); \ + MMRADIO_LOG_ERROR("argument is NULL\n"); \ return MM_ERROR_COMMON_INVALID_ARGUMENT; \ } \ } while (0) @@ -77,7 +78,7 @@ do { \ #define MMRADIO_CHECK_INSTANCE_RETURN_VOID(x_radio) \ do { \ if (!x_radio) { \ - debug_error("radio instance is NULL\n"); \ + MMRADIO_LOG_ERROR("radio instance is NULL\n"); \ return; \ } \ } while (0) @@ -85,7 +86,7 @@ do { \ #define MMRADIO_CHECK_DEVICE_STATE(x_radio) \ do { \ if (x_radio->radio_fd < 0) { \ - debug_error("not available radio device\n"); \ + MMRADIO_LOG_ERROR("not available radio device\n"); \ return MM_ERROR_RADIO_NOT_INITIALIZED; \ } \ } while (0) @@ -100,21 +101,21 @@ do { \ /* message posting */ #define MMRADIO_POST_MSG(x_radio, x_msgtype, x_msg_param) \ do { \ - debug_log("posting %s to application\n", #x_msgtype); \ + MMRADIO_LOG_DEBUG("posting %s to application\n", #x_msgtype); \ __mmradio_post_message(x_radio, x_msgtype, x_msg_param); \ } while (0) /* setting radio state */ #define MMRADIO_SET_STATE(x_radio, x_state) \ do { \ - debug_log("setting mm-radio state to %d\n", x_state); \ + MMRADIO_LOG_DEBUG("setting mm-radio state to %d\n", x_state); \ __mmradio_set_state(x_radio, x_state); \ } while (0) /* state */ #define MMRADIO_CHECK_STATE_RETURN_IF_FAIL(x_radio, x_command) \ do { \ - debug_log("checking radio state before doing %s\n", #x_command); \ + MMRADIO_LOG_DEBUG("checking radio state before doing %s\n", #x_command); \ switch (__mmradio_check_state(x_radio, x_command)) { \ case MM_ERROR_RADIO_INVALID_STATE: \ return MM_ERROR_RADIO_INVALID_STATE; \ @@ -131,7 +132,7 @@ do { \ #define MMRADIO_CHECK_RETURN_IF_FAIL(x_ret, x_msg) \ do { \ if (x_ret < 0) { \ - debug_error("%s error\n", x_msg); \ + MMRADIO_LOG_ERROR("%s error\n", x_msg); \ return x_ret; \ } \ } while (0); diff --git a/src/mm_radio.c b/src/mm_radio.c index 62cd24b..b1e17b0 100644 --- a/src/mm_radio.c +++ b/src/mm_radio.c @@ -34,7 +34,6 @@ #include "mm_radio_priv.h" #endif #include "mm_radio_utils.h" -#include "mm_debug.h" /*=========================================================================================== | | @@ -96,7 +95,7 @@ int mm_radio_create(MMHandleType *hradio) /* alloc radio structure */ new_radio = (mm_radio_t *)malloc(sizeof(mm_radio_t)); if (!new_radio) { - debug_critical("cannot allocate memory for radio\n"); + MMRADIO_LOG_CRITICAL("cannot allocate memory for radio\n"); goto ERROR; } memset(new_radio, 0, sizeof(mm_radio_t)); @@ -104,8 +103,10 @@ int mm_radio_create(MMHandleType *hradio) /* internal creation stuffs */ result = _mmradio_create_radio(new_radio); - if (result != MM_ERROR_NONE) + if (result != MM_ERROR_NONE) { + MMRADIO_LOG_ERROR("radio creation failed\n"); goto ERROR; + } *hradio = (MMHandleType)new_radio; @@ -138,7 +139,7 @@ int mm_radio_destroy(MMHandleType hradio) result = _mmradio_destroy(radio); if (result != MM_ERROR_NONE) - debug_error("failed to destroy radio\n"); + MMRADIO_LOG_ERROR("failed to destroy radio\n"); /* free radio */ MMRADIO_FREEIF(radio); @@ -426,7 +427,7 @@ int mm_radio_get_signal_strength(MMHandleType hradio, int *value) MMRADIO_CMD_UNLOCK(radio); - MMRADIO_LOG_DEBUG("signal strength = %d\n", *value); + MMRADIO_LOG_INFO("signal strength = %d\n", *value); MMRADIO_LOG_FLEAVE(); return ret; diff --git a/src/mm_radio_priv_emulator.c b/src/mm_radio_priv_emulator.c index 633d8a7..19d5c6b 100644 --- a/src/mm_radio_priv_emulator.c +++ b/src/mm_radio_priv_emulator.c @@ -33,7 +33,6 @@ #include <errno.h> #include <mm_error.h> -#include <mm_debug.h> #include <mm_message.h> #include <time.h> @@ -301,7 +300,7 @@ int _mmradio_realize(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_realize_pipeline(radio); if (ret) { - debug_error("_mmradio_realize_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_realize_pipeline is failed\n"); return ret; } #endif @@ -600,7 +599,7 @@ int _mmradio_start(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_start_pipeline(radio); if (ret) { - debug_error("_mmradio_start_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_start_pipeline is failed\n"); return ret; } #endif @@ -639,7 +638,7 @@ int _mmradio_stop(mm_radio_t * radio) #ifdef USE_GST_PIPELINE ret = _mmradio_stop_pipeline(radio); if (ret) { - debug_error("_mmradio_stop_pipeline is failed\n"); + MMRADIO_LOG_ERROR("_mmradio_stop_pipeline is failed\n"); return ret; } #endif @@ -1075,7 +1074,7 @@ static bool __mmradio_post_message(mm_radio_t * radio, enum MMMessageType msgtyp MMRADIO_LOG_FENTER(); if (!radio->msg_cb) { - debug_warning("failed to post a message\n"); + MMRADIO_LOG_WARNING("failed to post a message\n"); return false; } @@ -1207,13 +1206,13 @@ static int __mmradio_check_state(mm_radio_t * radio, MMRadioCommand command) return MM_ERROR_NONE; - INVALID_STATE: - debug_warning("invalid state. current : %d command : %d\n", radio_state, command); +INVALID_STATE: + MMRADIO_LOG_WARNING("invalid state. current : %d command : %d\n", radio_state, command); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_INVALID_STATE; - NO_OP: - debug_warning("mm-radio is in the desired state(%d). doing noting\n", radio_state); +NO_OP: + MMRADIO_LOG_WARNING("mm-radio is in the desired state(%d). doing noting\n", radio_state); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_NO_OP; @@ -1227,12 +1226,12 @@ static bool __mmradio_set_state(mm_radio_t * radio, int new_state) MMRADIO_LOG_FENTER(); if (!radio) { - debug_warning("calling set_state with invalid radio handle\n"); + MMRADIO_LOG_WARNING("calling set_state with invalid radio handle\n"); return false; } if (radio->current_state == new_state && radio->pending_state == 0) { - debug_warning("we are in same state\n"); + MMRADIO_LOG_WARNING("we are in same state\n"); return true; } diff --git a/src/mm_radio_priv_hal.c b/src/mm_radio_priv_hal.c index ae5bca3..0ccd884 100644 --- a/src/mm_radio_priv_hal.c +++ b/src/mm_radio_priv_hal.c @@ -34,7 +34,6 @@ #include <errno.h> #include <mm_error.h> -#include <mm_debug.h> #include <mm_message.h> #include <mm_sound.h> @@ -169,7 +168,7 @@ int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool upda } } - MMRADIO_LOG_DEBUG("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz", + MMRADIO_LOG_INFO("setting region - country: %d, de-emphasis: %d, band range: %d ~ %d KHz", radio->region_setting.country, radio->region_setting.deemphasis, radio->region_setting.band_min, radio->region_setting.band_max); @@ -249,7 +248,7 @@ int _mmradio_realize(mm_radio_t *radio) ret = pthread_mutex_init(&radio->seek_cancel_mutex, NULL); if (ret < 0) { - MMRADIO_LOG_DEBUG("Mutex creation failed %d", ret); + MMRADIO_LOG_ERROR("Mutex creation failed %d", ret); return MM_ERROR_RADIO_INTERNAL; } @@ -357,6 +356,18 @@ int _mmradio_destroy(mm_radio_t *radio) MMRADIO_LOG_ERROR("mmradio hal interface deinit failed"); return ret; } + + /* destroy command lock */ + ret = pthread_mutex_destroy(&radio->cmd_lock); + if (ret) { + MMRADIO_LOG_ERROR("mutex destroy failed\n"); + } + + ret = pthread_mutex_destroy(&radio->volume_lock); + if (ret) { + MMRADIO_LOG_ERROR("volume mutex destroy failed\n"); + } + #ifdef TIZEN_FEATURE_SOUND_FOCUS ret = mmradio_sound_focus_deregister(&radio->sound_focus); if (ret) { @@ -379,7 +390,7 @@ int _mmradio_set_frequency(mm_radio_t *radio, int freq) MMRADIO_CHECK_INSTANCE(radio); MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_FREQ); - MMRADIO_LOG_DEBUG("Setting %d frequency", freq); + MMRADIO_LOG_INFO("Setting %d frequency", freq); radio->freq = freq; @@ -415,6 +426,7 @@ int _mmradio_get_frequency(mm_radio_t *radio, int *pFreq) } /* update freq in handle */ + MMRADIO_LOG_INFO("Updating %d frequency", freq); radio->freq = freq; *pFreq = (int)radio->freq; @@ -442,6 +454,7 @@ int _mmradio_mute(mm_radio_t *radio) } radio->is_muted = TRUE; + MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted); MMRADIO_LOG_FLEAVE(); return ret; @@ -465,7 +478,7 @@ int _mmradio_unmute(mm_radio_t *radio) } radio->is_muted = FALSE; - + MMRADIO_LOG_INFO("Radio mute state [%d]", radio->is_muted); MMRADIO_LOG_FLEAVE(); return ret; @@ -515,7 +528,7 @@ int _mmradio_start(mm_radio_t *radio) MMRADIO_CHECK_INSTANCE(radio); MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_START); - MMRADIO_LOG_DEBUG("now tune to frequency : %d", radio->freq); + MMRADIO_LOG_INFO("now tune to frequency : %d", radio->freq); #ifdef TIZEN_FEATURE_SOUND_FOCUS if (radio->sound_focus.handle > 0) { @@ -691,7 +704,7 @@ int _mmradio_seek(mm_radio_t *radio, MMRadioSeekDirectionType direction) radio->seek_unmute = TRUE; } - MMRADIO_LOG_DEBUG("trying to seek. direction[0:UP/1:DOWN) %d", direction); + MMRADIO_LOG_INFO("trying to seek. direction[0:UP/1:DOWN) %d", direction); radio->seek_direction = direction; ret = pthread_create(&radio->seek_thread, NULL, (void *)__mmradio_seek_thread, (void *)radio); @@ -732,9 +745,9 @@ void _mmradio_seek_cancel(mm_radio_t *radio) ret = pthread_mutex_trylock(&radio->seek_cancel_mutex); MMRADIO_LOG_DEBUG("try lock ret: %s (%d)", strerror_r(ret, str_error, sizeof(str_error)), ret); if (ret == EBUSY) { /* it was already locked by other */ - MMRADIO_LOG_DEBUG("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT"); + MMRADIO_LOG_WARNING("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT"); } else if (ret == 0) { - MMRADIO_LOG_DEBUG("trylock is successful. unlock now"); + MMRADIO_LOG_INFO("trylock is successful. unlock now"); pthread_mutex_unlock(&radio->seek_cancel_mutex); } else { MMRADIO_LOG_ERROR("trylock is failed but Not EBUSY. ret: %d", ret); @@ -787,7 +800,7 @@ int _mmradio_start_scan(mm_radio_t *radio) scan_tr_id = pthread_create(&radio->scan_thread, NULL, (void *)__mmradio_scan_thread, (void *)radio); if (scan_tr_id != 0) { - MMRADIO_LOG_DEBUG("failed to create thread : scan"); + MMRADIO_LOG_ERROR("failed to create thread : scan"); return MM_ERROR_RADIO_NOT_INITIALIZED; } @@ -814,9 +827,9 @@ int _mmradio_stop_scan(mm_radio_t *radio) ret = pthread_mutex_trylock(&radio->seek_cancel_mutex); MMRADIO_LOG_DEBUG("try lock ret: %s (%d)", strerror_r(ret, str_error, sizeof(str_error)), ret); if (ret == EBUSY) { /* it was already locked by other */ - MMRADIO_LOG_DEBUG("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT"); + MMRADIO_LOG_WARNING("send SEEK ABORT with FMRX_PROPERTY_SEARCH_ABORT"); } else if (ret == 0) { - MMRADIO_LOG_DEBUG("trylock is successful. unlock now"); + MMRADIO_LOG_INFO("trylock is successful. unlock now"); pthread_mutex_unlock(&radio->seek_cancel_mutex); } else { MMRADIO_LOG_ERROR("trylock is failed but Not EBUSY. ret: %d", ret); @@ -845,7 +858,7 @@ int _mm_radio_get_signal_strength(mm_radio_t *radio, int *value) if (ret == MM_ERROR_NOT_SUPPORT_API) { MMRADIO_LOG_WARNING("radio_hal_unmute is not supported"); } else if (ret != MM_ERROR_NONE) { - debug_error("radio_hal_get_signal_strength error"); + MMRADIO_LOG_ERROR("radio_hal_get_signal_strength error"); *value = 0; MMRADIO_LOG_FLEAVE(); return ret; @@ -888,7 +901,7 @@ void __mmradio_scan_thread(mm_radio_t *radio) pthread_mutex_lock(&radio->seek_cancel_mutex); if (radio->stop_scan) { - MMRADIO_LOG_DEBUG("scan was canceled"); + MMRADIO_LOG_INFO("scan was canceled"); pthread_mutex_unlock(&radio->seek_cancel_mutex); goto FINISHED; } @@ -910,20 +923,17 @@ void __mmradio_scan_thread(mm_radio_t *radio) if (ret != MM_ERROR_NONE) { MMRADIO_LOG_ERROR("failed to get current frequency"); } else { - if (freq < prev_freq) { - MMRADIO_LOG_DEBUG("scanning wrapped around. stopping scan"); + if (freq <= prev_freq) { + MMRADIO_LOG_ERROR("frequency is less than previous [%d] -> [%d] we wrapped around, we are finished scanning", prev_freq, freq); break; } - if (freq == prev_freq) - continue; - prev_freq = param.radio_scan.frequency = (int)freq; - MMRADIO_LOG_DEBUG("scanning : new frequency : [%d]", param.radio_scan.frequency); + MMRADIO_LOG_INFO("scanning : new frequency : [%d]", param.radio_scan.frequency); /* drop if max freq is scanned */ - if (param.radio_scan.frequency == radio->region_setting.band_max) { - MMRADIO_LOG_DEBUG("%d freq is dropping...and stopping scan", param.radio_scan.frequency); + if (param.radio_scan.frequency >= radio->region_setting.band_max) { + MMRADIO_LOG_WARNING("%d freq is dropping...and stopping scan", param.radio_scan.frequency); break; } @@ -1028,7 +1038,7 @@ void __mmradio_seek_thread(mm_radio_t *radio) MMRADIO_LOG_DEBUG("seek start"); if (radio->seek_cancel) { - MMRADIO_LOG_DEBUG("seek was canceled so we return failure to application"); + MMRADIO_LOG_INFO("seek was canceled so we return failure to application"); pthread_mutex_unlock(&radio->seek_cancel_mutex); goto SEEK_FAILED; } @@ -1051,7 +1061,7 @@ void __mmradio_seek_thread(mm_radio_t *radio) /* if same freq is found, ignore it and search next one. */ if (freq == radio->prev_seek_freq) { - MMRADIO_LOG_DEBUG("It's same with previous found one. So, trying next one."); + MMRADIO_LOG_WARNING("It's same with previous found one. So, trying next one."); goto SEEK_FAILED; } @@ -1079,7 +1089,7 @@ void __mmradio_seek_thread(mm_radio_t *radio) } param.radio_scan.frequency = radio->prev_seek_freq = (int)freq; - MMRADIO_LOG_DEBUG("seeking : new frequency : [%d]", param.radio_scan.frequency); + MMRADIO_LOG_INFO("seeking : new frequency : [%d]", param.radio_scan.frequency); MMRADIO_POST_MSG(radio, MM_MESSAGE_RADIO_SEEK_FINISH, ¶m); } @@ -1118,7 +1128,7 @@ static bool __mmradio_post_message(mm_radio_t *radio, enum MMMessageType msgtype MMRADIO_LOG_FENTER(); if (!radio->msg_cb) { - debug_warning("failed to post a message"); + MMRADIO_LOG_WARNING("failed to post a message"); return false; } @@ -1141,7 +1151,7 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command) radio_state = __mmradio_get_state(radio); - MMRADIO_LOG_DEBUG("incomming command : %d current state : %d", command, radio_state); + MMRADIO_LOG_INFO("incomming command : %d current state : %d", command, radio_state); switch (command) { case MMRADIO_COMMAND_CREATE: @@ -1252,13 +1262,13 @@ static int __mmradio_check_state(mm_radio_t *radio, MMRadioCommand command) return MM_ERROR_NONE; - INVALID_STATE: - debug_warning("invalid state. current : %d command : %d", radio_state, command); +INVALID_STATE: + MMRADIO_LOG_WARNING("invalid state. current : %d command : %d", radio_state, command); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_INVALID_STATE; - NO_OP: - debug_warning("mm-radio is in the desired state(%d). doing noting", radio_state); +NO_OP: + MMRADIO_LOG_WARNING("mm-radio is in the desired state(%d). doing noting", radio_state); MMRADIO_LOG_FLEAVE(); return MM_ERROR_RADIO_NO_OP; @@ -1272,12 +1282,12 @@ static bool __mmradio_set_state(mm_radio_t *radio, int new_state) MMRADIO_LOG_FENTER(); if (!radio) { - debug_warning("calling set_state with invalid radio handle"); + MMRADIO_LOG_WARNING("calling set_state with invalid radio handle"); return false; } if (radio->current_state == new_state && radio->pending_state == 0) { - debug_warning("we are in same state"); + MMRADIO_LOG_WARNING("we are in same state"); return true; } @@ -1326,7 +1336,7 @@ static int __mmradio_get_state(mm_radio_t *radio) { MMRADIO_CHECK_INSTANCE(radio); - MMRADIO_LOG_DEBUG("radio state : current : [%d] old : [%d] pending : [%d]", + MMRADIO_LOG_INFO("radio state : current : [%d] old : [%d] pending : [%d]", radio->current_state, radio->old_state, radio->pending_state); return radio->current_state; @@ -1344,6 +1354,7 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type, MMRADIO_LOG_FENTER(); MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio); + MMRADIO_LOG_INFO("focus_state [%d]", focus_state); mmradio_get_sound_focus_reason(focus_state, reason_for_change, FALSE, &event_source, &postMsg); radio->sound_focus.event_src = event_source; @@ -1357,6 +1368,8 @@ static void __mmradio_sound_focus_cb(int id, mm_sound_focus_type_e focus_type, if (result) MMRADIO_LOG_ERROR("failed to stop radio"); + radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE; + MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d", radio->sound_focus.cur_focus_type); } break; @@ -1396,6 +1409,7 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t MMRADIO_LOG_FENTER(); MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio); + MMRADIO_LOG_INFO("focus_state [%d]", focus_state); mmradio_get_sound_focus_reason(focus_state, reason_for_change, TRUE, &event_source, &postMsg); radio->sound_focus.event_src = event_source; @@ -1408,6 +1422,7 @@ static void __mmradio_sound_focus_watch_cb(int id, mm_sound_focus_type_e focus_t result = _mmradio_stop(radio); if (result) MMRADIO_LOG_ERROR("failed to stop radio"); + radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE; MMRADIO_LOG_DEBUG("FOCUS_IS_RELEASED cur_focus_type : %d\n", radio->sound_focus.cur_focus_type); } @@ -1444,7 +1459,7 @@ static void __mmradio_volume_changed_cb(volume_type_t type, unsigned int volume, int ret = MM_ERROR_NONE; MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio); if (type == VOLUME_TYPE_MEDIA) { - MMRADIO_LOG_DEBUG("Change FM Radio volume to %d", volume); + MMRADIO_LOG_INFO("Change FM Radio volume to %d", volume); ret = __mmradio_set_media_volume(radio, volume); if (ret != MM_ERROR_NONE) MMRADIO_LOG_ERROR("__mmradio_set_media_volume error"); @@ -1504,7 +1519,7 @@ int _mmradio_set_volume(mm_radio_t *radio, float volume) MMRADIO_CHECK_INSTANCE(radio); MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME); - MMRADIO_LOG_DEBUG("Setting %f volume", volume); + MMRADIO_LOG_INFO("Setting %f volume", volume); MMRADIO_VOLUME_LOCK(radio); radio->local_volume = volume; @@ -1556,7 +1571,7 @@ static int __mmradio_set_media_volume(mm_radio_t *radio, unsigned int level) MMRADIO_CHECK_INSTANCE(radio); MMRADIO_CHECK_STATE_RETURN_IF_FAIL(radio, MMRADIO_COMMAND_SET_VOLUME); - MMRADIO_LOG_DEBUG("Setting %d volume", level); + MMRADIO_LOG_INFO("Setting %d volume", level); MMRADIO_VOLUME_LOCK(radio); radio->media_volume = level; diff --git a/src/mm_radio_sound_focus.c b/src/mm_radio_sound_focus.c index 668c060..766a913 100644 --- a/src/mm_radio_sound_focus.c +++ b/src/mm_radio_sound_focus.c @@ -35,6 +35,7 @@ static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connect MMRADIO_LOG_FENTER(); MMRADIO_CHECK_INSTANCE_RETURN_VOID(radio); + MMRADIO_LOG_INFO("device [%d] is_connected [%d]", device, is_connected); if (mm_sound_get_device_type(device, &type) != MM_ERROR_NONE) { MMRADIO_LOG_ERROR("getting device type failed"); @@ -53,6 +54,7 @@ static void _mmradio_device_connected_cb(MMSoundDevice_t device, bool is_connect result = _mmradio_stop(radio); if (result != MM_ERROR_NONE) MMRADIO_LOG_ERROR("failed to stop radio"); + radio->sound_focus.by_focus_cb = MMRADIO_FOCUS_CB_NONE; } break; default: @@ -67,7 +69,7 @@ void _mmradio_sound_signal_callback(mm_sound_signal_name_t signal, int value, vo mm_radio_sound_focus *sound_focus = (mm_radio_sound_focus *)user_data; int ret = MM_ERROR_NONE; - MMRADIO_LOG_DEBUG("sound signal callback %d / %d", signal, value); + MMRADIO_LOG_INFO("sound signal callback %d / %d", signal, value); if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) { if (value == 1) { @@ -119,7 +121,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, /* read session information */ ret = _mm_session_util_read_information(pid, &session_type, &session_flags); - MMRADIO_LOG_DEBUG("Read Session type ret:0x%X", ret); + MMRADIO_LOG_INFO("Read Session type ret:0x%X", ret); if (ret == MM_ERROR_INVALID_HANDLE) { MMRADIO_LOG_WARNING("subscribe_id=%d", sound_focus->subscribe_id); if (sound_focus->subscribe_id == 0) { @@ -137,7 +139,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, MMRADIO_LOG_ERROR("mm_sound_set_focus_watch_callback is failed"); return MM_ERROR_POLICY_BLOCKED; } - MMRADIO_LOG_DEBUG("(%p) set focus watch callback = %d", param, sound_focus->watch_id); + MMRADIO_LOG_INFO("(%p) set focus watch callback = %d", param, sound_focus->watch_id); /* register device connected callback */ ret = mm_sound_add_device_connected_callback(MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG, @@ -146,7 +148,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed"); return MM_ERROR_POLICY_BLOCKED; } - MMRADIO_LOG_ERROR("register device connected callback for the value is 0, sub_cb id %d", sound_focus->device_subs_id); + MMRADIO_LOG_INFO("register device connected callback for the value is 0, sub_cb id %d", sound_focus->device_subs_id); } ret = MM_ERROR_NONE; } else if (ret == MM_ERROR_NONE) { @@ -167,7 +169,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, ret = mm_sound_register_focus_for_session(handle, pid, "radio", focus_cb, param); if (ret != MM_ERROR_NONE) { - MMRADIO_LOG_DEBUG("mm_sound_register_focus_for_session is failed"); + MMRADIO_LOG_ERROR("mm_sound_register_focus_for_session is failed"); return MM_ERROR_POLICY_BLOCKED; } MMRADIO_LOG_DEBUG("(%p) register focus for session %d", param, pid); @@ -207,7 +209,7 @@ int mmradio_sound_focus_register(mm_radio_sound_focus *sound_focus, MMRADIO_LOG_ERROR("mm_sound_add_device_connected_callback is failed"); return MM_ERROR_POLICY_BLOCKED; } - MMRADIO_LOG_DEBUG("(%p) add device connected callback = %d", param, sound_focus->device_subs_id); + MMRADIO_LOG_INFO("(%p) add device connected callback = %d", param, sound_focus->device_subs_id); } } else if (sound_focus->session_type == MM_SESSION_TYPE_REPLACED_BY_STREAM) { /* didn't register device connected cb */ @@ -239,7 +241,7 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus) } if (sound_focus->watch_id > 0) { - MMRADIO_LOG_DEBUG("unset the focus watch cb %d", sound_focus->watch_id); + MMRADIO_LOG_INFO("unset the focus watch cb %d", sound_focus->watch_id); ret = mm_sound_unset_focus_watch_callback(sound_focus->watch_id); sound_focus->watch_id = 0; @@ -255,7 +257,7 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus) } /* unregister device connected callback */ if (sound_focus->device_subs_id > 0) { - MMRADIO_LOG_DEBUG("unset the device connected cb %d", sound_focus->device_subs_id); + MMRADIO_LOG_INFO("unset the device connected cb %d", sound_focus->device_subs_id); ret = mm_sound_remove_device_connected_callback(sound_focus->device_subs_id); sound_focus->device_subs_id = 0; if (ret != MM_ERROR_NONE) @@ -263,7 +265,7 @@ int mmradio_sound_focus_deregister(mm_radio_sound_focus *sound_focus) } if (sound_focus->subscribe_id > 0) { - MMRADIO_LOG_DEBUG("unset mm_sound_subscribe_signal_for_daemon %d", sound_focus->subscribe_id); + MMRADIO_LOG_INFO("unset mm_sound_subscribe_signal_for_daemon %d", sound_focus->subscribe_id); mm_sound_unsubscribe_signal(sound_focus->subscribe_id); } |