From 28e354b0451477540b0bd14930bdf208b17daad2 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 28 Apr 2015 14:30:11 +0900 Subject: [PATCH] rage - fix stutter due to url fetching when not needed rage was trying to fetch albumart for videos mistakenly. i thought this may have been an emotion mess-up. no. rage mess-up. fix by delaying until emotion back-end has figured out the new stream. this does point out that curl is managing to block the mainloop and perhaps we should stuff it off into a slave thread in ecore_con. :( --- src/bin/win.c | 21 +++++++++++++++++++-- src/bin/win.h | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/bin/win.c b/src/bin/win.c index 83dd798..938c179 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -38,6 +38,7 @@ _cb_win_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void if (inf->show_timeout) ecore_timer_del(inf->show_timeout); if (inf->drag_anim) ecore_animator_del(inf->drag_anim); if (inf->mouse_idle_timeout) ecore_timer_del(inf->mouse_idle_timeout); + if (inf->albumart_timeout) ecore_timer_del(inf->albumart_timeout); EINA_LIST_FREE(inf->file_list, vid) { if (vid->file) eina_stringshare_del(vid->file); @@ -83,6 +84,22 @@ _cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, elm_win_fullscreen_set(data, !elm_win_fullscreen_get(data)); } +static Eina_Bool +_cb_albumart_delay(void *data) +{ + Evas_Object *win = data; + Inf *inf = evas_object_data_get(win, "inf"); + + if (!inf) return EINA_FALSE; + inf->albumart_timeout = NULL; + if (!inf->vid) return EINA_FALSE; + + if ((!video_has_video_get(inf->vid)) && (video_has_audio_get(inf->vid))) + albumart_find(win, inf->vid); + else albumart_find(win, NULL); + return EINA_FALSE; +} + void win_do_play(Evas_Object *win) { @@ -497,8 +514,8 @@ win_show(Evas_Object *win, int w, int h) } evas_object_show(win); } - if (!video_has_video_get(inf->vid)) albumart_find(win, inf->vid); - else albumart_find(win, NULL); + if (inf->albumart_timeout) ecore_timer_del(inf->albumart_timeout); + inf->albumart_timeout = ecore_timer_add(0.2, _cb_albumart_delay, win); if (!video_has_video_get(inf->vid)) elm_layout_signal_emit(inf->lay, "state,novideo", "rage"); diff --git a/src/bin/win.h b/src/bin/win.h index 23e4f16..049a858 100644 --- a/src/bin/win.h +++ b/src/bin/win.h @@ -10,6 +10,7 @@ struct _Inf Ecore_Job *next_job; Ecore_Timer *show_timeout; Ecore_Timer *mouse_idle_timeout; + Ecore_Timer *albumart_timeout; Ecore_Animator *drag_anim; double last_action; double jump;