Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions livekit-api/src/services/egress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,36 @@ use livekit_protocol as proto;
use super::{ServiceBase, ServiceResult, LIVEKIT_PACKAGE};
use crate::{access_token::VideoGrants, get_env_keys, services::twirp_client::TwirpClient};

#[derive(Clone, Copy, Debug, Default)]
pub enum AudioMixing {
/// All users are mixed together.
#[default]
DefaultMixing,
/// Agent audio in the left channel, all other audio in the right channel.
DualChannelAgent,
/// Each new audio track alternates between left and right channels.
DualChannelAlternate,
}

impl From<AudioMixing> for proto::AudioMixing {
fn from(value: AudioMixing) -> Self {
match value {
AudioMixing::DefaultMixing => proto::AudioMixing::DefaultMixing,
AudioMixing::DualChannelAgent => proto::AudioMixing::DualChannelAgent,
AudioMixing::DualChannelAlternate => proto::AudioMixing::DualChannelAlternate,
}
}
}

#[derive(Default, Clone, Debug)]
pub struct RoomCompositeOptions {
pub layout: String,
pub encoding: encoding::EncodingOptions,
pub audio_only: bool,
pub video_only: bool,
pub custom_base_url: String,
/// Only applies when audio_only is true (default: DefaultMixing)
pub audio_mixing: AudioMixing,
}

#[derive(Default, Clone, Debug)]
Expand Down Expand Up @@ -110,6 +133,7 @@ impl EgressClient {
room_name: room.to_string(),
layout: options.layout,
audio_only: options.audio_only,
audio_mixing: Into::<proto::AudioMixing>::into(options.audio_mixing) as i32,
video_only: options.video_only,
options: Some(proto::room_composite_egress_request::Options::Advanced(
options.encoding.into(),
Expand Down