libnice has been designed to nice integrate with GStreamer, two GStreamer element are provided "nicesrc" and "nicesink" to help with that.

libnice works with both GStreamer 0.10 and GStreamer 1.x

Steps

  • Create a ?NiceAgent
  • Create a stream with nice_add_agent
  • Create a nicesrc for each component
  • Set the ?NiceAgent, stream id and compoenent id on each nicesrc
  • Put the nicesrc elements inside a ?GstPipeline and connect them to the elements that will receive the packets, most likely rtpbin
  • Set the ?GstPipeline to the PLAYING state
  • libnice can now receive packets.
  • Use the ?NiceAgent API to gather candidates and establish connectivity, be aware that as soon as connectivity is established (component state is CONNECTED), nicesrc may start producing data packets

At any time after the Nice Stream has been created, you can create nicesink elements and add them to your pipeline to send packets, you can do that at the same time as the nicesrc elements or later.