예제 #1
0
static gboolean
kms_webrtc_session_add_connection (KmsWebrtcSession * self,
    KmsSdpSession * sess, SdpMediaConfig * mconf, gboolean offerer)
{
  KmsBaseRtpSession *base_rtp_sess = KMS_BASE_RTP_SESSION (sess);
  gboolean connected, active;
  KmsIRtpConnection *conn;

  conn = kms_base_rtp_session_get_connection (base_rtp_sess, mconf);
  if (conn == NULL) {
    GST_ERROR_OBJECT (self, "No connection created");
    return FALSE;
  }

  g_object_get (conn, "added", &connected, NULL);
  if (connected) {
    GST_DEBUG_OBJECT (self, "Conn already added");
    return TRUE;
  }

  active =
      sdp_utils_media_is_active (kms_sdp_media_config_get_sdp_media (mconf),
      offerer);

  kms_i_rtp_connection_add (conn, GST_BIN (self), active);
  kms_i_rtp_connection_sink_sync_state_with_parent (conn);
  kms_i_rtp_connection_src_sync_state_with_parent (conn);

  return TRUE;
}
예제 #2
0
static void
kms_base_rtp_session_add_bundle_connection (KmsBaseRtpSession * self,
    KmsIRtpConnection * conn, SdpMediaConfig * mconf, gboolean active)
{
  gboolean added;
  GstElement *ssrcdemux;
  GstElement *rtcpdemux;        /* FIXME: Useful for local and remote ssrcs mapping */
  GstPad *src, *sink;

  if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (conn),
              bundle_conn_added_quark ()))) {
    GST_DEBUG_OBJECT (self, "Connection configured");
    return;
  }

  g_object_set_qdata (G_OBJECT (conn), bundle_conn_added_quark (),
      GUINT_TO_POINTER (TRUE));

  g_object_get (conn, "added", &added, NULL);
  if (!added) {
    kms_i_rtp_connection_add (conn, GST_BIN (self), active);
  }

  ssrcdemux = gst_element_factory_make ("rtpssrcdemux", NULL);
  rtcpdemux = gst_element_factory_make ("rtcpdemux", NULL);

  g_object_set_qdata_full (G_OBJECT (ssrcdemux), rtcp_demux_peer_quark (),
      g_object_ref (rtcpdemux), g_object_unref);
  g_signal_connect (ssrcdemux, "new-ssrc-pad",
      G_CALLBACK (rtp_ssrc_demux_new_ssrc_pad), self);

  kms_i_rtp_connection_sink_sync_state_with_parent (conn);
  gst_bin_add_many (GST_BIN (self), ssrcdemux, rtcpdemux, NULL);

  /* RTP */
  src = kms_i_rtp_connection_request_rtp_src (conn);
  sink = gst_element_get_static_pad (ssrcdemux, "sink");
  kms_base_rtp_session_link_pads (src, sink);
  g_object_unref (src);
  g_object_unref (sink);

  /* RTCP */
  src = kms_i_rtp_connection_request_rtcp_src (conn);
  sink = gst_element_get_static_pad (rtcpdemux, "sink");
  kms_base_rtp_session_link_pads (src, sink);
  g_object_unref (src);
  g_object_unref (sink);
  gst_element_link_pads (rtcpdemux, "rtcp_src", ssrcdemux, "rtcp_sink");

  gst_element_sync_state_with_parent_target_state (ssrcdemux);
  gst_element_sync_state_with_parent_target_state (rtcpdemux);

  kms_i_rtp_connection_src_sync_state_with_parent (conn);
}
예제 #3
0
static void
kms_base_rtp_session_add_connection (KmsBaseRtpSession * self,
    KmsIRtpConnection * conn, SdpMediaConfig * mconf, gboolean active)
{
  kms_i_rtp_connection_add (conn, GST_BIN (self), active);
  kms_i_rtp_connection_sink_sync_state_with_parent (conn);

  kms_base_rtp_session_add_connection_sink (self, conn, mconf);
  kms_base_rtp_session_add_connection_src (self, conn, mconf);

  kms_i_rtp_connection_src_sync_state_with_parent (conn);
}
예제 #4
0
static void
kms_base_rtp_session_add_rtcp_mux_connection (KmsBaseRtpSession * self,
    KmsIRtpConnection * conn, SdpMediaConfig * mconf, gboolean active)
{
  /* FIXME: Useful for local and remote ssrcs mapping */
  GstElement *rtcpdemux = gst_element_factory_make ("rtcpdemux", NULL);
  GstPad *src, *sink;

  kms_i_rtp_connection_add (conn, GST_BIN (self), active);
  kms_i_rtp_connection_sink_sync_state_with_parent (conn);
  gst_bin_add (GST_BIN (self), rtcpdemux);

  /* RTP */
  src = kms_i_rtp_connection_request_rtp_src (conn);
  sink =
      kms_i_rtp_session_manager_request_rtp_sink (self->manager, self, mconf);
  kms_base_rtp_session_link_pads (src, sink);
  g_object_unref (src);
  g_object_unref (sink);

  /* RTCP */
  src = gst_element_get_static_pad (rtcpdemux, "rtcp_src");
  sink =
      kms_i_rtp_session_manager_request_rtcp_sink (self->manager, self, mconf);
  g_object_unref (src);
  g_object_unref (sink);

  src = kms_i_rtp_connection_request_rtcp_src (conn);
  sink = gst_element_get_static_pad (rtcpdemux, "sink");
  kms_base_rtp_session_link_pads (src, sink);
  g_object_unref (src);
  g_object_unref (sink);

  gst_element_sync_state_with_parent_target_state (rtcpdemux);
  kms_base_rtp_session_add_connection_sink (self, conn, mconf);

  kms_i_rtp_connection_src_sync_state_with_parent (conn);
}