#[derive(Default, Debug, Clone)]
pub struct MediaTrackSettings {
width: Option<u32>,
height: Option<u32>,
aspect_ratio: Option<f64>,
frame_rate: Option<f64>,
facing_mode: String,
resize_mode: String,
sample_rate: u32,
sample_size: u32,
echo_cancellation: bool,
auto_gain_control: bool,
noise_suppression: bool,
latency: f64,
channel_count: u32,
device_id: String,
group_id: String,
background_blur: bool,
}
impl MediaTrackSettings {
pub fn width(&self) -> Option<u32> {
self.width
}
pub fn height(&self) -> Option<u32> {
self.height
}
pub fn aspect_ratio(&self) -> Option<f64> {
self.aspect_ratio
}
pub fn frame_rate(&self) -> Option<f64> {
self.frame_rate
}
pub(crate) fn set_received_video(&mut self, width: u32, height: u32, frame_rate: Option<f64>) {
self.width = Some(width);
self.height = Some(height);
self.aspect_ratio =
(height > 0).then(|| (f64::from(width) / f64::from(height) * 1e10).round() / 1e10);
if frame_rate.is_some() {
self.frame_rate = frame_rate;
}
}
}