gst-plugins-bad : update SRCREV & patchs.
[vuplus_openvuplus] / meta-openvuplus / recipes-multimedia / gstreamer / gst-plugins-bad-0.10.23 / 0005-hlsdemux-locking-fixes.patch
1 --- a/gst/hls/gsthlsdemux.c
2 +++ b/gst/hls/gsthlsdemux.c
3 @@ -1116,6 +1116,8 @@ gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate)
4    GList *previous_variant, *current_variant;
5    gint old_bandwidth, new_bandwidth;
6  
7 +  GST_M3U8_CLIENT_LOCK (demux->client);
8 +
9    /* If user specifies a connection speed never use a playlist with a bandwidth
10     * superior than it */
11    if (demux->connection_speed != 0 && max_bitrate > demux->connection_speed)
12 @@ -1131,11 +1133,11 @@ retry_failover_protection:
13  
14    /* Don't do anything else if the playlist is the same */
15    if (new_bandwidth == old_bandwidth) {
16 +    GST_M3U8_CLIENT_UNLOCK (demux->client);
17      return TRUE;
18    }
19  
20    demux->client->main->current_variant = current_variant;
21 -  GST_M3U8_CLIENT_UNLOCK (demux->client);
22  
23    gst_m3u8_client_set_current (demux->client, current_variant->data);
24  
25 @@ -1152,9 +1154,9 @@ retry_failover_protection:
26          gst_message_new_element (GST_OBJECT_CAST (demux), s));
27    } else {
28      GList *failover = NULL;
29 +    gboolean ret;
30  
31      GST_INFO_OBJECT (demux, "Unable to update playlist. Switching back");
32 -    GST_M3U8_CLIENT_LOCK (demux->client);
33  
34      failover = g_list_previous (current_variant);
35      if (failover && new_bandwidth == GST_M3U8 (failover->data)->bandwidth) {
36 @@ -1163,19 +1165,26 @@ retry_failover_protection:
37      }
38  
39      demux->client->main->current_variant = previous_variant;
40 -    GST_M3U8_CLIENT_UNLOCK (demux->client);
41 +
42      gst_m3u8_client_set_current (demux->client, previous_variant->data);
43      /*  Try a lower bitrate (or stop if we just tried the lowest) */
44      if (new_bandwidth ==
45          GST_M3U8 (g_list_first (demux->client->main->lists)->data)->bandwidth)
46 -      return FALSE;
47 +
48 +      ret = FALSE;
49      else
50 -      return gst_hls_demux_change_playlist (demux, new_bandwidth - 1);
51 +      ret = gst_hls_demux_change_playlist (demux, new_bandwidth - 1);
52 +
53 +    GST_M3U8_CLIENT_UNLOCK (demux->client);
54 +
55 +    return ret;
56    }
57  
58    /* Force typefinding since we might have changed media type */
59    demux->do_typefind = TRUE;
60  
61 +  GST_M3U8_CLIENT_UNLOCK (demux->client);
62 +
63    return TRUE;
64  }
65  
66 --- a/gst/hls/m3u8.c
67 +++ b/gst/hls/m3u8.c
68 @@ -423,7 +423,8 @@ gst_m3u8_client_new (const gchar * uri)
69    client->current = NULL;
70    client->sequence = -1;
71    client->update_failed_count = 0;
72 -  client->lock = g_mutex_new ();
73 +  client->lock = g_new0 (GStaticRecMutex, 1);
74 +  g_static_rec_mutex_init(client->lock);
75    gst_m3u8_set_uri (client->main, g_strdup (uri));
76  
77    return client;
78 @@ -435,7 +436,9 @@ gst_m3u8_client_free (GstM3U8Client * self)
79    g_return_if_fail (self != NULL);
80  
81    gst_m3u8_free (self->main);
82 -  g_mutex_free (self->lock);
83 +  g_static_rec_mutex_free (self->lock);
84 +  g_free (self->lock);
85 +
86    g_free (self);
87  }
88  
89 --- a/gst/hls/m3u8.h
90 +++ b/gst/hls/m3u8.h
91 @@ -32,8 +32,8 @@ typedef struct _GstM3U8Client GstM3U8Client;
92  #define GST_M3U8(m) ((GstM3U8*)m)
93  #define GST_M3U8_MEDIA_FILE(f) ((GstM3U8MediaFile*)f)
94  
95 -#define GST_M3U8_CLIENT_LOCK(c) g_mutex_lock (c->lock);
96 -#define GST_M3U8_CLIENT_UNLOCK(c) g_mutex_unlock (c->lock);
97 +#define GST_M3U8_CLIENT_LOCK(c) g_static_rec_mutex_lock (c->lock);
98 +#define GST_M3U8_CLIENT_UNLOCK(c) g_static_rec_mutex_unlock (c->lock);
99  
100  struct _GstM3U8
101  {
102 @@ -73,7 +73,7 @@ struct _GstM3U8Client
103    GstM3U8 *current;
104    guint update_failed_count;
105    gint sequence;                /* the next sequence for this client */
106 -  GMutex *lock;
107 +  GStaticRecMutex *lock;
108  };
109  
110