Commit 38a486b3 authored by Wim Taymans's avatar Wim Taymans

rtpsession: send reconfigure when internal-ssrc changes

When the internal-ssrc property changes, we want to send a reconfigure
upstream to make payloaders use the new suggested ssrc.
Using the internal-ssrc property to change the SSRC of a stream is not a
good idea and doesn't work when there are multiple senders, we want to
set the SSRC directly on the payloaders. Therefore, deprecate this
property.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=725361
parent 42cfedde
......@@ -274,6 +274,7 @@ static GstClockTime gst_rtp_session_request_time (RTPSession * session,
gpointer user_data);
static void gst_rtp_session_notify_nack (RTPSession * sess,
guint16 seqnum, guint16 blp, guint32 ssrc, gpointer user_data);
static void gst_rtp_session_reconfigure (RTPSession * sess, gpointer user_data);
static RTPSessionCallbacks callbacks = {
gst_rtp_session_process_rtp,
......@@ -284,7 +285,8 @@ static RTPSessionCallbacks callbacks = {
gst_rtp_session_reconsider,
gst_rtp_session_request_key_unit,
gst_rtp_session_request_time,
gst_rtp_session_notify_nack
gst_rtp_session_notify_nack,
gst_rtp_session_reconfigure
};
/* GObject vmethods */
......@@ -2476,3 +2478,20 @@ gst_rtp_session_notify_nack (RTPSession * sess, guint16 seqnum,
gst_object_unref (send_rtp_sink);
}
}
static void
gst_rtp_session_reconfigure (RTPSession * sess, gpointer user_data)
{
GstRtpSession *rtpsession = GST_RTP_SESSION (user_data);
GstPad *send_rtp_sink;
GST_RTP_SESSION_LOCK (rtpsession);
if ((send_rtp_sink = rtpsession->send_rtp_sink))
gst_object_ref (send_rtp_sink);
GST_RTP_SESSION_UNLOCK (rtpsession);
if (send_rtp_sink) {
gst_pad_push_event (send_rtp_sink, gst_event_new_reconfigure ());
gst_object_unref (send_rtp_sink);
}
}
......@@ -325,7 +325,7 @@ rtp_session_class_init (RTPSessionClass * klass)
g_object_class_install_property (gobject_class, PROP_INTERNAL_SSRC,
g_param_spec_uint ("internal-ssrc", "Internal SSRC",
"The internal SSRC used for the session",
"The internal SSRC used for the session (deprecated)",
0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_INTERNAL_SOURCE,
......@@ -610,6 +610,8 @@ rtp_session_set_property (GObject * object, guint prop_id,
RTP_SESSION_LOCK (sess);
sess->suggested_ssrc = g_value_get_uint (value);
RTP_SESSION_UNLOCK (sess);
if (sess->callbacks.reconfigure)
sess->callbacks.reconfigure (sess, sess->reconfigure_user_data);
break;
case PROP_BANDWIDTH:
RTP_SESSION_LOCK (sess);
......@@ -891,6 +893,10 @@ rtp_session_set_callbacks (RTPSession * sess, RTPSessionCallbacks * callbacks,
sess->callbacks.notify_nack = callbacks->notify_nack;
sess->notify_nack_user_data = user_data;
}
if (callbacks->reconfigure) {
sess->callbacks.reconfigure = callbacks->reconfigure;
sess->reconfigure_user_data = user_data;
}
}
/**
......
......@@ -155,6 +155,16 @@ typedef GstClockTime (*RTPSessionRequestTime) (RTPSession *sess,
typedef void (*RTPSessionNotifyNACK) (RTPSession *sess,
guint16 seqnum, guint16 blp, guint32 ssrc, gpointer user_data);
/**
* RTPSessionReconfigure:
* @sess: an #RTPSession
* @user_data: user data specified when registering
*
* This callback will be called when @sess wants to reconfigure the
* negotiated parameters.
*/
typedef void (*RTPSessionReconfigure) (RTPSession *sess, gpointer user_data);
/**
* RTPSessionCallbacks:
* @RTPSessionProcessRTP: callback to process RTP packets
......@@ -165,6 +175,7 @@ typedef void (*RTPSessionNotifyNACK) (RTPSession *sess,
* @RTPSessionRequestKeyUnit: callback for requesting a new key unit
* @RTPSessionRequestTime: callback for requesting the current time
* @RTPSessionNotifyNACK: callback for notifying NACK
* @RTPSessionReconfigure: callback for requesting reconfiguration
*
* These callbacks can be installed on the session manager to get notification
* when RTP and RTCP packets are ready for further processing. These callbacks
......@@ -180,6 +191,7 @@ typedef struct {
RTPSessionRequestKeyUnit request_key_unit;
RTPSessionRequestTime request_time;
RTPSessionNotifyNACK notify_nack;
RTPSessionReconfigure reconfigure;
} RTPSessionCallbacks;
/**
......@@ -244,6 +256,7 @@ struct _RTPSession {
gpointer request_key_unit_user_data;
gpointer request_time_user_data;
gpointer notify_nack_user_data;
gpointer reconfigure_user_data;
RTPSessionStats stats;
RTPSessionStats bye_stats;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment