}
void
+_mmplayer_watcher_removed_notify(gpointer data)
+{
+ mmplayer_t *player = (mmplayer_t *)data;
+ MMPLAYER_RETURN_IF_FAIL(player);
+
+ MMPLAYER_BUS_WATCHER_LOCK(player);
+ player->bus_watcher = 0;
+ MMPLAYER_BUS_WATCHER_SIGNAL(player);
+ MMPLAYER_BUS_WATCHER_UNLOCK(player);
+}
+
+void
+_mmplayer_bus_watcher_remove(MMHandleType hplayer)
+{
+ mmplayer_t *player = (mmplayer_t *)hplayer;
+ gint64 end_time = 0;
+ MMPLAYER_FENTER();
+ MMPLAYER_RETURN_IF_FAIL(player);
+
+ /* disconnecting bus watch */
+ if (player->bus_watcher > 0) {
+ __mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
+ MMPLAYER_BUS_WATCHER_LOCK(player);
+ end_time = g_get_monotonic_time () + 2 * G_TIME_SPAN_SECOND;
+ while (player->bus_watcher > 0)
+ MMPLAYER_BUS_WATCHER_WAIT_UNTIL(player, end_time);
+ MMPLAYER_BUS_WATCHER_UNLOCK(player);
+
+ g_mutex_clear(&player->bus_watcher_mutex);
+ g_cond_clear(&player->bus_watcher_cond);
+ }
+
+ MMPLAYER_FLEAVE();
+}
+
+void
_mmplayer_bus_msg_thread_destroy(MMHandleType hplayer)
{
mmplayer_t *player = (mmplayer_t *)hplayer;
MMPLAYER_FENTER();
MMPLAYER_RETURN_IF_FAIL(player);
- /* disconnecting bus watch */
- if (player->bus_watcher)
- __mmplayer_remove_g_source_from_context(player->context.thread_default, player->bus_watcher);
- player->bus_watcher = 0;
-
/* destroy the gst bus msg thread */
if (player->bus_msg_thread) {
MMPLAYER_BUS_MSG_THREAD_LOCK(player);
return MM_ERROR_NONE;
INIT_ERROR:
+ _mmplayer_bus_watcher_remove(player);
__mmplayer_gst_destroy_pipeline(player);
return MM_ERROR_PLAYER_INTERNAL;
}
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_CMD_UNLOCK(player);
+ _mmplayer_bus_watcher_remove(player);
/* destroy the gst bus msg thread which is created during realize.
this funct have to be called before getting cmd lock. */
_mmplayer_bus_msg_thread_destroy(player);