Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gstreamer gstreamer
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 677
    • Issues 677
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 353
    • Merge requests 353
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gstreamergstreamer
  • Issues
  • #941

Closed
Open
Created Jan 05, 2022 by Ratchanan Srirattanamet@peat-psuwit

webrtcbin: ability to provide an external main context

Currently webrtcbin doesn't accept a main context and always run its own. It might be beneficial for a webrtcbin to be able to use another main context for an application that already have a main context.

Context: I'm developing a NodeJS library which implement JavaScript API of WebRTC using Gstreamer's webrtcbin, via node-gtk glib binding. JS requires that all code runs on main thread, including callbacks. So, when a cross-thread callback happens, node-gtk will post an event to the main (JS) context, and then block until the answer comes back. Which, for my current usecase at least, does work.

If webrtcbin accept a main context, this cross-thread callback can be avoided, as node-gtk supports the use of GLib main context. Webrtcbin can then post the events to this main context and have it run in the main thread, avoiding the cross-thread block.

BTW, I'm not sure if it is related, but I found this comment in gstwebrtcbin.c:

  /* Having the thread be the thread default GMainContext will break the
   * required queue-like ordering (from W3's peerconnection spec) of re-entrant
   * tasks */

Which may have implication on using main thread's context here. But to be honest I don't understand it well enough.

Assignee
Assign to
Time tracking