[vlc-commits] vout: remove useless locking and epg loop

Francois Cartegnie git at videolan.org
Wed Sep 7 17:53:59 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep  7 15:59:44 2016 +0200| [c97a77dd8252ddfedc7e8738de2a6ffb95ad655c] | committer: Francois Cartegnie

vout: remove useless locking and epg loop

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c97a77dd8252ddfedc7e8738de2a6ffb95ad655c
---

 src/video_output/video_epg.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 3c16cb1..ce149e9 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -279,23 +279,25 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
     char *now_playing = input_item_GetNowPlayingFb(input);
     vlc_epg_t *epg = NULL;
 
-    vlc_mutex_lock(&input->lock);
-
     /* Look for the current program EPG event */
-    for (int i = 0; i < input->i_epg; i++) {
-        vlc_epg_t *tmp = input->pp_epg[i];
-
-        if (tmp->p_current &&
-            tmp->p_current->psz_name && now_playing != NULL &&
-            !strcmp(tmp->p_current->psz_name, now_playing)) {
-            epg = vlc_epg_New(tmp->psz_name);
-            vlc_epg_Merge(epg, tmp);
-            break;
+    if(now_playing){
+        vlc_mutex_lock(&input->lock);
+
+        for (int i = 0; i < input->i_epg; i++) {
+            const vlc_epg_t *tmp = input->pp_epg[i];
+
+            if (tmp->p_current &&
+                tmp->p_current->psz_name &&
+                !strcmp(tmp->p_current->psz_name, now_playing)) {
+                epg = vlc_epg_New(tmp->psz_name);
+                vlc_epg_Merge(epg, tmp);
+                break;
+            }
         }
-    }
 
-    vlc_mutex_unlock(&input->lock);
-    free(now_playing);
+        vlc_mutex_unlock(&input->lock);
+        free(now_playing);
+    }
 
     /* If no EPG event has been found. */
     if (epg == NULL)



More information about the vlc-commits mailing list