rtc_write_sample → the SDK packetizes and sends.
Standard flow:
rtc_create_local_track
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
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
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.rtc_unpublish_local_track
rtc_publish_mcu_video_track / rtc_publish_mcu_audio_track
Publishes the channel-level composite stream; see Composite stream (program).rtc_write_sample
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.rtc_write_sample_ts
rtc_write_sample, except that instead of a timestamp increment you pass the frame’s content time (when it was captured or composited). The SDK converts it to the RTP timestamp and generates RTCP SR from the content time.
Suited to scenarios where audio and video are captured separately and encoding time varies (such as server-side compositing or transcoding): when the subscriber aligns audio and video using SR, it uses the content time rather than the send time, so jitter from encoding time and send queuing doesn’t affect A/V sync, and you don’t need to shape the send pacing yourself for that.
Returns: same as
rtc_write_sample; returns RTC_ERROR if rtc_write_sample and rtc_write_sample_ts are mixed on the same track.
rtc_set_audio_level
Return value:
RTC_OK on success; RTC_INVALID_PARAM if the handle is invalid.
- The SDK receives encoded data (such as Opus) and cannot compute the level itself; the caller must compute it from the PCM before encoding.
- Call it once per frame (about 20 ms). It can run on a different thread from sample writing and does not block it.
- Tracks that never call this function behave exactly as in 0.5.1 and earlier. Calling it on a video track has no effect.
- Currently only the SeaStart engine uses it to send active speakers.
rtc_set_keyframe_request_callback
rtc_write_sample.
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.