screenshare: advanced in-app streaming controls + hwdec toggle
Add a local-only "Screen sharing" section to Settings plus a per-call quality picker on the Share control: in-app control over how a share is encoded (quality/bitrate/framerate/max-height/max-viewers/software-x264, + extra pixelpass args) and how it's played back (mpv/vlc, hardware decode, buffering, cache, + extra mpv args). Settings live in AppConfig.screen_share (all serde-defaulted, so old configs load unchanged) and become pixelpass host CLI flags / mpv args at share/view launch. Hardware decode defaults OFF, which also fixes the frozen-frame-with-audio bug: forcing --hwdec=auto stalled some viewers' HW decoder on frame 1 while audio kept playing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+453
-7
@@ -4,7 +4,10 @@ use crate::audio::clip_player::{
|
||||
};
|
||||
use crate::audio::eq::{EQ_GAIN_DB_MAX, EQ_GAIN_DB_MIN, EqSettings};
|
||||
use crate::audio::{AudioDevice, enumerate_audio_devices};
|
||||
use crate::config::{AppConfig, AudioProfile, NetworkMode, RecordingMode, RoomLayout};
|
||||
use crate::config::{
|
||||
AppConfig, AudioProfile, NetworkMode, RecordingMode, RoomLayout, ShareBuffering, SharePlayer,
|
||||
ShareQuality,
|
||||
};
|
||||
use crate::core::{
|
||||
CoreController,
|
||||
messages::{CoreCommand, UiEvent},
|
||||
@@ -60,18 +63,20 @@ pub enum SettingsCategory {
|
||||
Profile,
|
||||
Appearance,
|
||||
Network,
|
||||
Advanced,
|
||||
Notifications,
|
||||
Games,
|
||||
}
|
||||
|
||||
impl SettingsCategory {
|
||||
const ALL: [SettingsCategory; 8] = [
|
||||
const ALL: [SettingsCategory; 9] = [
|
||||
SettingsCategory::Audio,
|
||||
SettingsCategory::Hotkeys,
|
||||
SettingsCategory::Recording,
|
||||
SettingsCategory::Profile,
|
||||
SettingsCategory::Appearance,
|
||||
SettingsCategory::Network,
|
||||
SettingsCategory::Advanced,
|
||||
SettingsCategory::Notifications,
|
||||
SettingsCategory::Games,
|
||||
];
|
||||
@@ -84,6 +89,7 @@ impl SettingsCategory {
|
||||
SettingsCategory::Profile => "Profile",
|
||||
SettingsCategory::Appearance => "Appearance",
|
||||
SettingsCategory::Network => "Network",
|
||||
SettingsCategory::Advanced => "Advanced",
|
||||
SettingsCategory::Notifications => "Notifications",
|
||||
SettingsCategory::Games => "Games",
|
||||
}
|
||||
@@ -97,6 +103,7 @@ impl SettingsCategory {
|
||||
SettingsCategory::Profile => "Avatar and identity",
|
||||
SettingsCategory::Appearance => "Layout and theme",
|
||||
SettingsCategory::Network => "Relay and privacy mode",
|
||||
SettingsCategory::Advanced => "Screen sharing",
|
||||
SettingsCategory::Notifications => "Chimes and sounds",
|
||||
SettingsCategory::Games => "Detection, presence, backgrounds",
|
||||
}
|
||||
@@ -109,6 +116,176 @@ impl std::fmt::Display for SettingsCategory {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ShareMaxHeightChoice {
|
||||
Source,
|
||||
P720,
|
||||
P1080,
|
||||
P1440,
|
||||
}
|
||||
|
||||
impl ShareMaxHeightChoice {
|
||||
const ALL: [ShareMaxHeightChoice; 4] = [
|
||||
ShareMaxHeightChoice::Source,
|
||||
ShareMaxHeightChoice::P720,
|
||||
ShareMaxHeightChoice::P1080,
|
||||
ShareMaxHeightChoice::P1440,
|
||||
];
|
||||
|
||||
fn from_config(value: Option<u32>) -> Self {
|
||||
match value {
|
||||
Some(720) => ShareMaxHeightChoice::P720,
|
||||
Some(1080) => ShareMaxHeightChoice::P1080,
|
||||
Some(1440) => ShareMaxHeightChoice::P1440,
|
||||
_ => ShareMaxHeightChoice::Source,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_config(self) -> Option<u32> {
|
||||
match self {
|
||||
ShareMaxHeightChoice::Source => None,
|
||||
ShareMaxHeightChoice::P720 => Some(720),
|
||||
ShareMaxHeightChoice::P1080 => Some(1080),
|
||||
ShareMaxHeightChoice::P1440 => Some(1440),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ShareMaxHeightChoice {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
ShareMaxHeightChoice::Source => "Source",
|
||||
ShareMaxHeightChoice::P720 => "720p",
|
||||
ShareMaxHeightChoice::P1080 => "1080p",
|
||||
ShareMaxHeightChoice::P1440 => "1440p",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ShareFramerateChoice {
|
||||
Preset,
|
||||
Fps15,
|
||||
Fps24,
|
||||
Fps30,
|
||||
Fps60,
|
||||
}
|
||||
|
||||
impl ShareFramerateChoice {
|
||||
const ALL: [ShareFramerateChoice; 5] = [
|
||||
ShareFramerateChoice::Preset,
|
||||
ShareFramerateChoice::Fps15,
|
||||
ShareFramerateChoice::Fps24,
|
||||
ShareFramerateChoice::Fps30,
|
||||
ShareFramerateChoice::Fps60,
|
||||
];
|
||||
|
||||
fn from_config(value: Option<u32>) -> Self {
|
||||
match value {
|
||||
Some(15) => ShareFramerateChoice::Fps15,
|
||||
Some(24) => ShareFramerateChoice::Fps24,
|
||||
Some(30) => ShareFramerateChoice::Fps30,
|
||||
Some(60) => ShareFramerateChoice::Fps60,
|
||||
_ => ShareFramerateChoice::Preset,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_config(self) -> Option<u32> {
|
||||
match self {
|
||||
ShareFramerateChoice::Preset => None,
|
||||
ShareFramerateChoice::Fps15 => Some(15),
|
||||
ShareFramerateChoice::Fps24 => Some(24),
|
||||
ShareFramerateChoice::Fps30 => Some(30),
|
||||
ShareFramerateChoice::Fps60 => Some(60),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ShareFramerateChoice {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
ShareFramerateChoice::Preset => "Preset default",
|
||||
ShareFramerateChoice::Fps15 => "15 fps",
|
||||
ShareFramerateChoice::Fps24 => "24 fps",
|
||||
ShareFramerateChoice::Fps30 => "30 fps",
|
||||
ShareFramerateChoice::Fps60 => "60 fps",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum ShareMaxViewersChoice {
|
||||
Auto,
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Four,
|
||||
Five,
|
||||
Six,
|
||||
Seven,
|
||||
Eight,
|
||||
}
|
||||
|
||||
impl ShareMaxViewersChoice {
|
||||
const ALL: [ShareMaxViewersChoice; 9] = [
|
||||
ShareMaxViewersChoice::Auto,
|
||||
ShareMaxViewersChoice::One,
|
||||
ShareMaxViewersChoice::Two,
|
||||
ShareMaxViewersChoice::Three,
|
||||
ShareMaxViewersChoice::Four,
|
||||
ShareMaxViewersChoice::Five,
|
||||
ShareMaxViewersChoice::Six,
|
||||
ShareMaxViewersChoice::Seven,
|
||||
ShareMaxViewersChoice::Eight,
|
||||
];
|
||||
|
||||
fn from_config(value: Option<u32>) -> Self {
|
||||
match value {
|
||||
Some(1) => ShareMaxViewersChoice::One,
|
||||
Some(2) => ShareMaxViewersChoice::Two,
|
||||
Some(3) => ShareMaxViewersChoice::Three,
|
||||
Some(4) => ShareMaxViewersChoice::Four,
|
||||
Some(5) => ShareMaxViewersChoice::Five,
|
||||
Some(6) => ShareMaxViewersChoice::Six,
|
||||
Some(7) => ShareMaxViewersChoice::Seven,
|
||||
Some(8) => ShareMaxViewersChoice::Eight,
|
||||
_ => ShareMaxViewersChoice::Auto,
|
||||
}
|
||||
}
|
||||
|
||||
fn to_config(self) -> Option<u32> {
|
||||
match self {
|
||||
ShareMaxViewersChoice::Auto => None,
|
||||
ShareMaxViewersChoice::One => Some(1),
|
||||
ShareMaxViewersChoice::Two => Some(2),
|
||||
ShareMaxViewersChoice::Three => Some(3),
|
||||
ShareMaxViewersChoice::Four => Some(4),
|
||||
ShareMaxViewersChoice::Five => Some(5),
|
||||
ShareMaxViewersChoice::Six => Some(6),
|
||||
ShareMaxViewersChoice::Seven => Some(7),
|
||||
ShareMaxViewersChoice::Eight => Some(8),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ShareMaxViewersChoice {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
ShareMaxViewersChoice::Auto => "Auto",
|
||||
ShareMaxViewersChoice::One => "1",
|
||||
ShareMaxViewersChoice::Two => "2",
|
||||
ShareMaxViewersChoice::Three => "3",
|
||||
ShareMaxViewersChoice::Four => "4",
|
||||
ShareMaxViewersChoice::Five => "5",
|
||||
ShareMaxViewersChoice::Six => "6",
|
||||
ShareMaxViewersChoice::Seven => "7",
|
||||
ShareMaxViewersChoice::Eight => "8",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const SHARE_CACHE_MB_OPTIONS: [u32; 8] = [1, 2, 4, 8, 16, 32, 64, 128];
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
enum HomeLayoutMode {
|
||||
FocusedEmpty,
|
||||
@@ -379,6 +556,18 @@ pub enum AppMessage {
|
||||
NetworkModeSelected(NetworkMode),
|
||||
AudioProfileSelected(AudioProfile),
|
||||
RecordingModeSelected(RecordingMode),
|
||||
ScreenShareQualitySelected(ShareQuality),
|
||||
ScreenSharePlayerSelected(SharePlayer),
|
||||
ScreenShareBufferingSelected(ShareBuffering),
|
||||
ScreenShareMaxHeightSelected(ShareMaxHeightChoice),
|
||||
ScreenShareFramerateSelected(ShareFramerateChoice),
|
||||
ScreenShareMaxViewersSelected(ShareMaxViewersChoice),
|
||||
ScreenShareCacheMbSelected(u32),
|
||||
ScreenShareBitrateChanged(String),
|
||||
ToggleScreenShareForceSoftwareEncode(bool),
|
||||
ToggleScreenShareHardwareDecode(bool),
|
||||
ScreenShareExtraMpvArgsChanged(String),
|
||||
ScreenShareExtraHostArgsChanged(String),
|
||||
/// Choose the friends presence posture (W7): invisible / normal / discoverable.
|
||||
PresenceModeSelected(PresenceMode),
|
||||
/// Friends list (W7 P5): add-form edits, add, remove, and local rename.
|
||||
@@ -537,6 +726,8 @@ pub enum AppMessage {
|
||||
/// Select which app's audio to share in the picker: `Some(name)` for one app,
|
||||
/// `None` for the whole desktop ("All system audio").
|
||||
SelectShareAudioApp(Option<String>),
|
||||
/// Session-only quality preset for the next share start.
|
||||
SelectShareQualityOverride(ShareQuality),
|
||||
/// Confirm the picker: start the share with the currently selected audio app.
|
||||
ConfirmShareScreen,
|
||||
/// Watch a peer's screen share, identified by their pixelpass ticket.
|
||||
@@ -761,6 +952,8 @@ pub struct AppState {
|
||||
/// The picker's current selection: `Some(name)` = capture that app's audio,
|
||||
/// `None` = "All system audio" (whole desktop; may echo the call).
|
||||
share_audio_selection: Option<String>,
|
||||
/// Session-only quality override for the next screen-share start.
|
||||
share_quality_selection: ShareQuality,
|
||||
/// A share start is in flight: `ConfirmShareScreen` was sent but the core
|
||||
/// hasn't yet replied with `ScreenShareStarted`/an error. Blocks reopening
|
||||
/// the picker (and re-confirming) during that startup window. Cleared on
|
||||
@@ -871,6 +1064,7 @@ impl AppState {
|
||||
self.share_picker_open = false;
|
||||
self.share_audio_apps.clear();
|
||||
self.share_audio_selection = None;
|
||||
self.share_quality_selection = self.config.screen_share.quality;
|
||||
self.share_starting = false;
|
||||
self.share_audio_dropped = false;
|
||||
self.share_audio_app_active = false;
|
||||
@@ -975,6 +1169,7 @@ impl Default for AppState {
|
||||
let (clip_player, clip_status) = ClipPlayer::new(config.clip_volume);
|
||||
let (music_player, music_status) = ClipPlayer::new(config.music_volume);
|
||||
let music_broadcasting = config.music_broadcast;
|
||||
let share_quality_selection = config.screen_share.quality;
|
||||
let music_playlist = config
|
||||
.music_playlist
|
||||
.iter()
|
||||
@@ -1049,6 +1244,7 @@ impl Default for AppState {
|
||||
share_picker_open: false,
|
||||
share_audio_apps: Vec::new(),
|
||||
share_audio_selection: None,
|
||||
share_quality_selection,
|
||||
share_starting: false,
|
||||
share_audio_dropped: false,
|
||||
share_audio_app_active: false,
|
||||
@@ -1563,6 +1759,7 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
// so the picker can't be reopened during the startup window.
|
||||
state.share_picker_open = true;
|
||||
state.share_audio_selection = None;
|
||||
state.share_quality_selection = state.config.screen_share.quality;
|
||||
state.share_audio_apps.clear();
|
||||
let _ = state.controller.send(CoreCommand::ListAudioApps);
|
||||
}
|
||||
@@ -1573,6 +1770,9 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
AppMessage::SelectShareAudioApp(app) => {
|
||||
state.share_audio_selection = app;
|
||||
}
|
||||
AppMessage::SelectShareQualityOverride(quality) => {
|
||||
state.share_quality_selection = quality;
|
||||
}
|
||||
AppMessage::ConfirmShareScreen => {
|
||||
// Only a confirm from an open picker starts a share; a stray confirm
|
||||
// (or one arriving while a start is already in flight) is ignored, so
|
||||
@@ -1581,14 +1781,21 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
state.share_picker_open = false;
|
||||
state.share_starting = true;
|
||||
let audio_app = state.share_audio_selection.clone();
|
||||
let _ = state
|
||||
.controller
|
||||
.send(CoreCommand::StartScreenShare { audio_app });
|
||||
let settings = state.config.screen_share.clone();
|
||||
let quality = state.share_quality_selection;
|
||||
let _ = state.controller.send(CoreCommand::StartScreenShare {
|
||||
audio_app,
|
||||
settings,
|
||||
quality,
|
||||
});
|
||||
state.status_message = "Starting screen share…".to_string();
|
||||
}
|
||||
}
|
||||
AppMessage::WatchShare(ticket) => {
|
||||
let _ = state.controller.send(CoreCommand::ViewShare(ticket));
|
||||
let settings = state.config.screen_share.clone();
|
||||
let _ = state
|
||||
.controller
|
||||
.send(CoreCommand::ViewShare { ticket, settings });
|
||||
state.status_message = "Opening screen share…".to_string();
|
||||
}
|
||||
AppMessage::ToggleMutePressed => {
|
||||
@@ -2064,6 +2271,61 @@ fn update(state: &mut AppState, message: AppMessage) -> Task<AppMessage> {
|
||||
// Takes effect on the next recording start.
|
||||
let _ = state.controller.send(CoreCommand::SetRecordingMode(mode));
|
||||
}
|
||||
AppMessage::ScreenShareQualitySelected(quality) => {
|
||||
state.config.screen_share.quality = quality;
|
||||
state.share_quality_selection = quality;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenSharePlayerSelected(player) => {
|
||||
state.config.screen_share.player = player;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareBufferingSelected(buffering) => {
|
||||
state.config.screen_share.buffering = buffering;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareMaxHeightSelected(choice) => {
|
||||
state.config.screen_share.max_height = choice.to_config();
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareFramerateSelected(choice) => {
|
||||
state.config.screen_share.framerate = choice.to_config();
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareMaxViewersSelected(choice) => {
|
||||
state.config.screen_share.max_viewers = choice.to_config();
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareCacheMbSelected(cache_mb) => {
|
||||
state.config.screen_share.cache_mb = cache_mb;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareBitrateChanged(value) => {
|
||||
let trimmed = value.trim();
|
||||
if trimmed.is_empty() {
|
||||
state.config.screen_share.bitrate_mbps = None;
|
||||
state.config.save();
|
||||
} else if let Ok(mbps) = trimmed.parse::<u32>() {
|
||||
state.config.screen_share.bitrate_mbps = Some(mbps);
|
||||
state.config.save();
|
||||
}
|
||||
}
|
||||
AppMessage::ToggleScreenShareForceSoftwareEncode(enabled) => {
|
||||
state.config.screen_share.force_software_encode = enabled;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ToggleScreenShareHardwareDecode(enabled) => {
|
||||
state.config.screen_share.hardware_decode = enabled;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareExtraMpvArgsChanged(args) => {
|
||||
state.config.screen_share.extra_mpv_args = args;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::ScreenShareExtraHostArgsChanged(args) => {
|
||||
state.config.screen_share.extra_host_args = args;
|
||||
state.config.save();
|
||||
}
|
||||
AppMessage::PresenceModeSelected(mode) => {
|
||||
state.config.presence_mode = mode;
|
||||
state.config.save();
|
||||
@@ -3166,6 +3428,30 @@ fn presence_mode_hint(mode: PresenceMode) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
fn share_quality_hint(quality: ShareQuality) -> &'static str {
|
||||
match quality {
|
||||
ShareQuality::Auto => "Use pixelpass bandwidth pre-flight; falls back to Medium.",
|
||||
ShareQuality::Low => "Lower bandwidth: up to 480p, about 1 Mbps.",
|
||||
ShareQuality::Medium => "Balanced preset: up to 720p, about 2.5 Mbps.",
|
||||
ShareQuality::High => "Sharper preset: up to 1080p, about 4 Mbps.",
|
||||
ShareQuality::Source => "Native source resolution, about 6 Mbps.",
|
||||
}
|
||||
}
|
||||
|
||||
fn share_player_hint(player: SharePlayer) -> &'static str {
|
||||
match player {
|
||||
SharePlayer::Mpv => "Try mpv first, then VLC if mpv is unavailable.",
|
||||
SharePlayer::Vlc => "Try VLC first, then mpv if VLC is unavailable.",
|
||||
}
|
||||
}
|
||||
|
||||
fn share_buffering_hint(buffering: ShareBuffering) -> &'static str {
|
||||
match buffering {
|
||||
ShareBuffering::LowLatency => "Small buffers for interactive screen sharing.",
|
||||
ShareBuffering::Smooth => "Larger mpv cache/readahead for steadier playback.",
|
||||
}
|
||||
}
|
||||
|
||||
/// Formats a call duration as `m:ss` (or `h:mm:ss` past an hour).
|
||||
fn format_duration(total_secs: u64) -> String {
|
||||
let h = total_secs / 3600;
|
||||
@@ -4759,6 +5045,135 @@ fn view(state: &AppState) -> Element<'_, AppMessage> {
|
||||
// Spacing between one category and the next.
|
||||
let section_gap = 18.0;
|
||||
|
||||
let screen_share = &state.config.screen_share;
|
||||
let screen_share_bitrate = screen_share
|
||||
.bitrate_mbps
|
||||
.map(|v| v.to_string())
|
||||
.unwrap_or_default();
|
||||
let screen_share_section = column![
|
||||
column![
|
||||
text("Host encoding").size(13).color(color_subtext),
|
||||
row![
|
||||
column![
|
||||
text("Quality").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&ShareQuality::ALL[..],
|
||||
Some(screen_share.quality),
|
||||
AppMessage::ScreenShareQualitySelected,
|
||||
).width(iced::Length::Fill),
|
||||
text(share_quality_hint(screen_share.quality)).size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
column![
|
||||
text("Max resolution").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&ShareMaxHeightChoice::ALL[..],
|
||||
Some(ShareMaxHeightChoice::from_config(screen_share.max_height)),
|
||||
AppMessage::ScreenShareMaxHeightSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text("Source keeps the captured display height.").size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
].spacing(16).width(iced::Length::Fill),
|
||||
row![
|
||||
column![
|
||||
text("Framerate").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&ShareFramerateChoice::ALL[..],
|
||||
Some(ShareFramerateChoice::from_config(screen_share.framerate)),
|
||||
AppMessage::ScreenShareFramerateSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text("Preset default lets pixelpass choose.").size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
column![
|
||||
text("Bitrate Mbps").size(12).color(color_subtext),
|
||||
context_input("preset default", &screen_share_bitrate)
|
||||
.on_input(AppMessage::ScreenShareBitrateChanged)
|
||||
.style(t_style)
|
||||
.padding(8)
|
||||
.width(iced::Length::Fill),
|
||||
text("Blank uses the quality preset.").size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
].spacing(16).width(iced::Length::Fill),
|
||||
row![
|
||||
column![
|
||||
text("Max viewers").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&ShareMaxViewersChoice::ALL[..],
|
||||
Some(ShareMaxViewersChoice::from_config(screen_share.max_viewers)),
|
||||
AppMessage::ScreenShareMaxViewersSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text("Auto uses pixelpass' connection-aware recommendation.").size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
column![
|
||||
checkbox(screen_share.force_software_encode)
|
||||
.label("Force software encode")
|
||||
.on_toggle(AppMessage::ToggleScreenShareForceSoftwareEncode),
|
||||
text("Passes --no-hwencode to pixelpass.").size(11).color(color_subtext),
|
||||
].spacing(8).width(iced::Length::Fill),
|
||||
].spacing(16).width(iced::Length::Fill),
|
||||
].spacing(10).width(iced::Length::Fill),
|
||||
vertical_space(section_gap),
|
||||
column![
|
||||
text("Viewer playback").size(13).color(color_subtext),
|
||||
row![
|
||||
column![
|
||||
text("Player").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&SharePlayer::ALL[..],
|
||||
Some(screen_share.player),
|
||||
AppMessage::ScreenSharePlayerSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text(share_player_hint(screen_share.player)).size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
column![
|
||||
text("Buffering").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&ShareBuffering::ALL[..],
|
||||
Some(screen_share.buffering),
|
||||
AppMessage::ScreenShareBufferingSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text(share_buffering_hint(screen_share.buffering)).size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
].spacing(16).width(iced::Length::Fill),
|
||||
row![
|
||||
column![
|
||||
text("Cache MB").size(12).color(color_subtext),
|
||||
pick_list(
|
||||
&SHARE_CACHE_MB_OPTIONS[..],
|
||||
Some(screen_share.cache_mb),
|
||||
AppMessage::ScreenShareCacheMbSelected,
|
||||
).width(iced::Length::Fill),
|
||||
text("Used as mpv demuxer cache size.").size(11).color(color_subtext),
|
||||
].spacing(4).width(iced::Length::Fill),
|
||||
column![
|
||||
checkbox(screen_share.hardware_decode)
|
||||
.label("Hardware video decode")
|
||||
.on_toggle(AppMessage::ToggleScreenShareHardwareDecode),
|
||||
text("Adds --hwdec=auto to mpv. Off avoids the known frame-freeze bug.").size(11).color(color_subtext),
|
||||
].spacing(8).width(iced::Length::Fill),
|
||||
].spacing(16).width(iced::Length::Fill),
|
||||
].spacing(10).width(iced::Length::Fill),
|
||||
vertical_space(section_gap),
|
||||
column![
|
||||
text("Extra mpv args").size(12).color(color_subtext),
|
||||
context_input("--no-osc --vd-lavc-threads=2", &screen_share.extra_mpv_args)
|
||||
.on_input(AppMessage::ScreenShareExtraMpvArgsChanged)
|
||||
.style(t_style)
|
||||
.padding(8)
|
||||
.width(iced::Length::Fill),
|
||||
text("⚠ Advanced — may break playback").size(11).color(color_yellow),
|
||||
text("Extra pixelpass args").size(12).color(color_subtext),
|
||||
context_input("--relay https://relay.example/", &screen_share.extra_host_args)
|
||||
.on_input(AppMessage::ScreenShareExtraHostArgsChanged)
|
||||
.style(t_style)
|
||||
.padding(8)
|
||||
.width(iced::Length::Fill),
|
||||
text("⚠ Advanced — may break playback").size(11).color(color_yellow),
|
||||
].spacing(6).width(iced::Length::Fill),
|
||||
text("Applies the next time you start or watch a screen share. These are local preferences only.").size(11).color(color_subtext),
|
||||
]
|
||||
.spacing(10)
|
||||
.width(iced::Length::Fill);
|
||||
|
||||
// One recording-mode radio with a hover tooltip explaining it. (iced's
|
||||
// pick_list can't host per-option tooltips, so the modes are radios.)
|
||||
let mode_radio = |mode: RecordingMode, label: &'static str| -> Element<'_, AppMessage> {
|
||||
@@ -5082,6 +5497,13 @@ fn view(state: &AppState) -> Element<'_, AppMessage> {
|
||||
.spacing(10)
|
||||
.width(iced::Length::Fill)
|
||||
.into(),
|
||||
SettingsCategory::Advanced => column![
|
||||
section_header("Screen sharing"),
|
||||
screen_share_section,
|
||||
]
|
||||
.spacing(10)
|
||||
.width(iced::Length::Fill)
|
||||
.into(),
|
||||
SettingsCategory::Notifications => column![
|
||||
section_header("Notifications & Sounds"),
|
||||
column![
|
||||
@@ -6479,11 +6901,29 @@ fn view(state: &AppState) -> Element<'_, AppMessage> {
|
||||
} else {
|
||||
AppMessage::OpenPixelpassHelp
|
||||
};
|
||||
button(btn_content(share_kind, share_label, share_fg))
|
||||
let share_button = button(btn_content(share_kind, share_label, share_fg))
|
||||
.on_press(share_press)
|
||||
.style(b_style(share_bg, share_hover, share_fg, 8.0))
|
||||
.padding(14)
|
||||
.width(iced::Length::Fill);
|
||||
let share_control: Element<'_, AppMessage> = if state.self_sharing {
|
||||
share_button.into()
|
||||
} else {
|
||||
row![
|
||||
share_button,
|
||||
pick_list(
|
||||
&ShareQuality::ALL[..],
|
||||
Some(state.share_quality_selection),
|
||||
AppMessage::SelectShareQualityOverride,
|
||||
)
|
||||
.width(iced::Length::Fixed(112.0)),
|
||||
]
|
||||
.spacing(8)
|
||||
.align_y(iced::alignment::Vertical::Center)
|
||||
.width(iced::Length::Fill)
|
||||
.into()
|
||||
};
|
||||
share_control
|
||||
},
|
||||
];
|
||||
|
||||
@@ -8703,6 +9143,10 @@ mod tests {
|
||||
assert!(!state.share_picker_open);
|
||||
assert!(state.share_audio_apps.is_empty());
|
||||
assert!(state.share_audio_selection.is_none());
|
||||
assert_eq!(
|
||||
state.share_quality_selection,
|
||||
state.config.screen_share.quality
|
||||
);
|
||||
assert!(!state.share_starting);
|
||||
assert!(!state.share_audio_dropped);
|
||||
assert!(!state.share_audio_app_active);
|
||||
@@ -9198,12 +9642,14 @@ mod tests {
|
||||
"Profile",
|
||||
"Appearance",
|
||||
"Network",
|
||||
"Advanced",
|
||||
"Notifications",
|
||||
"Games"
|
||||
]
|
||||
);
|
||||
assert_eq!(SettingsCategory::Audio.hint(), "Devices, mic gate, echo");
|
||||
assert_eq!(SettingsCategory::Profile.hint(), "Avatar and identity");
|
||||
assert_eq!(SettingsCategory::Advanced.hint(), "Screen sharing");
|
||||
assert_eq!(
|
||||
SettingsCategory::Games.hint(),
|
||||
"Detection, presence, backgrounds"
|
||||
|
||||
Reference in New Issue
Block a user