summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/rtpsource.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-08-29 01:22:43 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-11 02:30:29 +0100
commit325dac0fc21bf3e014f1a0bbe6de5dc711e21e30 (patch)
treed9d0b3012d6874d288a59054a1e733eaf6557feb /gst/rtpmanager/rtpsource.c
parenteb86865a62b01688fcfdbcb2c0d374e36d37ec3f (diff)
gst/rtpmanager/gstrtpsession.*: Distribute synchronisation parameters to the session manager so that it can generate ...
Original commit message from CVS: * gst/rtpmanager/gstrtpsession.c: (stop_rtcp_thread), (gst_rtp_session_change_state), (gst_rtp_session_event_send_rtp_sink): * gst/rtpmanager/gstrtpsession.h: Distribute synchronisation parameters to the session manager so that it can generate correct SR packets for lip-sync. * gst/rtpmanager/rtpsession.c: (rtp_session_set_base_time), (rtp_session_set_timestamp_sync), (session_start_rtcp): * gst/rtpmanager/rtpsession.h: Add methods for setting sync parameters. Set correct RTP time in SR packets using the sync params. * gst/rtpmanager/rtpsource.c: (rtp_source_send_rtp): * gst/rtpmanager/rtpsource.h: Record last RTP <-> GST timestamp so that we can use them to convert NTP to RTP timestamps in SR packets.
Diffstat (limited to 'gst/rtpmanager/rtpsource.c')
-rw-r--r--gst/rtpmanager/rtpsource.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 1a989517..ad491bd0 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -456,6 +456,7 @@ rtp_source_send_rtp (RTPSource * src, GstBuffer * buffer)
{
GstFlowReturn result = GST_FLOW_OK;
guint len;
+ GstClockTime timestamp;
g_return_val_if_fail (RTP_IS_SOURCE (src), GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
@@ -469,18 +470,32 @@ rtp_source_send_rtp (RTPSource * src, GstBuffer * buffer)
src->stats.packets_sent++;
src->stats.octets_sent += len;
+ /* we keep track of the last received RTP timestamp and the corresponding
+ * GStreamer timestamp so that we can convert NTP time to RTP time when
+ * sending SR reports */
+ src->last_rtptime = gst_rtp_buffer_get_timestamp (buffer);
+
+ /* the timestamp can be undefined, in that case we use any previously
+ * received timestamp */
+ timestamp = GST_BUFFER_TIMESTAMP (buffer);
+ if (timestamp != -1)
+ src->last_timestamp = timestamp;
+
/* push packet */
if (src->callbacks.push_rtp) {
guint32 ssrc;
ssrc = gst_rtp_buffer_get_ssrc (buffer);
if (ssrc != src->ssrc) {
- GST_DEBUG ("updating SSRC from %u to %u", ssrc, src->ssrc);
+ /* the SSRC of the packet is not correct, make a writable buffer and
+ * update the SSRC. This could involve a complete copy of the packet when
+ * it is not writable. Usually the payloader will use caps negotiation to
+ * get the correct SSRC. */
buffer = gst_buffer_make_writable (buffer);
+ GST_DEBUG ("updating SSRC from %u to %u", ssrc, src->ssrc);
gst_rtp_buffer_set_ssrc (buffer, src->ssrc);
}
-
GST_DEBUG ("pushing RTP packet %" G_GUINT64_FORMAT,
src->stats.packets_sent);
result = src->callbacks.push_rtp (src, buffer, src->user_data);