rtsp-stream: RTCP and RTP transport cache cookies seperated
authorAnila Balavan <anilabn@axis.com>
Fri, 30 Jan 2015 11:50:20 +0000 (12:50 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 30 Jan 2015 17:26:44 +0000 (18:26 +0100)
RTCP packets were not sent because the same tr_cache_cookie was used for
both RTP and RTCP. So only one of the tr_cache lists were populated
depending on which one was sent first. If the tr_cache list is not
populated then no packets can be sent. Most often this happened to be
RTCP. Now seperate RTCP and RTP transport cache cookies are added which
resulted in both the tr_cache_lists to be populated regardless of which
one was sent first.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=743734

gst/rtsp-server/rtsp-stream.c

index 9a7a59f..d2e0432 100644 (file)
@@ -141,7 +141,9 @@ struct _GstRTSPStreamPrivate
   guint transports_cookie;
   GList *tr_cache_rtp;
   GList *tr_cache_rtcp;
-  guint tr_cache_cookie;
+  guint tr_cache_cookie_rtp;
+  guint tr_cache_cookie_rtcp;
+
 
   /* UDP sources for UDP multicast transports */
   GList *transport_sources;
@@ -1610,19 +1612,26 @@ handle_new_sample (GstAppSink * sink, gpointer user_data)
   is_rtp = GST_ELEMENT_CAST (sink) == priv->appsink[0];
 
   g_mutex_lock (&priv->lock);
-  if (priv->tr_cache_cookie != priv->transports_cookie) {
-    clear_tr_cache (priv, is_rtp);
-    for (walk = priv->transports; walk; walk = g_list_next (walk)) {
-      GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
-      if (is_rtp) {
+  if (is_rtp) {
+    if (priv->tr_cache_cookie_rtp != priv->transports_cookie) {
+      clear_tr_cache (priv, is_rtp);
+      for (walk = priv->transports; walk; walk = g_list_next (walk)) {
+        GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
         priv->tr_cache_rtp =
             g_list_prepend (priv->tr_cache_rtp, g_object_ref (tr));
-      } else {
+      }
+      priv->tr_cache_cookie_rtp = priv->transports_cookie;
+    }
+  } else {
+    if (priv->tr_cache_cookie_rtcp != priv->transports_cookie) {
+      clear_tr_cache (priv, is_rtp);
+      for (walk = priv->transports; walk; walk = g_list_next (walk)) {
+        GstRTSPStreamTransport *tr = (GstRTSPStreamTransport *) walk->data;
         priv->tr_cache_rtcp =
             g_list_prepend (priv->tr_cache_rtcp, g_object_ref (tr));
       }
+      priv->tr_cache_cookie_rtcp = priv->transports_cookie;
     }
-    priv->tr_cache_cookie = priv->transports_cookie;
   }
   g_mutex_unlock (&priv->lock);