Viewers start at the streamer's target instead of 1080p30 (60 fps screenshare reachable), camera reopen gets layer demand again, camera picks highest reachable fps, real OS fullscreen with Esc to exit, pill and dock show target quality, codec in stats, gpu video row
Browse files at this commitb97746e54f2c8b052f75945ae2ac1d1a6d156acfParent: 599fbc4- fix
- viewers start at the streamer's target instead of 1080p30 (60 fps screenshare reachable), camera reopen gets layer demand again, camera picks highest reachable fps, real OS fullscreen with Esc to exit, pill and dock show target quality, codec in stats, gpu video row
11 changed files +73 -45
- crates/client/src/gui.rs +15 -2
- crates/client/src/gui/dock.rs +5 -10
- crates/client/src/gui/share_view.rs +4 -3
- crates/client/src/gui/stream_stats.rs +10 -6
- crates/client/src/gui/voice_stats.rs +14 -4
- crates/client/src/share/camera.rs +1 -1
- crates/client/src/share/capture.rs +1 -0
- crates/client/src/share/session.rs +1 -5
- crates/client/src/usage.rs +7 -10
- crates/common/src/event.rs +8 -2
- crates/server/src/rooms.rs +7 -2
crates/client/src/gui.rsmodified+15 -2
| @@ -631,6 +631,7 @@ pub struct Yumush { | |||
| 631 | pending_backup_delete: Option<String>, | 631 | pending_backup_delete: Option<String>, |
| 632 | share_apps: Vec<crate::share::audio::AudioApp>, | 632 | share_apps: Vec<crate::share::audio::AudioApp>, |
| 633 | share_tab: common::share::Kind, | 633 | share_tab: common::share::Kind, |
| 634 | + fullscreen: bool, | ||
| 634 | send_order: Arc<tokio::sync::Mutex<()>>, | 635 | send_order: Arc<tokio::sync::Mutex<()>>, |
| 635 | } | 636 | } |
| 636 | 637 | ||
| @@ -691,6 +692,7 @@ impl Yumush { | |||
| 691 | pending_backup_delete: None, | 692 | pending_backup_delete: None, |
| 692 | share_apps: Vec::new(), | 693 | share_apps: Vec::new(), |
| 693 | share_tab: common::share::Kind::Screen, | 694 | share_tab: common::share::Kind::Screen, |
| 695 | + fullscreen: false, | ||
| 694 | send_order: Default::default(), | 696 | send_order: Default::default(), |
| 695 | }; | 697 | }; |
| 696 | yumush.chat.camera_task = Some(camera_view::ticker(cx)); | 698 | yumush.chat.camera_task = Some(camera_view::ticker(cx)); |
| @@ -1379,7 +1381,16 @@ pub(super) fn new_input( | |||
| 1379 | } | 1381 | } |
| 1380 | 1382 | ||
| 1381 | impl Render for Yumush { | 1383 | impl Render for Yumush { |
| 1382 | - fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { | 1384 | + fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { |
| 1385 | + let fullscreen = self | ||
| 1386 | + .chat | ||
| 1387 | + .viewer | ||
| 1388 | + .as_ref() | ||
| 1389 | + .is_some_and(|viewer| viewer.fullscreen); | ||
| 1390 | + if fullscreen != self.fullscreen { | ||
| 1391 | + self.fullscreen = fullscreen; | ||
| 1392 | + window.toggle_fullscreen(); | ||
| 1393 | + } | ||
| 1383 | let palette = palette(cx); | 1394 | let palette = palette(cx); |
| 1384 | sync_accent(self.themed(cx).accent, cx); | 1395 | sync_accent(self.themed(cx).accent, cx); |
| 1385 | let route = self.current_route; | 1396 | let route = self.current_route; |
| @@ -1403,7 +1414,9 @@ impl Render for Yumush { | |||
| 1403 | cx.listener(|this, _: &FocusFind, window, cx| this.chat.focus_find(window, cx)), | 1414 | cx.listener(|this, _: &FocusFind, window, cx| this.chat.focus_find(window, cx)), |
| 1404 | ) | 1415 | ) |
| 1405 | .on_action(cx.listener(|this, _: &CloseSettings, window, cx| { | 1416 | .on_action(cx.listener(|this, _: &CloseSettings, window, cx| { |
| 1406 | - if this.chat.view != View::Chat { | 1417 | + if this.fullscreen { |
| 1418 | + this.toggle_fullscreen(cx); | ||
| 1419 | + } else if this.chat.view != View::Chat { | ||
| 1407 | this.show_view(View::Chat, window, cx); | 1420 | this.show_view(View::Chat, window, cx); |
| 1408 | } else { | 1421 | } else { |
| 1409 | this.cancel_composer(window, cx); | 1422 | this.cancel_composer(window, cx); |
crates/client/src/gui/dock.rsmodified+5 -10
| @@ -317,16 +317,11 @@ impl Yumush { | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | fn mode_text(&self, kind: Kind) -> String { | 319 | fn mode_text(&self, kind: Kind) -> String { |
| 320 | - let quality = self | 320 | + let top = self |
| 321 | - .chat | 321 | + .network |
| 322 | - .share_sample | 322 | + .share_source(kind) |
| 323 | - .sending | 323 | + .map_or_else(|| self.settings.share.top(kind), |source| source.top); |
| 324 | - .iter() | 324 | + format!("{}p{}", top.resolution.height(), top.fps.value()) |
| 325 | - .filter(|(sent, _)| *sent == kind) | ||
| 326 | - .map(|(_, stats)| stats.layer.quality) | ||
| 327 | - .max_by_key(|quality| quality.resolution.height()) | ||
| 328 | - .unwrap_or_else(|| self.settings.share.top(kind)); | ||
| 329 | - format!("{}p{}", quality.resolution.height(), quality.fps.value()) | ||
| 330 | } | 325 | } |
| 331 | 326 | ||
| 332 | fn is_on(&self, kind: Kind) -> bool { | 327 | fn is_on(&self, kind: Kind) -> bool { |
crates/client/src/gui/share_view.rsmodified+4 -3
| @@ -34,7 +34,7 @@ use super::{ | |||
| 34 | media_view::into_render_image, | 34 | media_view::into_render_image, |
| 35 | notify_error, pop_in, | 35 | notify_error, pop_in, |
| 36 | settings_page::segmented, | 36 | settings_page::segmented, |
| 37 | - stream_stats::{quality_label, stream_card, watch_stats}, | 37 | + stream_stats::{stream_card, watch_stats}, |
| 38 | surface::Surface, | 38 | surface::Surface, |
| 39 | text, | 39 | text, |
| 40 | widget::{icon_button, spawn_warn}, | 40 | widget::{icon_button, spawn_warn}, |
| @@ -528,8 +528,9 @@ impl Yumush { | |||
| 528 | .left(px(10.)) | 528 | .left(px(10.)) |
| 529 | .top(px(10.)), | 529 | .top(px(10.)), |
| 530 | ) | 530 | ) |
| 531 | - .children(stats.map(|stats| { | 531 | + .children(stats.map(|_| { |
| 532 | let entity = entity.clone(); | 532 | let entity = entity.clone(); |
| 533 | + let top = self.share_top(viewer.user_id, viewer.kind); | ||
| 533 | div() | 534 | div() |
| 534 | .occlude() | 535 | .occlude() |
| 535 | .absolute() | 536 | .absolute() |
| @@ -548,7 +549,7 @@ impl Yumush { | |||
| 548 | .bg(gpui_kit::black().opacity(0.72)) | 549 | .bg(gpui_kit::black().opacity(0.72)) |
| 549 | .text_size(text(11.)) | 550 | .text_size(text(11.)) |
| 550 | .text_color(tone) | 551 | .text_color(tone) |
| 551 | - .child(quality_label(stats)), | 552 | + .child(format!("{}p{}", top.resolution.height(), top.fps.value())), |
| 552 | ) | 553 | ) |
| 553 | .child( | 554 | .child( |
| 554 | div() | 555 | div() |
crates/client/src/gui/stream_stats.rsmodified+10 -6
| @@ -17,12 +17,6 @@ pub(super) fn watch_stats(yumush: &Yumush, user_id: Id, kind: Kind) -> Option<&W | |||
| 17 | .map(|(_, _, stats)| stats) | 17 | .map(|(_, _, stats)| stats) |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -pub(super) fn quality_label(stats: &WatchStats) -> String { | ||
| 21 | - stats.layer.as_ref().map_or("…".to_string(), |layer| { | ||
| 22 | - format!("{}p{:.0}", layer.quality.resolution.height(), stats.fps) | ||
| 23 | - }) | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Palette) -> Div { | 20 | pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Palette) -> Div { |
| 27 | let (tone, noun) = match kind { | 21 | let (tone, noun) = match kind { |
| 28 | Kind::Screen => (palette.screen, "screen"), | 22 | Kind::Screen => (palette.screen, "screen"), |
| @@ -86,6 +80,16 @@ pub(super) fn stream_card(yumush: &Yumush, user_id: Id, kind: Kind, palette: Pal | |||
| 86 | palette, | 80 | palette, |
| 87 | ), | 81 | ), |
| 88 | row("FPS", value(|stats| format!("{:.0}", stats.fps)), palette), | 82 | row("FPS", value(|stats| format!("{:.0}", stats.fps)), palette), |
| 83 | + row( | ||
| 84 | + "Codec", | ||
| 85 | + value(|stats| { | ||
| 86 | + stats | ||
| 87 | + .layer | ||
| 88 | + .map_or("…", |layer| layer.codec.name()) | ||
| 89 | + .to_string() | ||
| 90 | + }), | ||
| 91 | + palette, | ||
| 92 | + ), | ||
| 89 | row( | 93 | row( |
| 90 | "Engine", | 94 | "Engine", |
| 91 | value(|stats| { | 95 | value(|stats| { |
crates/client/src/gui/voice_stats.rsmodified+14 -4
| @@ -259,6 +259,13 @@ fn layer_row(index: usize, stats: &LayerStats, max: f32, kind: Kind, palette: Pa | |||
| 259 | .text_color(palette.text) | 259 | .text_color(palette.text) |
| 260 | .child(resolution_text(stats.layer, stats.fps)), | 260 | .child(resolution_text(stats.layer, stats.fps)), |
| 261 | ) | 261 | ) |
| 262 | + .child( | ||
| 263 | + div() | ||
| 264 | + .w(px(32.)) | ||
| 265 | + .flex_none() | ||
| 266 | + .text_color(palette.muted) | ||
| 267 | + .child(stats.layer.codec.name()), | ||
| 268 | + ) | ||
| 262 | .child(bar(stats.kbps as f32 / max, color, palette)) | 269 | .child(bar(stats.kbps as f32 / max, color, palette)) |
| 263 | .child( | 270 | .child( |
| 264 | div() | 271 | div() |
| @@ -328,10 +335,14 @@ fn watch_row(chat: &Chat, user_id: Id, kind: Kind, stats: &WatchStats, palette: | |||
| 328 | ) | 335 | ) |
| 329 | .child( | 336 | .child( |
| 330 | div() | 337 | div() |
| 331 | - .w(px(20.)) | 338 | + .w(px(52.)) |
| 332 | .flex_none() | 339 | .flex_none() |
| 333 | .text_color(palette.muted) | 340 | .text_color(palette.muted) |
| 334 | - .child(stats.engine.map_or("…", engine_label)), | 341 | + .child(format!( |
| 342 | + "{} {}", | ||
| 343 | + stats.layer.map_or("…", |layer| layer.codec.name()), | ||
| 344 | + stats.engine.map_or("…", engine_label) | ||
| 345 | + )), | ||
| 335 | ) | 346 | ) |
| 336 | .child( | 347 | .child( |
| 337 | div() | 348 | div() |
| @@ -381,8 +392,7 @@ fn gpu_column(gpu: Gpu, palette: Palette) -> Div { | |||
| 381 | .min_w_0() | 392 | .min_w_0() |
| 382 | .child(header(IconName::MemoryStick, "GPU", palette.text)) | 393 | .child(header(IconName::MemoryStick, "GPU", palette.text)) |
| 383 | .child(meter("3d", gpu.gfx, palette.accent, palette)) | 394 | .child(meter("3d", gpu.gfx, palette.accent, palette)) |
| 384 | - .child(meter("encode", gpu.encode, palette.screen, palette)) | 395 | + .child(meter("video", gpu.video, palette.screen, palette)) |
| 385 | - .child(meter("decode", gpu.decode, palette.ok, palette)) | ||
| 386 | .child(meter_value( | 396 | .child(meter_value( |
| 387 | "vram", | 397 | "vram", |
| 388 | format!("{} MB", gpu.vram_mb), | 398 | format!("{} MB", gpu.vram_mb), |
crates/client/src/share/camera.rsmodified+1 -1
| @@ -126,7 +126,7 @@ fn pick(formats: &[CameraFormat], top: Quality) -> Option<CameraFormat> { | |||
| 126 | formats.iter().copied().min_by_key(|format| { | 126 | formats.iter().copied().min_by_key(|format| { |
| 127 | ( | 127 | ( |
| 128 | format.height() < height, | 128 | format.height() < height, |
| 129 | - format.frame_rate() < refresh, | 129 | + std::cmp::Reverse(format.frame_rate().min(refresh)), |
| 130 | format.height(), | 130 | format.height(), |
| 131 | format.format() == FrameFormat::MJPEG, | 131 | format.format() == FrameFormat::MJPEG, |
| 132 | format.frame_rate().abs_diff(refresh), | 132 | format.frame_rate().abs_diff(refresh), |
crates/client/src/share/capture.rsmodified+1 -0
| @@ -476,6 +476,7 @@ fn on_param(stream: &pw::stream::Stream, state: &mut State, id: u32, param: Opti | |||
| 476 | .checked_div(fps.denom) | 476 | .checked_div(fps.denom) |
| 477 | .filter(|refresh| *refresh > 0) | 477 | .filter(|refresh| *refresh > 0) |
| 478 | .unwrap_or(DEFAULT_REFRESH); | 478 | .unwrap_or(DEFAULT_REFRESH); |
| 479 | + tracing::info!(refresh, "share capture refresh"); | ||
| 479 | state.size = (size.width, size.height); | 480 | state.size = (size.width, size.height); |
| 480 | let _ = state | 481 | let _ = state |
| 481 | .negotiated | 482 | .negotiated |
crates/client/src/share/session.rsmodified+1 -5
| @@ -42,7 +42,6 @@ use crate::media::{ | |||
| 42 | decode::{Engine, VideoDecoder, lock}, | 42 | decode::{Engine, VideoDecoder, lock}, |
| 43 | meter::Meter, | 43 | meter::Meter, |
| 44 | }; | 44 | }; |
| 45 | -use crate::settings::SHARE_QUALITY; | ||
| 46 | use crate::voice::{ | 45 | use crate::voice::{ |
| 47 | Playback, | 46 | Playback, |
| 48 | audio::{self, Audio, Choice, Worker, wait}, | 47 | audio::{self, Audio, Choice, Worker, wait}, |
| @@ -721,10 +720,7 @@ impl Watching { | |||
| 721 | _output: output, | 720 | _output: output, |
| 722 | quality, | 721 | quality, |
| 723 | emitted: None, | 722 | emitted: None, |
| 724 | - rung: ladder | 723 | + rung: 0, |
| 725 | - .iter() | ||
| 726 | - .position(|quality| *quality == SHARE_QUALITY) | ||
| 727 | - .unwrap_or(0), | ||
| 728 | ladder, | 724 | ladder, |
| 729 | clean: 0, | 725 | clean: 0, |
| 730 | hold: 0, | 726 | hold: 0, |
crates/client/src/usage.rsmodified+7 -10
| @@ -11,8 +11,7 @@ pub struct Usage { | |||
| 11 | #[derive(Clone, Copy, Default)] | 11 | #[derive(Clone, Copy, Default)] |
| 12 | pub struct Gpu { | 12 | pub struct Gpu { |
| 13 | pub gfx: f32, | 13 | pub gfx: f32, |
| 14 | - pub encode: f32, | 14 | + pub video: f32, |
| 15 | - pub decode: f32, | ||
| 16 | pub vram_mb: u32, | 15 | pub vram_mb: u32, |
| 17 | } | 16 | } |
| 18 | 17 | ||
| @@ -48,8 +47,7 @@ mod linux { | |||
| 48 | #[derive(Clone, Copy, Default)] | 47 | #[derive(Clone, Copy, Default)] |
| 49 | struct Engines { | 48 | struct Engines { |
| 50 | gfx: u64, | 49 | gfx: u64, |
| 51 | - encode: u64, | 50 | + video: u64, |
| 52 | - decode: u64, | ||
| 53 | vram_kib: u64, | 51 | vram_kib: u64, |
| 54 | } | 52 | } |
| 55 | 53 | ||
| @@ -86,8 +84,7 @@ mod linux { | |||
| 86 | |now: u64, then: u64| now.saturating_sub(then) as f32 / nanos * 100.; | 84 | |now: u64, then: u64| now.saturating_sub(then) as f32 / nanos * 100.; |
| 87 | Gpu { | 85 | Gpu { |
| 88 | gfx: share(gpu.gfx, before.gfx), | 86 | gfx: share(gpu.gfx, before.gfx), |
| 89 | - encode: share(gpu.encode, before.encode), | 87 | + video: share(gpu.video, before.video), |
| 90 | - decode: share(gpu.decode, before.decode), | ||
| 91 | vram_mb: (gpu.vram_kib / 1024) as u32, | 88 | vram_mb: (gpu.vram_kib / 1024) as u32, |
| 92 | } | 89 | } |
| 93 | }), | 90 | }), |
| @@ -172,8 +169,9 @@ mod linux { | |||
| 172 | match key { | 169 | match key { |
| 173 | "drm-client-id" => client = Some(number), | 170 | "drm-client-id" => client = Some(number), |
| 174 | "drm-engine-gfx" => engines.gfx = number, | 171 | "drm-engine-gfx" => engines.gfx = number, |
| 175 | - "drm-engine-enc" => engines.encode = number, | 172 | + "drm-engine-enc" | "drm-engine-dec" | "drm-engine-video" => { |
| 176 | - "drm-engine-dec" => engines.decode = number, | 173 | + engines.video += number |
| 174 | + } | ||
| 177 | "drm-memory-vram" => engines.vram_kib = number, | 175 | "drm-memory-vram" => engines.vram_kib = number, |
| 178 | _ => {} | 176 | _ => {} |
| 179 | } | 177 | } |
| @@ -189,8 +187,7 @@ mod linux { | |||
| 189 | .values() | 187 | .values() |
| 190 | .fold(Engines::default(), |sum, engines| Engines { | 188 | .fold(Engines::default(), |sum, engines| Engines { |
| 191 | gfx: sum.gfx + engines.gfx, | 189 | gfx: sum.gfx + engines.gfx, |
| 192 | - encode: sum.encode + engines.encode, | 190 | + video: sum.video + engines.video, |
| 193 | - decode: sum.decode + engines.decode, | ||
| 194 | vram_kib: sum.vram_kib + engines.vram_kib, | 191 | vram_kib: sum.vram_kib + engines.vram_kib, |
| 195 | }) | 192 | }) |
| 196 | }) | 193 | }) |
crates/common/src/event.rsmodified+8 -2
| @@ -84,13 +84,19 @@ pub enum Event { | |||
| 84 | 84 | ||
| 85 | #[derive(Debug, Clone, Encode, Decode)] | 85 | #[derive(Debug, Clone, Encode, Decode)] |
| 86 | pub enum Media { | 86 | pub enum Media { |
| 87 | - Layers { kind: Kind, layers: Vec<Layer> }, | 87 | + Layers { |
| 88 | + kind: Kind, | ||
| 89 | + layers: Vec<Layer>, | ||
| 90 | + }, | ||
| 88 | Keyframe { | 91 | Keyframe { |
| 89 | kind: Kind, | 92 | kind: Kind, |
| 90 | layer: Layer, | 93 | layer: Layer, |
| 91 | recover: bool, | 94 | recover: bool, |
| 92 | }, | 95 | }, |
| 93 | - Loss { kind: Kind, permille: u16 }, | 96 | + Loss { |
| 97 | + kind: Kind, | ||
| 98 | + permille: u16, | ||
| 99 | + }, | ||
| 94 | VoiceEnded, | 100 | VoiceEnded, |
| 95 | } | 101 | } |
| 96 | 102 | ||
crates/server/src/rooms.rsmodified+7 -2
| @@ -151,7 +151,6 @@ struct Sharer { | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | fn reroute(sharer: &Sharer, sharing: &mut Sharing) -> Vec<Broadcast> { | 153 | fn reroute(sharer: &Sharer, sharing: &mut Sharing) -> Vec<Broadcast> { |
| 154 | - let before = sharing.layers(); | ||
| 155 | let Sharing { | 154 | let Sharing { |
| 156 | source, viewers, .. | 155 | source, viewers, .. |
| 157 | } = sharing; | 156 | } = sharing; |
| @@ -188,7 +187,13 @@ fn reroute(sharer: &Sharer, sharing: &mut Sharing) -> Vec<Broadcast> { | |||
| 188 | true | 187 | true |
| 189 | }); | 188 | }); |
| 190 | 189 | ||
| 191 | - let mut broadcasts = Vec::from_iter(layers_changed(sharer.conn, sharer.kind, sharing, before)); | 190 | + let mut broadcasts = vec![Broadcast::media( |
| 191 | + sharer.conn, | ||
| 192 | + Media::Layers { | ||
| 193 | + kind: sharer.kind, | ||
| 194 | + layers: sharing.layers().into_iter().collect(), | ||
| 195 | + }, | ||
| 196 | + )]; | ||
| 192 | broadcasts.extend(keyframes); | 197 | broadcasts.extend(keyframes); |
| 193 | broadcasts.extend(stopped); | 198 | broadcasts.extend(stopped); |
| 194 | 199 | ||