mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtpsession: Put the PLI requests in each RTPSource
Also refactor a bit and put all the keyframe request code in one place inside rtpsession.c https://bugzilla.gnome.org/show_bug.cgi?id=658419
This commit is contained in:
parent
59c028a4ce
commit
12a6b9613b
4 changed files with 30 additions and 30 deletions
|
@ -1389,7 +1389,6 @@ gst_rtp_session_request_remote_key_unit (GstRtpSession * rtpsession,
|
|||
guint32 ssrc, guint payload, gboolean all_headers)
|
||||
{
|
||||
GstCaps *caps;
|
||||
gboolean requested = FALSE;
|
||||
|
||||
caps = gst_rtp_session_get_caps_for_pt (rtpsession, payload);
|
||||
|
||||
|
@ -1401,15 +1400,12 @@ gst_rtp_session_request_remote_key_unit (GstRtpSession * rtpsession,
|
|||
|
||||
gst_caps_unref (caps);
|
||||
|
||||
if (pli) {
|
||||
rtp_session_request_key_unit (rtpsession->priv->session, ssrc);
|
||||
rtp_session_request_early_rtcp (rtpsession->priv->session,
|
||||
gst_clock_get_time (rtpsession->priv->sysclock), 200 * GST_MSECOND);
|
||||
requested = TRUE;
|
||||
}
|
||||
if (pli)
|
||||
return rtp_session_request_key_unit (rtpsession->priv->session, ssrc,
|
||||
gst_clock_get_time (rtpsession->priv->sysclock));
|
||||
}
|
||||
|
||||
return requested;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -568,7 +568,6 @@ rtp_session_init (RTPSession * sess)
|
|||
sess->rtcp_immediate_feedback_threshold =
|
||||
DEFAULT_RTCP_IMMEDIATE_FEEDBACK_THRESHOLD;
|
||||
|
||||
sess->rtcp_pli_requests = g_array_new (FALSE, FALSE, sizeof (guint32));
|
||||
sess->last_keyframe_request = GST_CLOCK_TIME_NONE;
|
||||
|
||||
GST_DEBUG ("%p: session using SSRC: %08x", sess, sess->source->ssrc);
|
||||
|
@ -591,8 +590,6 @@ rtp_session_finalize (GObject * object)
|
|||
g_hash_table_destroy (sess->cnames);
|
||||
g_object_unref (sess->source);
|
||||
|
||||
g_array_free (sess->rtcp_pli_requests, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -3301,19 +3298,22 @@ rtp_session_request_early_rtcp (RTPSession * sess, GstClockTime current_time,
|
|||
dont_send:
|
||||
|
||||
RTP_SESSION_UNLOCK (sess);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
rtp_session_request_key_unit (RTPSession * sess, guint32 ssrc)
|
||||
gboolean
|
||||
rtp_session_request_key_unit (RTPSession * sess, guint32 ssrc, GstClockTime now)
|
||||
{
|
||||
guint i;
|
||||
RTPSource *src = g_hash_table_lookup (sess->ssrcs[sess->mask_idx],
|
||||
GUINT_TO_POINTER (ssrc));
|
||||
|
||||
for (i = 0; i < sess->rtcp_pli_requests->len; i++)
|
||||
if (ssrc == g_array_index (sess->rtcp_pli_requests, guint32, i))
|
||||
return;
|
||||
if (!src)
|
||||
return FALSE;
|
||||
|
||||
g_array_append_val (sess->rtcp_pli_requests, ssrc);
|
||||
src->send_pli = TRUE;
|
||||
|
||||
rtp_session_request_early_rtcp (sess, now, 200 * GST_MSECOND);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -3336,16 +3336,19 @@ rtp_session_on_sending_rtcp (RTPSession * sess, GstBuffer * buffer,
|
|||
gboolean early)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
RTP_SESSION_LOCK (sess);
|
||||
|
||||
while (sess->rtcp_pli_requests->len) {
|
||||
GstRTCPPacket rtcppacket;
|
||||
guint media_ssrc = g_array_index (sess->rtcp_pli_requests, guint32, 0);
|
||||
RTPSource *media_src = g_hash_table_lookup (sess->ssrcs[sess->mask_idx],
|
||||
GUINT_TO_POINTER (media_ssrc));
|
||||
g_hash_table_iter_init (&iter, sess->ssrcs[sess->mask_idx]);
|
||||
|
||||
if (media_src && !rtp_source_has_retained (media_src,
|
||||
while (g_hash_table_iter_next (&iter, &key, &value)) {
|
||||
guint media_ssrc = GPOINTER_TO_UINT (key);
|
||||
RTPSource *media_src = value;
|
||||
GstRTCPPacket rtcppacket;
|
||||
|
||||
if (media_src->send_pli && !rtp_source_has_retained (media_src,
|
||||
has_pli_compare_func, NULL)) {
|
||||
if (gst_rtcp_buffer_add_packet (buffer, GST_RTCP_TYPE_PSFB, &rtcppacket)) {
|
||||
gst_rtcp_packet_fb_set_type (&rtcppacket, GST_RTCP_PSFB_TYPE_PLI);
|
||||
|
@ -3360,8 +3363,7 @@ rtp_session_on_sending_rtcp (RTPSession * sess, GstBuffer * buffer,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_array_remove_index (sess->rtcp_pli_requests, 0);
|
||||
media_src->send_pli = FALSE;
|
||||
}
|
||||
|
||||
RTP_SESSION_UNLOCK (sess);
|
||||
|
|
|
@ -235,7 +235,6 @@ struct _RTPSession {
|
|||
GstClockTime rtcp_feedback_retention_window;
|
||||
guint rtcp_immediate_feedback_threshold;
|
||||
|
||||
GArray *rtcp_pli_requests;
|
||||
GstClockTime last_keyframe_request;
|
||||
gboolean last_keyframe_all_headers;
|
||||
};
|
||||
|
@ -350,7 +349,8 @@ void rtp_session_request_early_rtcp (RTPSession * sess, GstClockT
|
|||
GstClockTimeDiff max_delay);
|
||||
|
||||
/* Notify session of a request for a new key unit */
|
||||
void rtp_session_request_key_unit (RTPSession * sess,
|
||||
guint32 ssrc);
|
||||
gboolean rtp_session_request_key_unit (RTPSession * sess,
|
||||
guint32 ssrc,
|
||||
GstClockTime now);
|
||||
|
||||
#endif /* __RTP_SESSION_H__ */
|
||||
|
|
|
@ -172,6 +172,8 @@ struct _RTPSource {
|
|||
GList *conflicting_addresses;
|
||||
|
||||
GQueue *retained_feedback;
|
||||
|
||||
gboolean send_pli;
|
||||
};
|
||||
|
||||
struct _RTPSourceClass {
|
||||
|
|
Loading…
Reference in a new issue