[farsight2/master] Invalidate the substream
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:08 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 26 ++++++++++++++++++++++----
gst/fsrtpconference/fs-rtp-stream.c | 26 ++++++++++++++++++++++++++
gst/fsrtpconference/fs-rtp-stream.h | 6 ++++++
3 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index aefcdc2..71410ca 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -1353,15 +1353,32 @@ fs_rtp_session_get_stream_by_ssrc_locked (FsRtpSession *self,
/**
* fs_rtp_session_invalidate_pt:
* @session: A #FsRtpSession
- * @pt: the payload type number
+ * @pt: the PT to invalidate
+ * @codec: the new codec
*
* Invalidates all codec bins for the selected payload type, because its
* definition has changed
*/
static void
-fs_rtp_session_invalidate_pt (FsRtpSession *session, guint pt)
+fs_rtp_session_invalidate_pt (FsRtpSession *session, gint pt,
+ const FsCodec *codec)
{
+ GList *item;
+ FS_RTP_SESSION_LOCK (session);
+
+ for (item = g_list_first (session->priv->free_substreams);
+ item;
+ item = g_list_next (item))
+ fs_rtp_sub_stream_invalidate_codec_locked (item->data, pt, codec);
+
+
+ for (item = g_list_first (session->priv->streams);
+ item;
+ item = g_list_next (item))
+ fs_rtp_stream_invalidate_codec_locked (item->data, pt, codec);
+
+ FS_RTP_SESSION_UNLOCK (session);
}
static gboolean
@@ -1432,14 +1449,15 @@ fs_rtp_session_negotiate_codecs (FsRtpSession *session, GList *remote_codecs,
continue;
if (old_codec_association == NULL || new_codec_association == NULL) {
- fs_rtp_session_invalidate_pt (session, pt);
+ fs_rtp_session_invalidate_pt (session, pt, NULL);
clear_pts = TRUE;
continue;
}
if (!fs_codec_are_equal (old_codec_association->codec,
new_codec_association->codec)) {
- fs_rtp_session_invalidate_pt (session, pt);
+ fs_rtp_session_invalidate_pt (session, pt,
+ new_codec_association->codec);
clear_pts = TRUE;
continue;
}
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index 391c2e1..cacdcbb 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -596,3 +596,29 @@ fs_rtp_stream_knows_ssrc_locked (FsRtpStream *stream, guint32 ssrc)
return FALSE;
}
+
+/**
+ * fs_rtp_stream_invalidate_codec_locked:
+ * @stream: A #FsRtpStream
+ * @pt: The payload type to invalidate (does nothing if it does not match)
+ * @codec: The new fscodec (the substream is invalidated if it not using this
+ * codec). You can pass NULL to match any codec.
+ *
+ * This function will start the process that invalidates the codec
+ * for this rtpbin, if it doesnt match the passed codec
+ *
+ * You must hold the session lock to call it.
+ */
+
+void
+fs_rtp_stream_invalidate_codec_locked (FsRtpStream *stream,
+ gint pt,
+ const FsCodec *codec)
+{
+ GList *item;
+
+ for (item = g_list_first (stream->priv->substreams);
+ item;
+ item = g_list_next (item))
+ fs_rtp_sub_stream_invalidate_codec_locked (item->data, pt, codec);
+}
diff --git a/gst/fsrtpconference/fs-rtp-stream.h b/gst/fsrtpconference/fs-rtp-stream.h
index 7534563..1a2af74 100644
--- a/gst/fsrtpconference/fs-rtp-stream.h
+++ b/gst/fsrtpconference/fs-rtp-stream.h
@@ -84,6 +84,12 @@ gboolean fs_rtp_stream_add_substream (FsRtpStream *stream,
gboolean fs_rtp_stream_knows_ssrc_locked (FsRtpStream *stream,
guint32 ssrc);
+void fs_rtp_stream_invalidate_codec_locked (FsRtpStream *stream,
+ gint pt,
+ const FsCodec *codec);
+
+
+
G_END_DECLS
--
1.5.6.5
More information about the farsight-commits
mailing list