Skip to content

Commit 3da10e7

Browse files
committed
Throttle WebRTC refresh without forcing keyframes
1 parent 470d654 commit 3da10e7

5 files changed

Lines changed: 8 additions & 3 deletions

File tree

cli/XCWPrivateSimulatorSession.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ typedef void (^XCWPrivateSimulatorEncodedFrameHandler)(NSData *sampleData,
2828
- (BOOL)waitUntilReadyWithTimeout:(NSTimeInterval)timeout;
2929
- (BOOL)waitForFirstEncodedFrameWithTimeout:(NSTimeInterval)timeout;
3030
- (void)requestKeyFrameRefresh;
31+
- (void)requestFrameRefresh;
3132
- (id)addEncodedFrameListener:(XCWPrivateSimulatorEncodedFrameHandler)handler;
3233
- (void)removeEncodedFrameListener:(id)token;
3334

cli/XCWPrivateSimulatorSession.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ - (void)requestKeyFrameRefresh {
167167
[_videoEncoder requestKeyFrame];
168168
}
169169

170+
- (void)requestFrameRefresh {
171+
[self refreshCurrentFrame];
172+
}
173+
170174
- (id)addEncodedFrameListener:(XCWPrivateSimulatorEncodedFrameHandler)handler {
171175
if (handler == nil) {
172176
return [NSUUID UUID];

cli/native/XCWNativeSession.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ - (BOOL)start:(NSError * _Nullable __autoreleasing *)error {
9191
}
9292

9393
- (void)requestRefresh {
94-
[self.session requestKeyFrameRefresh];
94+
[self.session requestFrameRefresh];
9595
}
9696

9797
- (BOOL)sendTouchAtX:(double)x

server/src/simulators/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tokio::time::{timeout, Instant};
1515
use tracing::debug;
1616

1717
const FRAME_BROADCAST_CAPACITY: usize = 240;
18-
const MIN_REFRESH_INTERVAL_MS: u64 = 33;
18+
const MIN_REFRESH_INTERVAL_MS: u64 = 66;
1919

2020
pub struct SimulatorSession {
2121
inner: Arc<SimulatorSessionInner>,

server/src/transport/webrtc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const DEFAULT_STUN_URL: &str = "stun:stun.l.google.com:19302";
2727
const WEBRTC_CONTROL_CHANNEL_LABEL: &str = "simdeck-control";
2828
const WEBRTC_BOOTSTRAP_KEYFRAME_INTERVAL: Duration = Duration::from_millis(250);
2929
const WEBRTC_BOOTSTRAP_KEYFRAME_REPEATS: u8 = 12;
30-
const WEBRTC_REFRESH_INTERVAL: Duration = Duration::from_millis(33);
30+
const WEBRTC_REFRESH_INTERVAL: Duration = Duration::from_millis(66);
3131

3232
#[derive(Debug, Deserialize)]
3333
#[serde(rename_all = "camelCase")]

0 commit comments

Comments
 (0)