mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
session: make method to suggest available SSRC
Make a method to suggest the best available SSRC. This is the SSRC of the last created internal source and is used to instruct upstream to produce this SSRC.
This commit is contained in:
parent
33ce50e8b1
commit
c06482a2cb
3 changed files with 30 additions and 2 deletions
|
@ -1762,6 +1762,7 @@ gst_rtp_session_event_send_rtp_sink (GstPad * pad, GstObject * parent,
|
|||
* because we stop sending. */
|
||||
ret = gst_pad_push_event (rtpsession->send_rtp_src, event);
|
||||
current_time = gst_clock_get_time (rtpsession->priv->sysclock);
|
||||
|
||||
GST_DEBUG_OBJECT (rtpsession, "scheduling BYE message");
|
||||
rtp_session_mark_all_bye (rtpsession->priv->session, "End Of Stream");
|
||||
rtp_session_schedule_bye (rtpsession->priv->session, current_time);
|
||||
|
@ -1826,7 +1827,7 @@ gst_rtp_session_getcaps_send_rtp (GstPad * pad, GstRtpSession * rtpsession,
|
|||
|
||||
priv = rtpsession->priv;
|
||||
|
||||
ssrc = rtp_session_get_internal_ssrc (priv->session);
|
||||
ssrc = rtp_session_suggest_ssrc (priv->session);
|
||||
|
||||
/* we can basically accept anything but we prefer to receive packets with our
|
||||
* internal SSRC so that we don't have to patch it. Create a structure with
|
||||
|
|
|
@ -1297,8 +1297,11 @@ add_source (RTPSession * sess, RTPSource * src)
|
|||
sess->total_sources++;
|
||||
if (RTP_SOURCE_IS_ACTIVE (src))
|
||||
sess->stats.active_sources++;
|
||||
if (src->internal)
|
||||
if (src->internal) {
|
||||
sess->stats.internal_sources++;
|
||||
if (sess->suggested_ssrc != src->ssrc)
|
||||
sess->suggested_ssrc = src->ssrc;
|
||||
}
|
||||
}
|
||||
|
||||
/* must be called with the session lock, the returned source needs to be
|
||||
|
@ -1457,6 +1460,28 @@ rtp_session_get_internal_ssrc (RTPSession * sess)
|
|||
return ssrc;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtp_session_suggest_ssrc:
|
||||
* @sess: a #RTPSession
|
||||
*
|
||||
* Suggest an unused SSRC in @sess.
|
||||
*
|
||||
* Returns: a free unused SSRC
|
||||
*/
|
||||
guint32
|
||||
rtp_session_suggest_ssrc (RTPSession * sess)
|
||||
{
|
||||
guint32 result;
|
||||
|
||||
g_return_val_if_fail (RTP_IS_SESSION (sess), 0);
|
||||
|
||||
RTP_SESSION_LOCK (sess);
|
||||
result = sess->suggested_ssrc;
|
||||
RTP_SESSION_UNLOCK (sess);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* rtp_session_add_source:
|
||||
* @sess: a #RTPSession
|
||||
|
|
|
@ -199,6 +199,7 @@ struct _RTPSession {
|
|||
guint rtcp_rs_bandwidth;
|
||||
|
||||
RTPSource *source;
|
||||
guint32 suggested_ssrc;
|
||||
|
||||
/* for sender/receiver counting */
|
||||
guint32 key;
|
||||
|
@ -310,6 +311,7 @@ RTPSource* rtp_session_get_internal_source (RTPSession *sess);
|
|||
|
||||
void rtp_session_set_internal_ssrc (RTPSession *sess, guint32 ssrc);
|
||||
guint32 rtp_session_get_internal_ssrc (RTPSession *sess);
|
||||
guint32 rtp_session_suggest_ssrc (RTPSession *sess);
|
||||
|
||||
gboolean rtp_session_add_source (RTPSession *sess, RTPSource *src);
|
||||
guint rtp_session_get_num_sources (RTPSession *sess);
|
||||
|
|
Loading…
Reference in a new issue