From a69d7eaede2cdc96d32b10067a41faa07171073c Mon Sep 17 00:00:00 2001 From: Acaki Date: Sat, 12 Jul 2025 11:25:11 +0800 Subject: [PATCH 1/4] build: add new files to pbxproj --- VoidLink.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/VoidLink.xcodeproj/project.pbxproj b/VoidLink.xcodeproj/project.pbxproj index c55fa126..d937423c 100644 --- a/VoidLink.xcodeproj/project.pbxproj +++ b/VoidLink.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ 84E1CDFA2C4FE83400547904 /* SwiftLocalizationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */; }; 84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */; }; 84FD0B542C3134A6006B5BE5 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */; }; + 975BBBF82E220B1A00172669 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 975BBBF72E220B1A00172669 /* SceneDelegate.m */; }; 98181BE92791277400E43572 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 98181BE82791275D00E43572 /* libSDL2.a */; }; 98181BED2791281100E43572 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98181BEC2791281100E43572 /* CoreMotion.framework */; }; 9819CC14254F107A008A7C8E /* RelativeTouchHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 9819CC13254F107A008A7C8E /* RelativeTouchHandler.m */; }; @@ -185,6 +186,8 @@ 84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalizationHelper.h; sourceTree = ""; }; 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizationHelper.m; sourceTree = ""; }; 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; + 975BBBF62E220B1A00172669 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; + 975BBBF72E220B1A00172669 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; 9803CCAB254F9EAF00EE185E /* ConnectionCallbacks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConnectionCallbacks.h; sourceTree = ""; }; 98181BE82791275D00E43572 /* libSDL2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL2.a; path = libs/SDL2/lib/iOS/libSDL2.a; sourceTree = ""; }; 98181BEA2791278300E43572 /* libSDL2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSDL2.a; path = libs/SDL2/lib/tvOS/libSDL2.a; sourceTree = ""; }; @@ -482,6 +485,8 @@ FB290CF919B2C406004C83CF /* VoidLink */ = { isa = PBXGroup; children = ( + 975BBBF62E220B1A00172669 /* SceneDelegate.h */, + 975BBBF72E220B1A00172669 /* SceneDelegate.m */, 84D8EB932C5146AD00FC10A9 /* VoidLink-Bridging-Header.h */, 84FD0B492C312C0B006B5BE5 /* Localization */, 8454AC682C31907F00F0A302 /* iPad.storyboard */, @@ -907,6 +912,7 @@ 84351B102C29ACCB00A77989 /* OSCProfile.m in Sources */, 84351B2C2C29AD6100A77989 /* OSCProfilesTableViewController.m in Sources */, 98D585701C0ED0E800F6CC00 /* TemporarySettings.m in Sources */, + 975BBBF82E220B1A00172669 /* SceneDelegate.m in Sources */, FB89462819F646E200339C8A /* CryptoManager.m in Sources */, DC1F5A07206436B20037755F /* ConnectionHelper.m in Sources */, FB89462E19F646E200339C8A /* PairManager.m in Sources */, From 487f987c2504c191c46d3f9f70f74c48e0979f57 Mon Sep 17 00:00:00 2001 From: Acaki Date: Sat, 12 Jul 2025 11:41:57 +0800 Subject: [PATCH 2/4] Revert "fix: pip video freeze" This reverts commit 04732337756526ceb8cc9ed5ccca7be1325bd449. --- VoidLink/Stream/VideoDecoderRenderer.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/VoidLink/Stream/VideoDecoderRenderer.m b/VoidLink/Stream/VideoDecoderRenderer.m index b1b9238d..246194ef 100644 --- a/VoidLink/Stream/VideoDecoderRenderer.m +++ b/VoidLink/Stream/VideoDecoderRenderer.m @@ -39,11 +39,10 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, - (void)reinitializeDisplayLayer { - if (_displayLayer == nil) { - _displayLayer = [[AVSampleBufferDisplayLayer alloc] init]; - _displayLayer.backgroundColor = [UIColor blackColor].CGColor; - [_view.layer addSublayer:_displayLayer]; - } + CALayer *oldLayer = _displayLayer; + + _displayLayer = [[AVSampleBufferDisplayLayer alloc] init]; + _displayLayer.backgroundColor = [UIColor blackColor].CGColor; // Ensure the AVSampleBufferDisplayLayer is sized to preserve the aspect ratio // of the video stream. We used to use AVLayerVideoGravityResizeAspect, but that @@ -64,6 +63,14 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, // can see the loading progress label as the stream is starting. _displayLayer.hidden = YES; + if (oldLayer != nil) { + // Switch out the old display layer with the new one + [_view.layer replaceSublayer:oldLayer with:_displayLayer]; + } + else { + [_view.layer addSublayer:_displayLayer]; + } + if (formatDesc != nil) { CFRelease(formatDesc); formatDesc = nil; From 4b8691b943cd7878d39efa9d5abf86f104ac32e2 Mon Sep 17 00:00:00 2001 From: Acaki Date: Sat, 12 Jul 2025 14:45:51 +0800 Subject: [PATCH 3/4] fix: missing pip outlet for iphone --- VoidLink/Base.lproj/iPhone.storyboard | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index 8bbac237..0a3adbef 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -1586,6 +1586,8 @@ + + From e61e96b352c980fea6c3965f7d54a9c2e6b3169d Mon Sep 17 00:00:00 2001 From: Acaki Date: Sat, 12 Jul 2025 15:33:14 +0800 Subject: [PATCH 4/4] fix: background stream issues --- VoidLink/Stream/VideoDecoderRenderer.m | 25 +++++++++---------- .../StreamFrameViewController.m | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/VoidLink/Stream/VideoDecoderRenderer.m b/VoidLink/Stream/VideoDecoderRenderer.m index 246194ef..c29cfbe7 100644 --- a/VoidLink/Stream/VideoDecoderRenderer.m +++ b/VoidLink/Stream/VideoDecoderRenderer.m @@ -39,10 +39,12 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, - (void)reinitializeDisplayLayer { - CALayer *oldLayer = _displayLayer; - - _displayLayer = [[AVSampleBufferDisplayLayer alloc] init]; - _displayLayer.backgroundColor = [UIColor blackColor].CGColor; + if (_displayLayer == nil) { + _displayLayer = [[AVSampleBufferDisplayLayer alloc] init]; + _displayLayer.backgroundColor = [UIColor blackColor].CGColor; + _displayLayer.videoGravity = AVLayerVideoGravityResize; + [_view.layer addSublayer:_displayLayer]; + } // Ensure the AVSampleBufferDisplayLayer is sized to preserve the aspect ratio // of the video stream. We used to use AVLayerVideoGravityResizeAspect, but that @@ -55,22 +57,17 @@ extern int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size, } else { videoSize = CGSizeMake(_view.bounds.size.width, _view.bounds.size.width / _streamAspectRatio); } + + [CATransaction begin]; + [CATransaction setDisableActions:YES]; _displayLayer.position = CGPointMake(CGRectGetMidX(_view.bounds), CGRectGetMidY(_view.bounds)); _displayLayer.bounds = CGRectMake(0, 0, videoSize.width, videoSize.height); - _displayLayer.videoGravity = AVLayerVideoGravityResize; + [CATransaction commit]; // Hide the layer until we get an IDR frame. This ensures we // can see the loading progress label as the stream is starting. _displayLayer.hidden = YES; - if (oldLayer != nil) { - // Switch out the old display layer with the new one - [_view.layer replaceSublayer:oldLayer with:_displayLayer]; - } - else { - [_view.layer addSublayer:_displayLayer]; - } - if (formatDesc != nil) { CFRelease(formatDesc); formatDesc = nil; @@ -525,6 +522,8 @@ int DrSubmitDecodeUnit(PDECODE_UNIT decodeUnit); if (_displayLayer.status == AVQueuedSampleBufferRenderingStatusFailed) { Log(LOG_E, @"Display layer rendering failed: %@", _displayLayer.error); + [self->_displayLayer flushAndRemoveImage]; + // Recreate the display layer. We are already on the main thread, // so this is safe to do right here. [self reinitializeDisplayLayer]; diff --git a/VoidLink/ViewControllers/StreamFrameViewController.m b/VoidLink/ViewControllers/StreamFrameViewController.m index 37014faf..8b27b85c 100644 --- a/VoidLink/ViewControllers/StreamFrameViewController.m +++ b/VoidLink/ViewControllers/StreamFrameViewController.m @@ -889,7 +889,7 @@ #if !TARGET_OS_TV // Terminate the stream if the app is inactive for 60 seconds Log(LOG_I, @"Starting inactivity termination timer"); - _inactivityTimer = [NSTimer scheduledTimerWithTimeInterval:60 + _inactivityTimer = [NSTimer scheduledTimerWithTimeInterval:1800 target:self selector:@selector(inactiveTimerExpired:) userInfo:nil