Skip to main content

rtc/peer_connection/configuration/
offer_answer_options.rs

1/// Options for creating SDP answers.
2///
3/// Controls various aspects of the answer creation process, particularly
4/// voice activity detection settings.
5///
6/// # Examples
7///
8/// ```
9/// use rtc::peer_connection::configuration::RTCAnswerOptions;
10///
11/// let options = RTCAnswerOptions {
12///     voice_activity_detection: true,
13/// };
14/// ```
15#[derive(Default, Debug, PartialEq, Eq, Copy, Clone)]
16pub struct RTCAnswerOptions {
17    /// Enable voice activity detection (VAD) for audio tracks.
18    ///
19    /// When enabled, silence detection can be used to reduce bandwidth
20    /// by not transmitting during silent periods. This can save bandwidth
21    /// but may affect audio quality perception.
22    ///
23    /// **Default:** `false`
24    pub voice_activity_detection: bool,
25}
26
27/// Options for creating SDP offers.
28///
29/// Controls various aspects of the offer creation process, particularly
30/// ICE restart behavior.
31///
32/// # Examples
33///
34/// ```
35/// use rtc::peer_connection::configuration::RTCOfferOptions;
36///
37/// // Create offer with ICE restart
38/// let options = RTCOfferOptions {
39///     ice_restart: true,
40/// };
41/// ```
42///
43/// ## Specifications
44///
45/// * [W3C RTCOfferOptions](https://w3c.github.io/webrtc-pc/#dictionary-rtcofferoptions-members)
46#[derive(Default, Debug, PartialEq, Eq, Copy, Clone)]
47pub struct RTCOfferOptions {
48    /// Force ICE restart with new credentials.
49    ///
50    /// When `true`, the generated offer will contain new ICE credentials,
51    /// forcing the ICE agent to restart the gathering process. This is useful
52    /// when network conditions change or to recover from connection failures.
53    ///
54    /// **Use when:**
55    /// - Network conditions have changed (WiFi to cellular, VPN changes)
56    /// - Connection has failed and needs recovery
57    /// - Switching between networks
58    ///
59    /// **Default:** `false`
60    pub ice_restart: bool,
61}