Skip to main content

Module director

Module director 

Source
Expand description

Receiver media policy: decides which audio and which video encoding each receiver gets within its bandwidth and when to decide again.

Director reads committed room facts, worker observations (active speakers, receiver bandwidth and source bitrate) and the time. It decides audio admission, the encoding each video route forwards, route pauses, receiver BWE targets, the room’s featured user and the next decision deadline. It never changes membership or publications, never creates or removes routes and never handles packets.

Director owns the values it decides into. Room records embed them and hand &mut to Director, which alone changes their fields: RouteAllocation per consumer, ReceiverAllocation per receiver and PendingUpgrade per committed consumer.

A SourcePolicyTurn runs in workflow order:

capture  room facts and observations, under the read guard
planner  pure: facts and time in, allocations and wakeups out
turn     transport controls, after the guard is released
commit   accepted allocations, under the write lock

Turns serialize with publication activity so their transport effects cannot overtake each other. Gate and activity controls must be accepted before the matching allocation commits. Each turn replaces or cancels its earliest receiver-pressure or exact-target upgrade deadline.

ModulesΒ§

action πŸ”’
Records turn execution derives from a plan. Each carries the room identity that its commit checks again after the transport await.
allocation πŸ”’
Values Director decides into. Room records embed them and hand &mut to Director, so their fields change only here.
capture πŸ”’
Planner facts a policy turn captures under the room read guard.
commit πŸ”’
Commits a policy turn under the room write lock after its transport controls settled.
layout πŸ”’
Layout roles Director gives Room between policy turns.
planner πŸ”’
Pure receiver policy: facts and time in, allocations and wakeups out.
turn πŸ”’
Policy turn execution: capture facts under the read guard, plan, apply transport controls without the lock and commit what transport accepted.