diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2007-04-30 13:41:30 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2007-04-30 13:41:30 +0000 |
commit | 5171199836b057eef7d98542268c5918fdaa47cd (patch) | |
tree | 32e7ccbfd16994fcaa1f3e09a6d4c711892e5251 /gst/rtpmanager/rtpsession.c | |
parent | f4508d302c4edb5f51374815c360b4bcc6b9f43d (diff) | |
download | gst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.tar.gz gst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.tar.bz2 gst-plugins-bad-5171199836b057eef7d98542268c5918fdaa47cd.zip |
gst/rtpmanager/async_jitter_queue.c: Fix the case where the buffer underruns and does not block.
Original commit message from CVS:
* gst/rtpmanager/async_jitter_queue.c: (signal_waiting_threads),
(async_jitter_queue_pop_intern_unlocked):
Fix the case where the buffer underruns and does not block.
* gst/rtpmanager/gstrtpbin.c: (gst_rtp_bin_base_init),
(create_recv_rtcp), (create_send_rtp), (create_rtcp),
(gst_rtp_bin_request_new_pad):
Rename RTCP send pad, like in the session manager.
Allow getting an RTCP pad for receiving even if we don't receive RTP.
fix handling of send_rtp_src pad.
* gst/rtpmanager/gstrtpptdemux.c: (gst_rtp_pt_demux_chain):
When no pt map could be found, fall back to the sinkpad caps.
* gst/rtpmanager/gstrtpsession.c: (gst_rtp_session_process_rtp),
(gst_rtp_session_send_rtp), (create_recv_rtp_sink),
(create_recv_rtcp_sink), (create_send_rtp_sink),
(create_send_rtcp_src):
Fix pad names.
* gst/rtpmanager/rtpsession.c: (source_push_rtp),
(rtp_session_create_source), (rtp_session_process_sr),
(rtp_session_send_rtp), (session_start_rtcp):
* gst/rtpmanager/rtpsession.h:
Unlock session when performing a callback.
Add callbacks for the internal session object.
Fix sending of RTP packets.
first attempt at adding NTP times in the SR packets.
Small debug and doc improvements.
* gst/rtpmanager/rtpsource.c: (rtp_source_send_rtp):
Update stats for SR reports.
Diffstat (limited to 'gst/rtpmanager/rtpsession.c')
-rw-r--r-- | gst/rtpmanager/rtpsession.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index af418abf..8a7f3e7d 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -622,6 +622,7 @@ source_push_rtp (RTPSource * source, GstBuffer * buffer, RTPSession * session) if (source == session->source) { GST_DEBUG ("source %08x pushed sender RTP packet", source->ssrc); + RTP_SESSION_UNLOCK (session); if (session->callbacks.send_rtp) result = @@ -629,8 +630,11 @@ source_push_rtp (RTPSource * source, GstBuffer * buffer, RTPSession * session) session->user_data); else gst_buffer_unref (buffer); + } else { GST_DEBUG ("source %08x pushed receiver RTP packet", source->ssrc); + RTP_SESSION_UNLOCK (session); + if (session->callbacks.process_rtp) result = session->callbacks.process_rtp (session, source, buffer, @@ -638,6 +642,8 @@ source_push_rtp (RTPSource * source, GstBuffer * buffer, RTPSession * session) else gst_buffer_unref (buffer); } + RTP_SESSION_LOCK (session); + return result; } @@ -877,6 +883,7 @@ rtp_session_create_source (RTPSession * sess) } source = rtp_source_new (ssrc); g_object_ref (source); + rtp_source_set_callbacks (source, &callbacks, sess); g_hash_table_insert (sess->ssrcs[sess->mask_idx], GINT_TO_POINTER (ssrc), source); /* we have one more source now */ @@ -1080,6 +1087,8 @@ rtp_session_process_sr (RTPSession * sess, GstRTCPPacket * packet, gst_rtcp_packet_get_rb (packet, i, &ssrc, &fractionlost, &packetslost, &exthighestseq, &jitter, &lsr, &dlsr); + GST_DEBUG ("RB %d: %08x, %u", i, ssrc, jitter); + if (ssrc == sess->source->ssrc) { /* only deal with report blocks for our session, we update the stats of * the sender of the RTCP message. We could also compare our stats against @@ -1361,7 +1370,8 @@ ignore: * @sess: an #RTPSession * @buffer: an RTP buffer * - * Send the RTP buffer in the session manager. + * Send the RTP buffer in the session manager. This function takes ownership of + * @buffer. * * Returns: a #GstFlowReturn. */ @@ -1375,9 +1385,19 @@ rtp_session_send_rtp (RTPSession * sess, GstBuffer * buffer) g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR); g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR); + if (!gst_rtp_buffer_validate (buffer)) + goto invalid_packet; + + GST_DEBUG ("received RTP packet for sending"); + RTP_SESSION_LOCK (sess); source = sess->source; + /* update last activity */ + if (sess->callbacks.get_time) + source->last_rtp_activity = + sess->callbacks.get_time (sess, sess->user_data); + prevsender = RTP_SOURCE_IS_SENDER (source); /* we use our own source to send */ @@ -1388,6 +1408,14 @@ rtp_session_send_rtp (RTPSession * sess, GstBuffer * buffer) RTP_SESSION_UNLOCK (sess); return result; + + /* ERRORS */ +invalid_packet: + { + gst_buffer_unref (buffer); + GST_DEBUG ("invalid RTP packet received"); + return GST_FLOW_OK; + } } static GstClockTime @@ -1534,13 +1562,22 @@ session_start_rtcp (RTPSession * sess, ReportData * data) data->rtcp = gst_rtcp_buffer_new (sess->mtu); if (RTP_SOURCE_IS_SENDER (own)) { + guint64 ntptime; + guint32 rtptime; + /* we are a sender, create SR */ GST_DEBUG ("create SR for SSRC %08x", own->ssrc); gst_rtcp_buffer_add_packet (data->rtcp, GST_RTCP_TYPE_SR, packet); - /* fill in sender report info, FIXME NTP and RTP timestamps missing */ + /* convert clock time to NTP time */ + ntptime = gst_util_uint64_scale (data->time, (1LL << 32), GST_SECOND); + ntptime += (2208988800LL << 32); + + rtptime = 0; + + /* fill in sender report info, FIXME RTP timestamps missing */ gst_rtcp_packet_sr_set_sender_info (packet, own->ssrc, - 0, 0, own->stats.packets_sent, own->stats.octets_sent); + ntptime, rtptime, own->stats.packets_sent, own->stats.octets_sent); } else { /* we are only receiver, create RR */ GST_DEBUG ("create RR for SSRC %08x", own->ssrc); |