mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
rtpsession: Use the right hashtable to calculate bandwidth
Don't use an unused hashtable to iterate source to calculate bandwidth. Remove unused code.
This commit is contained in:
parent
5cd9776aa8
commit
51c9f7989f
2 changed files with 2 additions and 33 deletions
|
@ -471,7 +471,6 @@ rtp_session_init (RTPSession * sess)
|
||||||
g_hash_table_new_full (NULL, NULL, NULL,
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
(GDestroyNotify) g_object_unref);
|
(GDestroyNotify) g_object_unref);
|
||||||
}
|
}
|
||||||
sess->cnames = g_hash_table_new_full (NULL, NULL, g_free, NULL);
|
|
||||||
|
|
||||||
rtp_stats_init_defaults (&sess->stats);
|
rtp_stats_init_defaults (&sess->stats);
|
||||||
|
|
||||||
|
@ -540,7 +539,6 @@ rtp_session_finalize (GObject * object)
|
||||||
|
|
||||||
g_free (sess->bye_reason);
|
g_free (sess->bye_reason);
|
||||||
|
|
||||||
g_hash_table_destroy (sess->cnames);
|
|
||||||
g_object_unref (sess->source);
|
g_object_unref (sess->source);
|
||||||
|
|
||||||
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
G_OBJECT_CLASS (rtp_session_parent_class)->finalize (object);
|
||||||
|
@ -1560,33 +1558,6 @@ rtp_session_get_source_by_ssrc (RTPSession * sess, guint32 ssrc)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* rtp_session_get_source_by_cname:
|
|
||||||
* @sess: a #RTPSession
|
|
||||||
* @cname: an CNAME
|
|
||||||
*
|
|
||||||
* Find the source with @cname in @sess.
|
|
||||||
*
|
|
||||||
* Returns: a #RTPSource with CNAME @cname or NULL if the source was not found.
|
|
||||||
* g_object_unref() after usage.
|
|
||||||
*/
|
|
||||||
RTPSource *
|
|
||||||
rtp_session_get_source_by_cname (RTPSession * sess, const gchar * cname)
|
|
||||||
{
|
|
||||||
RTPSource *result;
|
|
||||||
|
|
||||||
g_return_val_if_fail (RTP_IS_SESSION (sess), NULL);
|
|
||||||
g_return_val_if_fail (cname != NULL, NULL);
|
|
||||||
|
|
||||||
RTP_SESSION_LOCK (sess);
|
|
||||||
result = g_hash_table_lookup (sess->cnames, cname);
|
|
||||||
if (result)
|
|
||||||
g_object_ref (result);
|
|
||||||
RTP_SESSION_UNLOCK (sess);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* should be called with the SESSION lock */
|
/* should be called with the SESSION lock */
|
||||||
static guint32
|
static guint32
|
||||||
rtp_session_create_new_ssrc (RTPSession * sess)
|
rtp_session_create_new_ssrc (RTPSession * sess)
|
||||||
|
@ -2523,7 +2494,8 @@ calculate_rtcp_interval (RTPSession * sess, gboolean deterministic,
|
||||||
/* If it is <= 0, then try to estimate the actual bandwidth */
|
/* If it is <= 0, then try to estimate the actual bandwidth */
|
||||||
bandwidth = sess->source->bitrate;
|
bandwidth = sess->source->bitrate;
|
||||||
|
|
||||||
g_hash_table_foreach (sess->cnames, (GHFunc) add_bitrates, &bandwidth);
|
g_hash_table_foreach (sess->ssrcs[sess->mask_idx],
|
||||||
|
(GHFunc) add_bitrates, &bandwidth);
|
||||||
bandwidth /= 8.0;
|
bandwidth /= 8.0;
|
||||||
}
|
}
|
||||||
if (bandwidth < 8000)
|
if (bandwidth < 8000)
|
||||||
|
|
|
@ -172,7 +172,6 @@ typedef struct {
|
||||||
* @lock: lock to protect the session
|
* @lock: lock to protect the session
|
||||||
* @source: the source of this session
|
* @source: the source of this session
|
||||||
* @ssrcs: Hashtable of sources indexed by SSRC
|
* @ssrcs: Hashtable of sources indexed by SSRC
|
||||||
* @cnames: Hashtable of sources indexed by CNAME
|
|
||||||
* @num_sources: the number of sources
|
* @num_sources: the number of sources
|
||||||
* @activecount: the number of active sources
|
* @activecount: the number of active sources
|
||||||
* @callbacks: callbacks
|
* @callbacks: callbacks
|
||||||
|
@ -205,7 +204,6 @@ struct _RTPSession {
|
||||||
guint32 mask_idx;
|
guint32 mask_idx;
|
||||||
guint32 mask;
|
guint32 mask;
|
||||||
GHashTable *ssrcs[32];
|
GHashTable *ssrcs[32];
|
||||||
GHashTable *cnames;
|
|
||||||
guint total_sources;
|
guint total_sources;
|
||||||
|
|
||||||
GstClockTime next_rtcp_check_time;
|
GstClockTime next_rtcp_check_time;
|
||||||
|
@ -321,7 +319,6 @@ gboolean rtp_session_add_source (RTPSession *sess, RTPSource
|
||||||
guint rtp_session_get_num_sources (RTPSession *sess);
|
guint rtp_session_get_num_sources (RTPSession *sess);
|
||||||
guint rtp_session_get_num_active_sources (RTPSession *sess);
|
guint rtp_session_get_num_active_sources (RTPSession *sess);
|
||||||
RTPSource* rtp_session_get_source_by_ssrc (RTPSession *sess, guint32 ssrc);
|
RTPSource* rtp_session_get_source_by_ssrc (RTPSession *sess, guint32 ssrc);
|
||||||
RTPSource* rtp_session_get_source_by_cname (RTPSession *sess, const gchar *cname);
|
|
||||||
RTPSource* rtp_session_create_source (RTPSession *sess);
|
RTPSource* rtp_session_create_source (RTPSession *sess);
|
||||||
|
|
||||||
/* processing packets from receivers */
|
/* processing packets from receivers */
|
||||||
|
|
Loading…
Reference in a new issue