forge
Explore
Log in

Don't you dare go Hollow

Share watch catch-up only flushes on local backlog. It compared each packet's age since capture against the fastest delay ever seen, so a sender whose frames take over a second to encode and pace (software 4K) made every packet look late: the receiver flushed and reset on every packet and showed 0 fps forever. Packets now carry their arrival time and are skipped only when this receiver queued them for over a second. Disabled Release buttons use a Press::Off style (faint ink) instead of raw opacity, which broke the token test

Browse files at this commit

c258f5268ae78545e984e661c30f03592c71e93fAhmet Kaan GümüşParent: 6357a45
  • fix
    • share watch catch-up only flushes on local backlog. It compared each packet's age since capture against the fastest delay ever seen, so a sender whose frames take over a second to encode and pace (software 4K) made every packet look late: the receiver flushed and reset on every packet and showed 0 fps forever. Packets now carry their arrival time and are skipped only when this receiver queued them for over a second. Disabled Release buttons use a Press::Off style (faint ink) instead of raw opacity, which broke the token test
Show full message
🐛 fix: share watch catch-up only flushes on local backlog. It compared each packet's age since capture against the fastest delay ever seen, so a sender whose frames take over a second to encode and pace (software 4K) made every packet look late: the receiver flushed and reset on every packet and showed 0 fps forever. Packets now carry their arrival time and are skipped only when this receiver queued them for over a second. Disabled Release buttons use a Press::Off style (faint ink) instead of raw opacity, which broke the token test
crates/client/src/gui/builder/release.rsmodified+1 -3
@@ -9,7 +9,6 @@ use gpui_kit::{
9 PathPromptOptions, Styled, WeakEntity, Window,9 PathPromptOptions, Styled, WeakEntity, Window,
10 component::{WindowExt, notification::Notification},10 component::{WindowExt, notification::Notification},
11 div,11 div,
12- prelude::FluentBuilder as _,
13 };12 };
14 13
15 use crate::gui::glyph::Fill as _;14 use crate::gui::glyph::Fill as _;
@@ -85,7 +84,7 @@ fn release_button(
85 parts::button(84 parts::button(
86 id,85 id,
87 label,86 label,
88- Press::Plain,87+ if enabled { Press::Plain } else { Press::Off },
89 palette.tokens,88 palette.tokens,
90 entity_action(entity, move |yumush, window, cx| {89 entity_action(entity, move |yumush, window, cx| {
91 if enabled {90 if enabled {
@@ -93,7 +92,6 @@ fn release_button(
93 }92 }
94 }),93 }),
95 )94 )
96- .when(!enabled, |this| this.opacity(0.4))
97 .into_any_element()95 .into_any_element()
98 }96 }
99 97
crates/client/src/gui/parts.rsmodified+3 -0
@@ -250,6 +250,7 @@ pub enum Press {
250 Plain,250 Plain,
251 Primary,251 Primary,
252 Danger,252 Danger,
253+ Off,
253 }254 }
254 255
255 pub fn button(256 pub fn button(
@@ -265,6 +266,8 @@ pub fn button(
265 .child(words(label, Text::Ui, Ink::Paper, t).font_weight(FontWeight::MEDIUM)),266 .child(words(label, Text::Ui, Ink::Paper, t).font_weight(FontWeight::MEDIUM)),
266 Press::Danger => press(id, t, on_click)267 Press::Danger => press(id, t, on_click)
267 .child(words(label, Text::Ui, Ink::Bad, t).font_weight(FontWeight::MEDIUM)),268 .child(words(label, Text::Ui, Ink::Bad, t).font_weight(FontWeight::MEDIUM)),
269+ Press::Off => press(id, t, |_, _| {})
270+ .child(words(label, Text::Ui, Ink::Faint, t).font_weight(FontWeight::MEDIUM)),
268 Press::Primary => pill(id, t, on_click).child(271 Press::Primary => pill(id, t, on_click).child(
269 words(label, Text::Ui, Ink::Paper, t)272 words(label, Text::Ui, Ink::Paper, t)
270 .font_weight(FontWeight::SEMIBOLD)273 .font_weight(FontWeight::SEMIBOLD)
crates/client/src/share/session.rsmodified+16 -12
@@ -61,7 +61,7 @@ const INITIAL_DELAY_MS: i64 = 100;
61 const MIN_DELAY_MS: i64 = 20;61 const MIN_DELAY_MS: i64 = 20;
62 const MAX_DELAY_MS: i64 = 200;62 const MAX_DELAY_MS: i64 = 200;
63 const RESYNC_MS: i64 = 2000;63 const RESYNC_MS: i64 = 2000;
64-const CATCH_UP_MS: i64 = 1000;64+const CATCH_UP: Duration = Duration::from_secs(1);
65 const DELAY_MARGIN_MS: i64 = 8;65 const DELAY_MARGIN_MS: i64 = 8;
66 const DELAY_WINDOW_MS: i64 = 3000;66 const DELAY_WINDOW_MS: i64 = 3000;
67 const DELAY_PERCENTILE: usize = 98;67 const DELAY_PERCENTILE: usize = 98;
@@ -692,7 +692,7 @@ pub struct Watching {
692 video: Arc<Mutex<Video>>,692 video: Arc<Mutex<Video>>,
693 health: Arc<Mutex<Health>>,693 health: Arc<Mutex<Health>>,
694 volume: Arc<AtomicU32>,694 volume: Arc<AtomicU32>,
695- video_tx: Sender<Bytes>,695+ video_tx: Sender<(Instant, Bytes)>,
696 audio_tx: Option<Sender<Bytes>>,696 audio_tx: Option<Sender<Bytes>>,
697 meter: Meter,697 meter: Meter,
698 received: AtomicU64,698 received: AtomicU64,
@@ -795,16 +795,22 @@ impl Watching {
795 }795 }
796 796
797 pub fn receive(&self, datagram: &Bytes, packet: &Packet<'_>) {797 pub fn receive(&self, datagram: &Bytes, packet: &Packet<'_>) {
798- let (ts_ms, tx) = match packet {798+ let ts_ms = match packet {
799- Packet::Video { ts_ms, .. } => (*ts_ms, Some(&self.video_tx)),799+ Packet::Video { ts_ms, .. } | Packet::ScreenAudio { ts_ms, .. } => *ts_ms,
800- Packet::ScreenAudio { ts_ms, .. } => (*ts_ms, self.audio_tx.as_ref()),
801 Packet::Voice { .. } | Packet::Nack { .. } | Packet::Ack { .. } => return,800 Packet::Voice { .. } | Packet::Nack { .. } | Packet::Ack { .. } => return,
802 };801 };
803 self.clock.observe(ts_ms);802 self.clock.observe(ts_ms);
804 self.received803 self.received
805 .fetch_add((datagram.len() - RELAY_PREFIX) as u64, Ordering::Relaxed);804 .fetch_add((datagram.len() - RELAY_PREFIX) as u64, Ordering::Relaxed);
806- if let Some(tx) = tx {805+ match packet {
807- let _ = tx.send(datagram.clone());806+ Packet::Video { .. } => {
807+ let _ = self.video_tx.send((Instant::now(), datagram.clone()));
808+ }
809+ _ => {
810+ if let Some(tx) = &self.audio_tx {
811+ let _ = tx.send(datagram.clone());
812+ }
813+ }
808 }814 }
809 }815 }
810 816
@@ -1043,7 +1049,7 @@ impl Feedback {
1043 }1049 }
1044 1050
1045 fn watch_video(1051 fn watch_video(
1046- rx: Receiver<Bytes>,1052+ rx: Receiver<(Instant, Bytes)>,
1047 feedback: &Feedback,1053 feedback: &Feedback,
1048 clock: &Clock,1054 clock: &Clock,
1049 video: &Mutex<Video>,1055 video: &Mutex<Video>,
@@ -1068,10 +1074,8 @@ fn watch_video(
1068 };1074 };
1069 while !stop.load(Ordering::Relaxed) {1075 while !stop.load(Ordering::Relaxed) {
1070 match rx.recv_timeout(NACK_TICK) {1076 match rx.recv_timeout(NACK_TICK) {
1071- Ok(bytes) => {1077+ Ok((arrived, bytes)) => {
1072- if let Some((_, Packet::Video { ts_ms, .. })) = split(&bytes)1078+ if arrived.elapsed() > CATCH_UP {
1073- && clock.now() - clock.origin(ts_ms) > CATCH_UP_MS
1074- {
1075 while rx.try_recv().is_ok() {}1079 while rx.try_recv().is_ok() {}
1076 reassembler = Reassembler::new();1080 reassembler = Reassembler::new();
1077 tracing::warn!("share watch fell behind, skipping to the next keyframe");1081 tracing::warn!("share watch fell behind, skipping to the next keyframe");