reactor::Track is a handle onto one named media slot the model declared — not something you
construct yourself. Ask for it by name with
client.track(name), or find it by filtering
client.tracks() when you don’t know the name:
push_video_frame / push_audio_frame split and no on_video_frame /
on_audio_frame split at the class level. Video and audio share push_frame() and on_frame(),
and the overload has to match the track’s kind.
A handle, not an owner: it holds the client weakly, so a track parked in a capture thread
cannot keep the session — and the native handle — alive for the life of that thread. Using one
after the client is gone throws
InvalidStateError.Properties
name()
Signature
kind()
Signature
TrackKind::Video or TrackKind::Audio, or empty before the session has declared its tracks.
direction()
Signature
TrackDirection::SendOnly or TrackDirection::RecvOnly, or empty before the session has declared
them. SendOnly is from this client’s point of view: this client sends, the model receives.
mid()
Signature
paused()
Signature
Track holding a stale
true would go on claiming otherwise.
published()
Signature
publish is a control request and unpublish a notification, and neither
leaves anything to query.
It is cleared whenever the status leaves
Ready. A reconnect resumes recvonly tracks and
nothing else, so a slot published before one is not published after it — publish again. See
reconnect().Sending
publish()
Activates this sendonly slot, so the model has something to receive on.
Signature
Ready.
Example
unpublish()
Deactivates the slot. Synchronous, unlike the other track methods — there is no round trip, only a
local state change and a fire-and-forget notification.
Signature
push_frame()
Pushes a frame into this sendonly track. Choose the tab matching kind()
to see the complete signature and arguments for that track.
- Video
- Audio
For
TrackKind::Video.Signature
Example
InvalidStateError if the arguments do not match the track’s kind, on a recvonly track,
before publish(), or once the session has left Ready. Invalid video buffer dimensions,
an empty PCM buffer, an unsupported sample rate or channel count, or a PCM sample count that does
not divide evenly by channels throw BadRequestError.
FrameOptions
Definition
Example
set_bitrate()
Bounds what this one sender may spend, in bits per second.
Signature
Definition
Example
Reactor::set_bitrate() is the other ceiling — the whole
connection’s budget. The two are conjunctive, so raising only one changes nothing.A ceiling is permission, not a target: the encoder still spends only what the congestion controller
allocated and what the picture needs. What raising it buys is headroom for the moments that would
otherwise clip.Ready.
Receiving
on_frame()
Registers one handler for decoded frames from this recvonly track. The argument is always
handler; kind() determines the frame type it receives.
- Video
- Audio
For
TrackKind::Video.Signature
Example
InvalidStateError on a sendonly track or if the handler’s frame type does not match the
track’s kind.
VideoFrame
Definition
The handler runs inline on the library’s delivery thread, deliberately. Blocking in it is the
backpressure: while it runs, the library keeps only the newest frame and drops the ones in between.
Handing frames to a queue of your own trades a bounded drop for unbounded latency and memory.This is why media handlers do not go through
Options::executor, and control-event handlers do.AudioFrame
Definition
VideoFrame. The audio queue is short and keeps its backlog rather
than dropping, because there the queue is the jitter buffer and a hole in it is audible — so a slow
handler here costs latency instead of frames.
frames() is samples per channel, which is what a playback device asks for.
Pausing
pause()
Signature
InvalidStateError on a sendonly track, audio or video: pausing controls
what you receive, and nothing here can stop the far end from sending.
resume()
Signature
pause() does.
TrackList
The tracks a session declared, filterable — for discovery, and for a caller who would rather not
hardcode a name. Returned by client.tracks().
Signature
Filters chain in either order, and it iterates:
Example
one() throws NotFoundError when the list is empty and InvalidStateError when it holds more
than one — a filter that matched several and a caller that wanted one is a question with no answer,
and picking the first would answer it wrongly and silently.
TrackKind and TrackDirection
Definition
Signature
The parsers return empty for a value this build does not recognise, rather than guessing.