Change the thread running flag before send message. 84/177084/3 accepted/tizen/unified/20180426.062535 submit/tizen/20180425.085112
authorGilbok Lee <gilbok.lee@samsung.com>
Wed, 25 Apr 2018 07:20:34 +0000 (16:20 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 25 Apr 2018 08:43:27 +0000 (17:43 +0900)
seek complete callback is called but, radio seek running flag is true

[Version] 0.2.40
[Profile] Mobile, Wearable
[Issue Type] Fix bugs

Change-Id: Ic32c1f7abeae521af3608ecfe042e0f64f729662

packaging/libmm-radio.spec
src/mm_radio_priv_emulator.c
src/mm_radio_priv_hal.c

index c6bf627..b94b983 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.39
+Version:    0.2.40
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 6234fda..ff3a9a6 100644 (file)
@@ -988,13 +988,16 @@ FINISHED:
                        }
                }
 
-               if (!p_thread->stop)
-                       __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_FINISHED, 0);
-               else
+               p_thread->is_running = false;
+
+               if (p_thread->stop)
                        __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_STOPPED, 0);
+               else
+                       __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_FINISHED, 0);
 
-               p_thread->is_running = false;
+               /* reset thread stop flag */
                p_thread->stop = false;
+
        }
 
 EXIT:
@@ -1106,9 +1109,9 @@ void __mmradio_seek_thread(mm_radio_t * radio)
 
                radio->prev_seek_freq = freq;
                MMRADIO_LOG_INFO("seeking : new frequency : [%d]", (int) freq);
+               p_thread->is_running = false;
                __mmradio_msg_push(radio, MM_RADIO_MSG_SEEK_FINISHED, freq);
                p_thread->stop = true;
-               p_thread->is_running = false;
                continue;
 
 SEEK_FAILED:
@@ -1592,9 +1595,6 @@ static void __mmradio_destroy_thread_type(mm_radio_t *radio, MMRadioThreadTypes
                        pthread_join(p_thread->thread, NULL);
                        p_thread->thread = 0;
                        break;
-               default:
-                       MMRADIO_LOG_WARNING("(%d)type isn't handled", type);
-                       break;
                }
        } else {
                MMRADIO_LOG_WARNING("(%d)thread is zero", type);
index ac1cd92..f875a77 100644 (file)
@@ -1009,12 +1009,15 @@ FINISHED_ERR:
                        MMRADIO_SET_STATE(radio, MM_RADIO_STATE_READY);
                }
 
-               if (!p_thread->stop)
-                       __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_FINISHED, 0);
-               else
+               p_thread->is_running = false;
+
+               if (p_thread->stop)
                        __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_STOPPED, 0);
+               else
+                       __mmradio_msg_push(radio, MM_RADIO_MSG_SCAN_FINISHED, 0);
 
-               p_thread->is_running = false;
+               /* reset thread stop flag */
+               p_thread->stop = false;
 
        }
 
@@ -1141,8 +1144,8 @@ void __mmradio_seek_thread(mm_radio_t *radio)
 
                radio->prev_seek_freq = (int)freq;
                MMRADIO_LOG_INFO("seeking : new frequency : [%d]", (int) freq);
-               __mmradio_msg_push(radio, MM_RADIO_MSG_SEEK_FINISHED, freq);
                p_thread->is_running = false;
+               __mmradio_msg_push(radio, MM_RADIO_MSG_SEEK_FINISHED, freq);
                continue;
 
 SEEK_FAILED:
@@ -1156,9 +1159,9 @@ SEEK_FAILED:
                                MMRADIO_LOG_ERROR("failed to set unmute radio hal");
                        radio->seek_unmute = false;
                }
+               p_thread->is_running = false;
                /* freq -1 means it's failed to seek */
                __mmradio_msg_push(radio, MM_RADIO_MSG_SEEK_FINISHED, -1);
-               p_thread->is_running = false;
        }
 
 EXIT:
@@ -1647,9 +1650,6 @@ static void __mmradio_destroy_thread_type(mm_radio_t *radio, MMRadioThreadTypes
                        pthread_join(p_thread->thread, NULL);
                        p_thread->thread = 0;
                        break;
-               default:
-                       MMRADIO_LOG_WARNING("(%d)type isn't handled", type);
-                       break;
                }
        } else {
                MMRADIO_LOG_WARNING("(%d)thread is zero", type);