wtay gst-plugins-bad: gst-plugins-bad/ gst-plugins-bad/gst/rtpmanager/

[email protected] Fri, 2 Jan 2009 09:40:20 -0800 (PST)
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-bad
Changes by:     wtay
Date:           Fri Jan 02 2009  17:40:20 UTC

Log message:
Patch by: Olivier Crete <tester at tester dot ca>
* gst/rtpmanager/gstrtpsession.c:
(gst_rtp_session_setcaps_send_rtp), (create_send_rtp_sink):
* gst/rtpmanager/rtpsession.c: (rtp_session_set_internal_ssrc):
When an SSRC is found on the caps of the sender RTP, use this as the
internal SSRC. Fixes #565910.

Modified files:
    .               : ChangeLog
    gst/rtpmanager  : gstrtpsession.c rtpsession.c

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3848&r2=1.3849
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpsession.c.diff?r1=1.56&r2=1.57
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsession.c.diff?r1=1.43&r2=1.44

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v
retrieving revision 1.3848
retrieving revision 1.3849
diff -u -d -r1.3848 -r1.3849
--- ChangeLog	2 Jan 2009 16:50:51 -0000	1.3848
+++ ChangeLog	2 Jan 2009 17:40:04 -0000	1.3849
@@ -1,5 +1,15 @@
 2009-01-02  Wim Taymans  <[email protected]>
 
+	Patch by: Olivier Crete <tester at tester dot ca>
+
+	* gst/rtpmanager/gstrtpsession.c:
+	(gst_rtp_session_setcaps_send_rtp), (create_send_rtp_sink):
+	* gst/rtpmanager/rtpsession.c: (rtp_session_set_internal_ssrc):
+	When an SSRC is found on the caps of the sender RTP, use this as the
+	internal SSRC. Fixes #565910.
+2009-01-02  Wim Taymans  <[email protected]>
 	* gst/rtpmanager/gstrtpsession.c:
 	(gst_rtp_session_event_send_rtp_sink),
 	(gst_rtp_session_getcaps_send_rtp):
Index: gstrtpsession.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/gstrtpsession.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- gstrtpsession.c	2 Jan 2009 16:50:53 -0000	1.56
+++ gstrtpsession.c	2 Jan 2009 17:40:06 -0000	1.57
@@ -1675,6 +1675,27 @@
   return result;
 }
+static gboolean
+gst_rtp_session_setcaps_send_rtp (GstPad * pad, GstCaps * caps)
+{
+  GstRtpSession *rtpsession;
+  GstRtpSessionPrivate *priv;
+  GstStructure *s = gst_caps_get_structure (caps, 0);
+  guint ssrc;
+  rtpsession = GST_RTP_SESSION (gst_pad_get_parent (pad));
+  priv = rtpsession->priv;
+  if (gst_structure_get_uint (s, "ssrc", &ssrc)) {
+    GST_DEBUG_OBJECT (rtpsession, "setting internal SSRC to %08x", ssrc);
+    rtp_session_set_internal_ssrc (priv->session, ssrc);
+  }
+  gst_object_unref (rtpsession);
+  return TRUE;
+}
 /* Recieve an RTP packet to be send to the receivers, send to RTP session
  * manager and forward to send_rtp_src.
  */
@@ -1852,6 +1873,8 @@
       gst_rtp_session_chain_send_rtp);
   gst_pad_set_getcaps_function (rtpsession->send_rtp_sink,
       gst_rtp_session_getcaps_send_rtp);
+  gst_pad_set_setcaps_function (rtpsession->send_rtp_sink,
+      gst_rtp_session_setcaps_send_rtp);
   gst_pad_set_event_function (rtpsession->send_rtp_sink,
       (GstPadEventFunction) gst_rtp_session_event_send_rtp_sink);
   gst_pad_set_internal_link_function (rtpsession->send_rtp_sink,
Index: rtpsession.c
RCS file: /cvs/gstreamer/gst-plugins-bad/gst/rtpmanager/rtpsession.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- rtpsession.c	2 Jan 2009 16:50:53 -0000	1.43
+++ rtpsession.c	2 Jan 2009 17:40:06 -0000	1.44
@@ -1209,9 +1209,14 @@
     g_hash_table_steal (sess->ssrcs[sess->mask_idx],
         GINT_TO_POINTER (sess->source->ssrc));
+    GST_DEBUG ("setting internal SSRC to %08x", ssrc);
+    /* After this call, any receiver of the old SSRC either in RTP or RTCP
+     * packets will timeout on the old SSRC, we could potentially schedule a
+     * BYE RTCP for the old SSRC... */
     sess->source->ssrc = ssrc;
     rtp_source_reset (sess->source);
+    /* rehash with the new SSRC */
     g_hash_table_insert (sess->ssrcs[sess->mask_idx],
         GINT_TO_POINTER (sess->source->ssrc), sess->source);
   }

------------------------------------------------------------------------------