mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 10:23:47 +00:00
rtpsession: Send GstForceKeyUnit event in response to received RTCP PLI
This commit is contained in:
parent
7350d2adfa
commit
a61bb9e94b
3 changed files with 56 additions and 1 deletions
|
@ -257,6 +257,8 @@ static GstFlowReturn gst_rtp_session_sync_rtcp (RTPSession * sess,
|
||||||
static gint gst_rtp_session_clock_rate (RTPSession * sess, guint8 payload,
|
static gint gst_rtp_session_clock_rate (RTPSession * sess, guint8 payload,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
static void gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data);
|
static void gst_rtp_session_reconsider (RTPSession * sess, gpointer user_data);
|
||||||
|
static void gst_rtp_session_request_key_unit (RTPSession * sess,
|
||||||
|
gboolean all_headers, gpointer user_data);
|
||||||
|
|
||||||
static RTPSessionCallbacks callbacks = {
|
static RTPSessionCallbacks callbacks = {
|
||||||
gst_rtp_session_process_rtp,
|
gst_rtp_session_process_rtp,
|
||||||
|
@ -264,7 +266,8 @@ static RTPSessionCallbacks callbacks = {
|
||||||
gst_rtp_session_sync_rtcp,
|
gst_rtp_session_sync_rtcp,
|
||||||
gst_rtp_session_send_rtcp,
|
gst_rtp_session_send_rtcp,
|
||||||
gst_rtp_session_clock_rate,
|
gst_rtp_session_clock_rate,
|
||||||
gst_rtp_session_reconsider
|
gst_rtp_session_reconsider,
|
||||||
|
gst_rtp_session_request_key_unit
|
||||||
};
|
};
|
||||||
|
|
||||||
/* GObject vmethods */
|
/* GObject vmethods */
|
||||||
|
@ -2143,3 +2146,16 @@ wrong_pad:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtp_session_request_key_unit (RTPSession * sess,
|
||||||
|
gboolean all_headers, gpointer user_data)
|
||||||
|
{
|
||||||
|
GstRtpSession *rtpsession = GST_RTP_SESSION (user_data);
|
||||||
|
GstEvent *event;
|
||||||
|
|
||||||
|
event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM,
|
||||||
|
gst_structure_new ("GstForceKeyUnit",
|
||||||
|
"all-headers", G_TYPE_BOOLEAN, all_headers, NULL));
|
||||||
|
gst_pad_push_event (rtpsession->send_rtp_sink, event);
|
||||||
|
}
|
||||||
|
|
|
@ -769,6 +769,10 @@ rtp_session_set_callbacks (RTPSession * sess, RTPSessionCallbacks * callbacks,
|
||||||
sess->callbacks.reconsider = callbacks->reconsider;
|
sess->callbacks.reconsider = callbacks->reconsider;
|
||||||
sess->reconsider_user_data = user_data;
|
sess->reconsider_user_data = user_data;
|
||||||
}
|
}
|
||||||
|
if (callbacks->request_key_unit) {
|
||||||
|
sess->callbacks.request_key_unit = callbacks->request_key_unit;
|
||||||
|
sess->request_key_unit_user_data = user_data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2042,6 +2046,25 @@ rtp_session_process_feedback (RTPSession * sess, GstRTCPPacket * packet,
|
||||||
if (src)
|
if (src)
|
||||||
rtp_source_retain_rtcp_packet (src, packet, arrival->running_time);
|
rtp_source_retain_rtcp_packet (src, packet, arrival->running_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rtp_source_get_ssrc (sess->source) == media_ssrc) {
|
||||||
|
switch (type) {
|
||||||
|
case GST_RTCP_TYPE_PSFB:
|
||||||
|
switch (fbtype) {
|
||||||
|
case GST_RTCP_PSFB_TYPE_PLI:
|
||||||
|
if (sess->callbacks.request_key_unit)
|
||||||
|
sess->callbacks.request_key_unit (sess, FALSE,
|
||||||
|
sess->request_key_unit_user_data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GST_RTCP_TYPE_RTPFB:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -120,6 +120,19 @@ typedef gint (*RTPSessionClockRate) (RTPSession *sess, guint8 payload, gpointer
|
||||||
*/
|
*/
|
||||||
typedef void (*RTPSessionReconsider) (RTPSession *sess, gpointer user_data);
|
typedef void (*RTPSessionReconsider) (RTPSession *sess, gpointer user_data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RTPSessionRequestKeyUnit:
|
||||||
|
* @sess: an #RTPSession
|
||||||
|
* @all_headers: %TRUE if "all-headers" property should be set on the key unit
|
||||||
|
* request
|
||||||
|
* @user_data: user data specified when registering
|
||||||
|
*
|
||||||
|
* Asks the encoder to produce a key unit as soon as possibly within the
|
||||||
|
* bandwidth constraints
|
||||||
|
*/
|
||||||
|
typedef void (*RTPSessionRequestKeyUnit) (RTPSession *sess,
|
||||||
|
gboolean all_headers, gpointer user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTPSessionCallbacks:
|
* RTPSessionCallbacks:
|
||||||
* @RTPSessionProcessRTP: callback to process RTP packets
|
* @RTPSessionProcessRTP: callback to process RTP packets
|
||||||
|
@ -127,6 +140,7 @@ typedef void (*RTPSessionReconsider) (RTPSession *sess, gpointer user_data);
|
||||||
* @RTPSessionSendRTCP: callback for sending RTCP packets
|
* @RTPSessionSendRTCP: callback for sending RTCP packets
|
||||||
* @RTPSessionSyncRTCP: callback for handling SR packets
|
* @RTPSessionSyncRTCP: callback for handling SR packets
|
||||||
* @RTPSessionReconsider: callback for reconsidering the timeout
|
* @RTPSessionReconsider: callback for reconsidering the timeout
|
||||||
|
* @RTPSessionRequestKeyUnit: callback for requesting a new key unit
|
||||||
*
|
*
|
||||||
* These callbacks can be installed on the session manager to get notification
|
* These callbacks can be installed on the session manager to get notification
|
||||||
* when RTP and RTCP packets are ready for further processing. These callbacks
|
* when RTP and RTCP packets are ready for further processing. These callbacks
|
||||||
|
@ -139,6 +153,7 @@ typedef struct {
|
||||||
RTPSessionSendRTCP send_rtcp;
|
RTPSessionSendRTCP send_rtcp;
|
||||||
RTPSessionClockRate clock_rate;
|
RTPSessionClockRate clock_rate;
|
||||||
RTPSessionReconsider reconsider;
|
RTPSessionReconsider reconsider;
|
||||||
|
RTPSessionRequestKeyUnit request_key_unit;
|
||||||
} RTPSessionCallbacks;
|
} RTPSessionCallbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,6 +212,7 @@ struct _RTPSession {
|
||||||
gpointer sync_rtcp_user_data;
|
gpointer sync_rtcp_user_data;
|
||||||
gpointer clock_rate_user_data;
|
gpointer clock_rate_user_data;
|
||||||
gpointer reconsider_user_data;
|
gpointer reconsider_user_data;
|
||||||
|
gpointer request_key_unit_user_data;
|
||||||
|
|
||||||
RTPSessionStats stats;
|
RTPSessionStats stats;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue