mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
session: keep SDES and set on new internal sources
Keep track of the SDES ourselves and set it on all newly created internal sources.
This commit is contained in:
parent
5652f02b76
commit
33ce50e8b1
2 changed files with 13 additions and 12 deletions
|
@ -463,7 +463,6 @@ rtp_session_init (RTPSession * sess)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
GstStructure *sdes;
|
|
||||||
guint32 ssrc;
|
guint32 ssrc;
|
||||||
gboolean created;
|
gboolean created;
|
||||||
|
|
||||||
|
@ -496,11 +495,11 @@ rtp_session_init (RTPSession * sess)
|
||||||
sess->probation = DEFAULT_PROBATION;
|
sess->probation = DEFAULT_PROBATION;
|
||||||
|
|
||||||
/* some default SDES entries */
|
/* some default SDES entries */
|
||||||
sdes = gst_structure_new_empty ("application/x-rtp-source-sdes");
|
sess->sdes = gst_structure_new_empty ("application/x-rtp-source-sdes");
|
||||||
|
|
||||||
/* we do not want to leak details like the username or hostname here */
|
/* we do not want to leak details like the username or hostname here */
|
||||||
str = g_strdup_printf ("user%u@host-%x", g_random_int (), g_random_int ());
|
str = g_strdup_printf ("user%u@host-%x", g_random_int (), g_random_int ());
|
||||||
gst_structure_set (sdes, "cname", G_TYPE_STRING, str, NULL);
|
gst_structure_set (sess->sdes, "cname", G_TYPE_STRING, str, NULL);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -510,13 +509,11 @@ rtp_session_init (RTPSession * sess)
|
||||||
g_free (str);
|
g_free (str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gst_structure_set (sdes, "tool", G_TYPE_STRING, "GStreamer", NULL);
|
gst_structure_set (sess->sdes, "tool", G_TYPE_STRING, "GStreamer", NULL);
|
||||||
|
|
||||||
/* create an active SSRC for this session manager */
|
/* create an active SSRC for this session manager */
|
||||||
ssrc = rtp_session_create_new_ssrc (sess);
|
ssrc = rtp_session_create_new_ssrc (sess);
|
||||||
sess->source = obtain_internal_source (sess, ssrc, &created);
|
sess->source = obtain_internal_source (sess, ssrc, &created);
|
||||||
/* and configure sdes in the source */
|
|
||||||
rtp_source_set_sdes_struct (sess->source, sdes);
|
|
||||||
|
|
||||||
sess->first_rtcp = TRUE;
|
sess->first_rtcp = TRUE;
|
||||||
sess->next_rtcp_check_time = GST_CLOCK_TIME_NONE;
|
sess->next_rtcp_check_time = GST_CLOCK_TIME_NONE;
|
||||||
|
@ -538,12 +535,13 @@ rtp_session_finalize (GObject * object)
|
||||||
|
|
||||||
sess = RTP_SESSION_CAST (object);
|
sess = RTP_SESSION_CAST (object);
|
||||||
|
|
||||||
g_mutex_clear (&sess->lock);
|
gst_structure_free (sess->sdes);
|
||||||
|
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
g_hash_table_destroy (sess->ssrcs[i]);
|
g_hash_table_destroy (sess->ssrcs[i]);
|
||||||
|
|
||||||
g_object_unref (sess->source);
|
g_object_unref (sess->source);
|
||||||
|
g_mutex_clear (&sess->lock);
|
||||||
|
|
||||||
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -1083,15 +1081,13 @@ rtp_session_get_rtcp_fraction (RTPSession * sess)
|
||||||
GstStructure *
|
GstStructure *
|
||||||
rtp_session_get_sdes_struct (RTPSession * sess)
|
rtp_session_get_sdes_struct (RTPSession * sess)
|
||||||
{
|
{
|
||||||
const GstStructure *sdes;
|
|
||||||
GstStructure *result = NULL;
|
GstStructure *result = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
|
g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
|
||||||
|
|
||||||
RTP_SESSION_LOCK (sess);
|
RTP_SESSION_LOCK (sess);
|
||||||
sdes = rtp_source_get_sdes_struct (sess->source);
|
if (sess->sdes)
|
||||||
if (sdes)
|
result = gst_structure_copy (sess->sdes);
|
||||||
result = gst_structure_copy (sdes);
|
|
||||||
RTP_SESSION_UNLOCK (sess);
|
RTP_SESSION_UNLOCK (sess);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1111,7 +1107,9 @@ rtp_session_set_sdes_struct (RTPSession * sess, const GstStructure * sdes)
|
||||||
g_return_if_fail (RTP_IS_SESSION (sess));
|
g_return_if_fail (RTP_IS_SESSION (sess));
|
||||||
|
|
||||||
RTP_SESSION_LOCK (sess);
|
RTP_SESSION_LOCK (sess);
|
||||||
rtp_source_set_sdes_struct (sess->source, gst_structure_copy (sdes));
|
if (sess->sdes)
|
||||||
|
gst_structure_free (sess->sdes);
|
||||||
|
sess->sdes = gst_structure_copy (sdes);
|
||||||
RTP_SESSION_UNLOCK (sess);
|
RTP_SESSION_UNLOCK (sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,6 +1373,7 @@ obtain_internal_source (RTPSession * sess, guint32 ssrc, gboolean * created)
|
||||||
|
|
||||||
source->validated = TRUE;
|
source->validated = TRUE;
|
||||||
source->internal = TRUE;
|
source->internal = TRUE;
|
||||||
|
rtp_source_set_sdes_struct (source, gst_structure_copy (sess->sdes));
|
||||||
rtp_source_set_callbacks (source, &callbacks, sess);
|
rtp_source_set_callbacks (source, &callbacks, sess);
|
||||||
|
|
||||||
add_source (sess, source);
|
add_source (sess, source);
|
||||||
|
|
|
@ -187,6 +187,8 @@ struct _RTPSession {
|
||||||
guint header_len;
|
guint header_len;
|
||||||
guint mtu;
|
guint mtu;
|
||||||
|
|
||||||
|
GstStructure *sdes;
|
||||||
|
|
||||||
guint probation;
|
guint probation;
|
||||||
|
|
||||||
/* bandwidths */
|
/* bandwidths */
|
||||||
|
|
Loading…
Reference in a new issue