diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2007-08-29 01:22:43 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2007-08-29 01:22:43 +0000 |
commit | 9f597336b57f7b4afc44ca2826da75eebeb7039c (patch) | |
tree | 6e28b43d055a003085f8c572a362ccd539d20499 /gst/rtpmanager/rtpsource.c | |
parent | c0a64d008a0b8cc4416039935e4fbc4a7da3931d (diff) | |
download | gst-plugins-bad-9f597336b57f7b4afc44ca2826da75eebeb7039c.tar.gz gst-plugins-bad-9f597336b57f7b4afc44ca2826da75eebeb7039c.tar.bz2 gst-plugins-bad-9f597336b57f7b4afc44ca2826da75eebeb7039c.zip |
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.c | 19 |
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); |