Skip to content

Refactor gst src and sink plugins#29

Draft
SteveMcFarlin wants to merge 1 commit intomoq-dev:mainfrom
SteveMcFarlin:plugin_refactor
Draft

Refactor gst src and sink plugins#29
SteveMcFarlin wants to merge 1 commit intomoq-dev:mainfrom
SteveMcFarlin:plugin_refactor

Conversation

@SteveMcFarlin
Copy link

@SteveMcFarlin SteveMcFarlin commented Feb 19, 2026

Replace legacy MoqSrc with bridged async implementation

Replaces the old MoqSrc (src/source/imp.rs) with a non-blocking async bridge design.

Key changes

  • Removes RUNTIME.block_on during Ready → Paused
  • Introduces a SessionManager + control channel
  • Routes all control messages, buffers, and events through a GLib main-context forwarder
  • Ensures buffers are dispatched from the element thread (not Tokio worker threads)
  • Stores and aborts JoinHandles during Paused → Ready to prevent dangling tasks
  • Adds forwarder_delivers_messages_in_order unit test to verify ordered delivery across the async bridge

Result

  • Non-blocking state transitions
  • Correct thread ownership
  • Clean task lifecycle management
  • Deterministic async message forwarding

src/sink: TODO

Testing

TODO

The old imp.rs blocked Ready→Paused inside RUNTIME.block_on and
 tokio-spawned tasks pushed buffers straight from the runtime.
The new imp.rs spins a SessionManager + control channel so
state changes stay non-blocking and all control messages flow
through a GLib main-context forwarder. Pad creation now hands out
PadEndpoints backed by mpsc queues and a shared spawn_main_context_forwarder,
ensuring every buffer/event is dispatched from the element thread
instead of the Tokio worker that read it. Teardown code keeps the
JoinHandles for control/pad tasks and aborts them during Paused→Ready
preventing dangling background loops. Adds a small helper + unit test
(forwarder_delivers_messages_in_order) to prove the new channel
 bridge delivers messages sequentially
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments