[farsight2/master] Use substream codec member directly
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 16 14:15:07 PST 2008
---
gst/fsrtpconference/fs-rtp-session.c | 25 ++++---------------
gst/fsrtpconference/fs-rtp-stream.c | 45 ++++++++++------------------------
2 files changed, 18 insertions(+), 52 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-session.c b/gst/fsrtpconference/fs-rtp-session.c
index 1557d19..19d44d7 100644
--- a/gst/fsrtpconference/fs-rtp-session.c
+++ b/gst/fsrtpconference/fs-rtp-session.c
@@ -2718,42 +2718,27 @@ fs_rtp_session_substream_set_codec_bin_locked (FsRtpSession *session,
guint pt,
GError **error)
{
- gboolean ret = FALSE;
GstElement *codecbin = NULL;
gchar *name;
- FsCodec *current_codec = NULL;
CodecAssociation *ca = NULL;
ca = fs_rtp_session_get_recv_codec_locked (session, pt, stream, error);
if (!ca)
- goto out;
-
- g_object_get (substream,
- "codec", ¤t_codec,
- NULL);
+ return FALSE;
- if (fs_codec_are_equal (ca->codec, current_codec))
- {
- ret = TRUE;
- goto out;
- }
+ if (fs_codec_are_equal (ca->codec, substream->codec))
+ return TRUE;
name = g_strdup_printf ("recv_%d_%u_%d", session->id, ssrc, pt);
codecbin = _create_codec_bin (ca, ca->codec, name, FALSE, NULL, error);
g_free (name);
if (!codecbin)
- goto out;
+ return FALSE;
- ret = fs_rtp_sub_stream_set_codecbin_locked (substream, ca->codec, codecbin,
+ return fs_rtp_sub_stream_set_codecbin_locked (substream, ca->codec, codecbin,
error);
-
- out:
-
- fs_codec_destroy (current_codec);
-
- return ret;
}
diff --git a/gst/fsrtpconference/fs-rtp-stream.c b/gst/fsrtpconference/fs-rtp-stream.c
index c08adf6..94e33eb 100644
--- a/gst/fsrtpconference/fs-rtp-stream.c
+++ b/gst/fsrtpconference/fs-rtp-stream.c
@@ -318,15 +318,13 @@ fs_rtp_stream_get_property (GObject *object,
substream_item;
substream_item = g_list_next (substream_item))
{
- FsCodec *codec = NULL;
- g_object_get (substream_item->data, "codec", &codec, NULL);
+ FsRtpSubStream *substream = substream_item->data;
- if (codec)
+ if (substream->codec)
{
- if (!_codec_list_has_codec (codeclist, codec))
- codeclist = g_list_append (codeclist, codec);
- else
- fs_codec_destroy (codec);
+ if (!_codec_list_has_codec (codeclist, substream->codec))
+ codeclist = g_list_append (codeclist,
+ fs_codec_copy (substream->codec));
}
}
@@ -755,7 +753,6 @@ fs_rtp_stream_add_substream_locked (FsRtpStream *stream,
FsRtpSubStream *substream,
GError **error)
{
- FsCodec *codec = NULL;
gboolean ret = TRUE;
stream->substreams = g_list_prepend (stream->substreams,
@@ -772,13 +769,9 @@ fs_rtp_stream_add_substream_locked (FsRtpStream *stream,
g_signal_connect (substream, "error",
G_CALLBACK (_substream_error), stream);
- g_object_get (substream, "codec", &codec, NULL);
-
/* Only announce a pad if it has a codec attached to it */
- if (codec) {
+ if (substream->codec)
ret = fs_rtp_sub_stream_add_output_ghostpad_locked (substream, error);
- fs_codec_destroy (codec);
- }
return ret;
}
@@ -798,20 +791,17 @@ _substream_codec_changed (FsRtpSubStream *substream,
FsRtpStream *stream)
{
GList *substream_item = NULL;
- FsCodec *codec = NULL;
GList *codeclist = NULL;
FS_RTP_SESSION_LOCK (stream->priv->session);
- g_object_get (substream, "codec", &codec, NULL);
-
- if (!codec)
+ if (!substream->codec)
{
FS_RTP_SESSION_UNLOCK (stream->priv->session);
return;
}
- codeclist = g_list_prepend (NULL, codec);
+ codeclist = g_list_prepend (NULL, fs_codec_copy (substream->codec));
for (substream_item = stream->substreams;
substream_item;
@@ -821,23 +811,14 @@ _substream_codec_changed (FsRtpSubStream *substream,
if (othersubstream != substream)
{
- FsCodec *othercodec = NULL;
-
- g_object_get (othersubstream, "codec", &othercodec, NULL);
-
- if (othercodec)
+ if (othersubstream->codec)
{
- if (fs_codec_are_equal (codec, othercodec))
- {
- fs_codec_destroy (othercodec);
+ if (fs_codec_are_equal (substream->codec, othersubstream->codec))
break;
- }
-
- if (!_codec_list_has_codec (codeclist, othercodec))
- codeclist = g_list_append (codeclist, othercodec);
- else
- fs_codec_destroy (othercodec);
+ if (!_codec_list_has_codec (codeclist, othersubstream->codec))
+ codeclist = g_list_append (codeclist,
+ fs_codec_copy (othersubstream->codec));
}
}
}
--
1.5.6.5
More information about the farsight-commits
mailing list