Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ concurrency:
cancel-in-progress: false

permissions:
contents: write # commit + tag + GitHub release
id-token: write # OIDC trusted publishing + npm provenance
contents: write # commit + tag + GitHub release
id-token: write # OIDC trusted publishing + npm provenance

jobs:
release:
Expand Down
8 changes: 6 additions & 2 deletions cli/XCWH264Encoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ static int32_t XCWRoundToEvenDimension(double value) {
return rounded;
}

static CGSize XCWScaledDimensionsForSourceSize(int32_t width, int32_t height) {
static CGSize XCWScaledDimensionsForSourceSize(int32_t width, int32_t height, XCWVideoEncoderMode mode) {
if (width <= 0 || height <= 0) {
return CGSizeZero;
}

if (mode == XCWVideoEncoderModeH264Software) {
return CGSizeMake(width, height);
}

int32_t longestEdge = MAX(width, height);
if (longestEdge <= XCWMaximumEncodedDimension) {
return CGSizeMake(width, height);
Expand Down Expand Up @@ -494,7 +498,7 @@ - (BOOL)encodePixelBufferLocked:(CVPixelBufferRef)pixelBuffer {
return NO;
}

CGSize targetSize = XCWScaledDimensionsForSourceSize(sourceWidth, sourceHeight);
CGSize targetSize = XCWScaledDimensionsForSourceSize(sourceWidth, sourceHeight, _encoderMode);
int32_t targetWidth = (int32_t)targetSize.width;
int32_t targetHeight = (int32_t)targetSize.height;
if (targetWidth <= 0 || targetHeight <= 0) {
Expand Down
1 change: 1 addition & 0 deletions cli/XCWPrivateSimulatorSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef void (^XCWPrivateSimulatorEncodedFrameHandler)(NSData *sampleData,
- (BOOL)waitUntilReadyWithTimeout:(NSTimeInterval)timeout;
- (BOOL)waitForFirstEncodedFrameWithTimeout:(NSTimeInterval)timeout;
- (void)requestKeyFrameRefresh;
- (void)requestFrameRefresh;
- (id)addEncodedFrameListener:(XCWPrivateSimulatorEncodedFrameHandler)handler;
- (void)removeEncodedFrameListener:(id)token;

Expand Down
4 changes: 4 additions & 0 deletions cli/XCWPrivateSimulatorSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ - (void)requestKeyFrameRefresh {
[_videoEncoder requestKeyFrame];
}

- (void)requestFrameRefresh {
[self refreshCurrentFrame];
}

- (id)addEncodedFrameListener:(XCWPrivateSimulatorEncodedFrameHandler)handler {
if (handler == nil) {
return [NSUUID UUID];
Expand Down
1 change: 1 addition & 0 deletions cli/native/XCWNativeBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void * _Nullable xcw_native_session_create(const char * _Nonnull udid, char * _N
void xcw_native_session_destroy(void * _Nullable handle);
bool xcw_native_session_start(void * _Nonnull handle, char * _Nullable * _Nullable error_message);
void xcw_native_session_request_refresh(void * _Nonnull handle);
void xcw_native_session_request_keyframe(void * _Nonnull handle);
bool xcw_native_session_send_touch(void * _Nonnull handle, double x, double y, const char * _Nonnull phase, char * _Nullable * _Nullable error_message);
bool xcw_native_session_send_multitouch(void * _Nonnull handle, double x1, double y1, double x2, double y2, const char * _Nonnull phase, char * _Nullable * _Nullable error_message);
bool xcw_native_session_send_key(void * _Nonnull handle, uint16_t key_code, uint32_t modifiers, char * _Nullable * _Nullable error_message);
Expand Down
6 changes: 6 additions & 0 deletions cli/native/XCWNativeBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ void xcw_native_session_request_refresh(void *handle) {
}
}

void xcw_native_session_request_keyframe(void *handle) {
@autoreleasepool {
[XCWNativeSessionFromHandle(handle) requestKeyFrame];
}
}

bool xcw_native_session_send_touch(void *handle, double x, double y, const char *phase, char **error_message) {
@autoreleasepool {
NSError *error = nil;
Expand Down
1 change: 1 addition & 0 deletions cli/native/XCWNativeSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN

- (BOOL)start:(NSError * _Nullable * _Nullable)error;
- (void)requestRefresh;
- (void)requestKeyFrame;
- (BOOL)sendTouchAtX:(double)x
y:(double)y
phase:(NSString *)phase
Expand Down
4 changes: 4 additions & 0 deletions cli/native/XCWNativeSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ - (BOOL)start:(NSError * _Nullable __autoreleasing *)error {
}

- (void)requestRefresh {
[self.session requestFrameRefresh];
}

- (void)requestKeyFrame {
[self.session requestKeyFrameRefresh];
}

Expand Down
Loading
Loading