session: handle Retransmission event and schedule NACK

Handle the retransmission event from downstream and use it to schedule a NACK
request.
This commit is contained in:
Wim Taymans 2013-08-04 23:05:36 +02:00
parent 0bddbd682d
commit 50638b8106
3 changed files with 39 additions and 1 deletions

View file

@ -1499,6 +1499,24 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstObject * parent,
if (gst_rtp_session_request_remote_key_unit (rtpsession, ssrc, pt,
all_headers, count))
forward = FALSE;
} else if (gst_structure_has_name (s, "GstRTPRetransmissionRequest")) {
GstClockTime running_time;
guint seqnum, delay, deadline;
if (!gst_structure_get_clock_time (s, "running-time", &running_time))
running_time = -1;
if (!gst_structure_get_uint (s, "ssrc", &ssrc))
ssrc = -1;
if (!gst_structure_get_uint (s, "seqnum", &seqnum))
seqnum = -1;
if (!gst_structure_get_uint (s, "delay", &deadline))
delay = -1;
if (!gst_structure_get_uint (s, "deadline", &deadline))
deadline = -1;
if (rtp_session_request_nack (rtpsession->priv->session, ssrc, seqnum,
(deadline - delay) * GST_MSECOND))
forward = FALSE;
}
break;
default:

View file

@ -113,7 +113,6 @@ static void rtp_session_get_property (GObject * object, guint prop_id,
static void rtp_session_send_rtcp (RTPSession * sess, GstClockTime max_delay);
static guint rtp_session_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (RTPSession, rtp_session, G_TYPE_OBJECT);
@ -3515,3 +3514,19 @@ rtp_session_request_key_unit (RTPSession * sess, guint32 ssrc,
return TRUE;
}
gboolean
rtp_session_request_nack (RTPSession * sess, guint32 ssrc, guint16 seqnum,
GstClockTime max_delay)
{
RTPSource *source = find_source (sess, ssrc);
if (source == NULL)
return FALSE;
GST_DEBUG ("request NACK for %08x, #%u", ssrc, seqnum);
rtp_session_send_rtcp (sess, max_delay);
return TRUE;
}

View file

@ -345,5 +345,10 @@ gboolean rtp_session_request_key_unit (RTPSession * sess,
guint32 ssrc,
gboolean fir,
gint count);
gboolean rtp_session_request_nack (RTPSession * sess,
guint32 ssrc,
guint16 seqnum,
GstClockTime max_delay);
#endif /* __RTP_SESSION_H__ */