Skip to main content
The C SDK does neither capture nor encoding. The complete publishing pipeline is: you capture → you encode → feed raw data with rtc_write_sample → the SDK packetizes and sends. Standard flow:

rtc_create_local_track

Creates a local track and returns the track handle; returns NULL on failure. Whether the track is audio or video is determined by the codec; you don’t need to specify it separately.

rtc_destroy_local_track

Destroys a local track. A published track should be unpublished with rtc_unpublish_local_track before it’s destroyed. Starting with 0.0.11, it first removes the keyframe request callback and waits for any running keyframe callback to return before returning; after that you can safely free the context passed to rtc_set_keyframe_request_callback. In 0.0.10 and earlier, the keyframe callback may still fire after the track is destroyed.

rtc_publish_local_track

Publishes a local track to the channel. Publish options rtc_publish_options_t
If props fails to parse, the SDK only logs a warning and continues publishing as if there were no custom properties; it doesn’t fail the publish.
Returns

rtc_unpublish_local_track

Unpublishes. Return values are the same as above.

rtc_publish_mcu_video_track / rtc_publish_mcu_audio_track

Publishes the channel-level composite stream; see Composite stream (program).

rtc_write_sample

Pushes one frame of encoded data to a published track. Compute samples from each codec’s clock rate: Returns
The SDK copies the data you pass in, so you can reuse or free the data buffer as soon as the call returns.
The SDK doesn’t control send pacing—each frame is sent as soon as it’s written. When your data source is faster than real time (reading a file, TTS synthesis), you must write at the pace of the frame duration (for example, one audio packet every 20 ms). Otherwise several seconds of data go out in an instant, the remote jitter buffer can’t hold it and drops some, and it sounds like swallowed words or sped-up audio.

rtc_set_keyframe_request_callback

Sets the keyframe request callback. It fires when the SFU uses RTCP (PLI / FIR) to ask this track to produce a keyframe immediately; in the callback, have the encoder produce an IDR frame right away and send it with rtc_write_sample.
You must set it on the track before publishing. Without it, newly joined viewers don’t see video until the encoder’s next natural GOP—with a long GOP, that’s several seconds of black screen.The callback fires on a separate thread, so synchronize with your encoding thread. Pass NULL to clear the callback.

Complete example


The C interface doesn’t support publishing multi-layer simulcast streams—server-side scenarios (recording / MCU / AI agents) almost never need to publish multiple layers. Multi-layer switching on the subscriber side is done automatically by the SDK with no configuration. If you do need to publish multiple layers, contact us.