static void _negotiated_codecs_notify (GObject *object, GParamSpec *paramspec, gpointer user_data) { struct SimpleTestConference *dat = user_data; FsSession *session = FS_SESSION (object); GList *codecs = NULL; GError *error = NULL; GList *item = NULL; g_debug ("%d: New negotiated codecs", dat->id); ts_fail_if (session != dat->session, "Got signal from the wrong object"); g_object_get (dat->session, "codecs", &codecs, NULL); ts_fail_if (codecs == NULL, "Could not get the negotiated codecs"); /* We have to find the stream from the target that points back to us */ for (item = g_list_first (dat->streams); item; item = g_list_next (item)) { struct SimpleTestStream *st = item->data; struct SimpleTestStream *st2 = find_pointback_stream (st->target, dat); GList *rcodecs2; g_debug ("Setting negotiated remote codecs on %d:%d from %d",st2->dat->id, st2->target->id, dat->id); if (!fs_stream_set_remote_codecs (st2->stream, codecs, &error)) { if (error) ts_fail ("Could not set the remote codecs on stream %d:%d (%d): %s", st2->dat->id, st2->target->id, error->code, error->message); else ts_fail ("Could not set the remote codecs on stream %d:%d" " and we DID not get a GError!!", st2->dat->id, st2->target->id); } g_object_get (st2->stream, "remote-codecs", &rcodecs2, NULL); ts_fail_unless (_compare_codec_lists (rcodecs2, codecs), "Can not get remote codecs correctly"); fs_codec_list_destroy (rcodecs2); if (select_last_codec) ts_fail_unless ( fs_session_set_send_codec (st2->dat->session, g_list_last (codecs)->data, &error), "Error setting the send codec to the last codec: %s", error ? error->message : "No GError"); g_clear_error (&error); break; } fs_codec_list_destroy (codecs); }
static void _rtpbin_pad_blocked_callback (GstPad *pad, gboolean blocked, gpointer user_data) { FsRtpSubStream *substream = user_data; GError *error = NULL; GstElement *codecbin = NULL; FsCodec *codec = NULL; FsRtpSession *session; if (fs_rtp_session_has_disposed_enter (substream->priv->session, NULL)) { gst_pad_set_blocked_async (pad, FALSE, do_nothing_blocked_callback, NULL); return; } if (fs_rtp_sub_stream_has_stopped_enter (substream)) { gst_pad_set_blocked_async (pad, FALSE, do_nothing_blocked_callback, NULL); fs_rtp_session_has_disposed_exit (substream->priv->session); return; } g_object_ref (substream); session = g_object_ref (substream->priv->session); GST_DEBUG ("Substream blocked for codec change (session:%d SSRC:%x pt:%d)", substream->priv->session->id, substream->ssrc, substream->pt); gst_pad_set_blocked_async (pad, FALSE, do_nothing_blocked_callback, NULL); g_signal_emit (substream, signals[GET_CODEC_BIN], 0, substream->priv->stream, substream->codec, &codec, &error, &codecbin); if (error) goto error; if (codecbin) if (!fs_rtp_sub_stream_set_codecbin (substream, codec, codecbin, &error)) goto error; out: g_clear_error (&error); fs_rtp_sub_stream_has_stopped_exit (substream); fs_rtp_session_has_disposed_exit (substream->priv->session); g_object_unref (substream); g_object_unref (session); return; error: { gchar *str = g_strdup_printf ("Could not add the new recv codec bin for" " ssrc %u and payload type %d to the state NULL", substream->ssrc, substream->pt); if (substream->priv->stream) fs_stream_emit_error (FS_STREAM (substream->priv->stream), FS_ERROR_CONSTRUCTION, str, error->message); else fs_session_emit_error (FS_SESSION (substream->priv->session), FS_ERROR_CONSTRUCTION, str, error->message); g_free (str); } goto out; }