From 4a8852bdc8d27c2d22893a670e04d3777af28a9b Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Sat, 2 Sep 2023 20:17:58 +0900 Subject: [PATCH 1/7] Bump Xcode to 15.0. --- .github/workflows/review.yml | 4 +- Cartfile | 2 +- Cartfile.resolved | 2 +- HaishinKit.xcodeproj/project.pbxproj | 71 ++++++++----------- Package.swift | 8 +-- Tests/Codec/VideoCodecTests.swift | 9 --- Tests/HTTP/HTTPRequestTests.swift | 14 ---- .../Media/IOAudioMonitorRingBufferTests.swift | 2 +- Tests/Net/NetStreamTests.swift | 7 -- 9 files changed, 40 insertions(+), 79 deletions(-) delete mode 100644 Tests/Codec/VideoCodecTests.swift delete mode 100644 Tests/HTTP/HTTPRequestTests.swift delete mode 100644 Tests/Net/NetStreamTests.swift diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index a982f40ca..72e58ddc3 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -5,10 +5,12 @@ on: [pull_request] jobs: build: - runs-on: macOS-12 + runs-on: macOS-13 steps: - uses: actions/checkout@v1 + - name: Select Xcode version + run: sudo xcode-select -s '/Applications/Xcode_15.0.app' - name: bundle install run: | bundle install diff --git a/Cartfile b/Cartfile index 16c91dba2..08cbae339 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "shogo4405/Logboard" ~> 2.3.1 +github "shogo4405/Logboard" ~> 2.4.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 26b13e704..3d53ef4de 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "shogo4405/Logboard" "2.3.1" +github "shogo4405/Logboard" "2.4.1" diff --git a/HaishinKit.xcodeproj/project.pbxproj b/HaishinKit.xcodeproj/project.pbxproj index 98075e377..9d0b1830c 100644 --- a/HaishinKit.xcodeproj/project.pbxproj +++ b/HaishinKit.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 290686031DFDB7A7008EB7ED /* RTMPConnectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290686021DFDB7A6008EB7ED /* RTMPConnectionTests.swift */; }; 290EA8901DFB616000053022 /* Foundation+ExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA88E1DFB616000053022 /* Foundation+ExtensionTests.swift */; }; 290EA8911DFB616000053022 /* SwiftCore+ExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA88F1DFB616000053022 /* SwiftCore+ExtensionTests.swift */; }; - 290EA8931DFB617800053022 /* HTTPRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA8921DFB617800053022 /* HTTPRequestTests.swift */; }; 290EA8991DFB619600053022 /* PacketizedElementaryStreamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA8951DFB619600053022 /* PacketizedElementaryStreamTests.swift */; }; 290EA89A1DFB619600053022 /* TSProgramTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA8961DFB619600053022 /* TSProgramTests.swift */; }; 290EA89B1DFB619600053022 /* TSPacketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290EA8971DFB619600053022 /* TSPacketTests.swift */; }; @@ -138,9 +137,9 @@ 2EC97B7227880FF400D8BE32 /* OnTapGestureView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B6E27880FF400D8BE32 /* OnTapGestureView.swift */; }; 2EC97B7327880FF400D8BE32 /* Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B6F27880FF400D8BE32 /* Views.swift */; }; 2EC97B7427880FF400D8BE32 /* MTHKSwiftUiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */; }; - BC0BF4F22985FA9000D72CB4 /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; platformFilters = (ios, maccatalyst, ); }; + BC0394562AA8A384006EDE38 /* Logboard.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; }; + BC0BF4F22985FA9000D72CB4 /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; }; BC0BF4F529866FDE00D72CB4 /* IOMixerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */; }; - BC0BF4F72986CE8700D72CB4 /* VideoCodecTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0BF4F62986CE8700D72CB4 /* VideoCodecTests.swift */; }; BC0D236D26331BAB001DDA0C /* DataBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0D236C26331BAB001DDA0C /* DataBuffer.swift */; }; BC11023E2917C35B00D48035 /* CVPixelBufferPool+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC11023D2917C35B00D48035 /* CVPixelBufferPool+Extension.swift */; }; BC11024A2925147300D48035 /* IOCaptureUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC1102492925147300D48035 /* IOCaptureUnit.swift */; }; @@ -197,7 +196,6 @@ BC72EF2C25F24E480068F040 /* Logboard.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BC72EF3225F24E500068F040 /* Logboard.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; }; BC72EF3325F24E500068F040 /* Logboard.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - BC7C56892995082700C41A9B /* NetStreamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56882995082700C41A9B /* NetStreamTests.swift */; }; BC7C56B7299E579F00C41A9B /* AudioCodecSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */; }; BC7C56BB299E595000C41A9B /* VideoCodecSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */; }; BC7C56BF299FC38D00C41A9B /* VideoSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56BE299FC38D00C41A9B /* VideoSize.swift */; }; @@ -416,7 +414,6 @@ 290686021DFDB7A6008EB7ED /* RTMPConnectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RTMPConnectionTests.swift; sourceTree = ""; }; 290EA88E1DFB616000053022 /* Foundation+ExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Foundation+ExtensionTests.swift"; sourceTree = ""; }; 290EA88F1DFB616000053022 /* SwiftCore+ExtensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftCore+ExtensionTests.swift"; sourceTree = ""; }; - 290EA8921DFB617800053022 /* HTTPRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPRequestTests.swift; sourceTree = ""; }; 290EA8951DFB619600053022 /* PacketizedElementaryStreamTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PacketizedElementaryStreamTests.swift; sourceTree = ""; }; 290EA8961DFB619600053022 /* TSProgramTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TSProgramTests.swift; sourceTree = ""; }; 290EA8971DFB619600053022 /* TSPacketTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TSPacketTests.swift; sourceTree = ""; }; @@ -552,7 +549,6 @@ 2EC97B6F27880FF400D8BE32 /* Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Views.swift; sourceTree = ""; }; 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTHKSwiftUiView.swift; sourceTree = ""; }; BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOMixerTests.swift; sourceTree = ""; }; - BC0BF4F62986CE8700D72CB4 /* VideoCodecTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCodecTests.swift; sourceTree = ""; }; BC0D236C26331BAB001DDA0C /* DataBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataBuffer.swift; sourceTree = ""; }; BC11023D2917C35B00D48035 /* CVPixelBufferPool+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CVPixelBufferPool+Extension.swift"; sourceTree = ""; }; BC1102492925147300D48035 /* IOCaptureUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOCaptureUnit.swift; sourceTree = ""; }; @@ -595,7 +591,6 @@ BC570B4728E9ACC10098A12C /* IOUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOUnit.swift; sourceTree = ""; }; BC6FC91D29609A6800A746EE /* ShapeFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShapeFactory.swift; sourceTree = ""; }; BC6FC9212961B3D800A746EE /* vImage_CGImageFormat+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "vImage_CGImageFormat+Extension.swift"; sourceTree = ""; }; - BC7C56882995082700C41A9B /* NetStreamTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetStreamTests.swift; sourceTree = ""; }; BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioCodecSettings.swift; sourceTree = ""; }; BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCodecSettings.swift; sourceTree = ""; }; BC7C56BE299FC38D00C41A9B /* VideoSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoSize.swift; sourceTree = ""; }; @@ -647,7 +642,7 @@ BCD91C0C2A700FF50033F9E1 /* IOAudioMonitorRingBufferTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOAudioMonitorRingBufferTests.swift; sourceTree = ""; }; BCFB355324FA275600DC5108 /* PlaybackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackViewController.swift; sourceTree = ""; }; BCFB355924FA40DD00DC5108 /* PlaybackContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackContainerViewController.swift; sourceTree = ""; }; - BCFF640A29C0C44B004EFF2F /* SampleVideo_360x240_5mb_2ch.ts */ = {isa = PBXFileReference; lastKnownFileType = file; path = SampleVideo_360x240_5mb_2ch.ts; sourceTree = ""; }; + BCFF640A29C0C44B004EFF2F /* SampleVideo_360x240_5mb_2ch.ts */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.typescript; path = SampleVideo_360x240_5mb_2ch.ts; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -666,6 +661,7 @@ buildActionMask = 2147483647; files = ( BC0BF4F22985FA9000D72CB4 /* HaishinKit.framework in Frameworks */, + BC0394562AA8A384006EDE38 /* Logboard.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -844,14 +840,6 @@ path = Core; sourceTree = ""; }; - 291C2AD31CE9FF68006F042B /* HTTP */ = { - isa = PBXGroup; - children = ( - 290EA8921DFB617800053022 /* HTTPRequestTests.swift */, - ); - path = HTTP; - sourceTree = ""; - }; 2945CBB31B4BE66000104112 = { isa = PBXGroup; children = ( @@ -907,7 +895,6 @@ children = ( BCCBCE9F29ADF55A0095B51C /* AudioCodecBufferTests.swift */, 2950181F1FFA1BD700358E10 /* AudioCodecTests.swift */, - BC0BF4F62986CE8700D72CB4 /* VideoCodecTests.swift */, ); path = Codec; sourceTree = ""; @@ -1001,10 +988,10 @@ 295018191FFA196800358E10 /* Codec */, 291C2AD21CE9FF48006F042B /* Core */, BC1DC5022A02893600E928ED /* FLV */, - 291C2AD31CE9FF68006F042B /* HTTP */, 291C2ACF1CE9FF2B006F042B /* MPEG */, + 291C2ACF1CE9FF2B006F042B /* MPEG */, + BC0BF4F329866FB700D72CB4 /* Media */, BC0BF4F329866FB700D72CB4 /* Media */, - BCA7C2502A91AA3800882D85 /* Net */, 291C2ACE1CE9FF25006F042B /* RTMP */, 291C2AD01CE9FF33006F042B /* Util */, 295018211FFA1C9D00358E10 /* CMAudioSampleBufferTestUtil.swift */, @@ -1202,14 +1189,6 @@ path = Extension; sourceTree = ""; }; - BCA7C2502A91AA3800882D85 /* Net */ = { - isa = PBXGroup; - children = ( - BC7C56882995082700C41A9B /* NetStreamTests.swift */, - ); - path = Net; - sourceTree = ""; - }; BCCC45972AA289FA0016EFE8 /* SRTHaishinKit */ = { isa = PBXGroup; children = ( @@ -1832,7 +1811,6 @@ 290EA8AC1DFB61E700053022 /* MD5Tests.swift in Sources */, 290EA8A01DFB61B100053022 /* AMFFoundationTests.swift in Sources */, BC8446092A30BFC800609FFD /* CMAudioSampleBufferFactoryTests.swift in Sources */, - BC7C56892995082700C41A9B /* NetStreamTests.swift in Sources */, 2917CB662104CA2800F6823A /* AudioSpecificConfigTests.swift in Sources */, 290EA8AB1DFB61E700053022 /* EventDispatcherTests.swift in Sources */, 290EA8901DFB616000053022 /* Foundation+ExtensionTests.swift in Sources */, @@ -1841,9 +1819,7 @@ BC0BF4F529866FDE00D72CB4 /* IOMixerTests.swift in Sources */, 290EA89A1DFB619600053022 /* TSProgramTests.swift in Sources */, BCCBCEA029ADF55A0095B51C /* AudioCodecBufferTests.swift in Sources */, - BC0BF4F72986CE8700D72CB4 /* VideoCodecTests.swift in Sources */, BC1DC5042A02894D00E928ED /* FLVVideoFourCCTests.swift in Sources */, - 290EA8931DFB617800053022 /* HTTPRequestTests.swift in Sources */, BC1DC5122A04E46E00E928ED /* HEVCDecoderConfigurationRecordTests.swift in Sources */, BCA7C24F2A91AA0500882D85 /* IORecorderTests.swift in Sources */, BCD91C0D2A700FF50033F9E1 /* IOAudioMonitorRingBufferTests.swift in Sources */, @@ -1945,10 +1921,6 @@ }; BC0BF4F12985FA5800D72CB4 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - platformFilters = ( - ios, - maccatalyst, - ); target = 2945CBBC1B4BE66000104112 /* HaishinKit */; targetProxy = BC0BF4F02985FA5800D72CB4 /* PBXContainerItemProxy */; }; @@ -2140,7 +2112,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -2148,7 +2120,7 @@ SUPPORTED_PLATFORMS = ""; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 11.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2196,7 +2168,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = ""; @@ -2204,7 +2176,7 @@ SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; - TVOS_DEPLOYMENT_TARGET = 11.0; + TVOS_DEPLOYMENT_TARGET = 12.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2227,6 +2199,7 @@ FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Platforms/iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2234,7 +2207,7 @@ ); MARKETING_VERSION = 1.5.8; ONLY_ACTIVE_ARCH = YES; - "OTHER_SWIFT_FLAGS[arch=*]" = ""; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = com.haishinkit.HaishinKit; PRODUCT_NAME = HaishinKit; PROVISIONING_PROFILE = ""; @@ -2246,6 +2219,7 @@ SWIFT_INCLUDE_PATHS = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; @@ -2265,6 +2239,7 @@ FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Platforms/iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2272,6 +2247,7 @@ ); MARKETING_VERSION = 1.5.8; ONLY_ACTIVE_ARCH = NO; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = com.haishinkit.HaishinKit; PRODUCT_NAME = HaishinKit; PROVISIONING_PROFILE = ""; @@ -2283,6 +2259,7 @@ SWIFT_INCLUDE_PATHS = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Release; }; @@ -2307,6 +2284,7 @@ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -2332,6 +2310,7 @@ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -2357,6 +2336,7 @@ "@executable_path/Frameworks", ); ONLY_ACTIVE_ARCH = YES; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2387,6 +2367,7 @@ "$(inherited)", "@executable_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2414,6 +2395,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -2439,6 +2421,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.13; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-macOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -2466,6 +2449,7 @@ "$(inherited)", "@executable_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.Example-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; @@ -2495,6 +2479,7 @@ "$(inherited)", "@executable_path/Frameworks", ); + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.Example-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; @@ -2531,7 +2516,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Shogo Endo. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2542,6 +2527,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = com.haishinkit.HaishinKit.SRTHaishinKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2581,7 +2567,7 @@ GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2023 Shogo Endo. All rights reserved."; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2591,6 +2577,7 @@ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; MTL_FAST_MATH = YES; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = com.haishinkit.HaishinKit.SRTHaishinKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2640,6 +2627,7 @@ MARKETING_VERSION = 1.0.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-iOS-SwiftUI"; PRODUCT_NAME = "Example iOS+SwiftUI"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -2685,6 +2673,7 @@ ); MARKETING_VERSION = 1.0.0; MTL_FAST_MATH = YES; + OTHER_SWIFT_FLAGS = "-enable-upcoming-feature ExistentialAny"; PRODUCT_BUNDLE_IDENTIFIER = "com.haishinkit.HaishinKit.Example-iOS-SwiftUI"; PRODUCT_NAME = "Example iOS+SwiftUI"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/Package.swift b/Package.swift index 377a72ec6..1658a6963 100644 --- a/Package.swift +++ b/Package.swift @@ -1,12 +1,12 @@ -// swift-tools-version:5.5 +// swift-tools-version:5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "HaishinKit", platforms: [ - .iOS(.v11), - .tvOS(.v11), + .iOS(.v12), + .tvOS(.v12), .macOS(.v10_13), .macCatalyst(.v14) ], @@ -15,7 +15,7 @@ let package = Package( .library(name: "SRTHaishinKit", targets: ["SRTHaishinKit"]) ], dependencies: [ - .package(url: "https://github.com/shogo4405/Logboard.git", "2.3.1"..<"2.4.0") + .package(url: "https://github.com/shogo4405/Logboard.git", "2.4.1"..<"2.5.0") ], targets: [ .binaryTarget( diff --git a/Tests/Codec/VideoCodecTests.swift b/Tests/Codec/VideoCodecTests.swift deleted file mode 100644 index 29095b27f..000000000 --- a/Tests/Codec/VideoCodecTests.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation -import XCTest -import AVFoundation - -@testable import HaishinKit - -final class VideoCodecTests: XCTestCase { -} - diff --git a/Tests/HTTP/HTTPRequestTests.swift b/Tests/HTTP/HTTPRequestTests.swift deleted file mode 100644 index 9a5917197..000000000 --- a/Tests/HTTP/HTTPRequestTests.swift +++ /dev/null @@ -1,14 +0,0 @@ -import Foundation -import XCTest - -@testable import HaishinKit - -final class HTTPRequestTests: XCTestCase { - - static let data: [UInt8] = [71, 69, 84, 32, 47, 104, 111, 103, 101, 47, 116, 101, 115, 116, 46, 116, 115, 32, 72, 84, 84, 80, 47, 49, 46, 49, 13, 10, 72, 111, 115, 116, 58, 32, 49, 57, 50, 46, 49, 54, 56, 46, 49, 55, 57, 46, 52, 58, 56, 48, 56, 48, 13, 10, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 58, 32, 107, 101, 101, 112, 45, 97, 108, 105, 118, 101, 13, 10, 65, 99, 99, 101, 112, 116, 58, 32, 116, 101, 120, 116, 47, 104, 116, 109, 108, 44, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 120, 104, 116, 109, 108, 43, 120, 109, 108, 44, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 120, 109, 108, 59, 113, 61, 48, 46, 57, 44, 105, 109, 97, 103, 101, 47, 119, 101, 98, 112, 44, 42, 47, 42, 59, 113, 61, 48, 46, 56, 13, 10, 85, 112, 103, 114, 97, 100, 101, 45, 73, 110, 115, 101, 99, 117, 114, 101, 45, 82, 101, 113, 117, 101, 115, 116, 115, 58, 32, 49, 13, 10, 85, 115, 101, 114, 45, 65, 103, 101, 110, 116, 58, 32, 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40, 77, 97, 99, 105, 110, 116, 111, 115, 104, 59, 32, 73, 110, 116, 101, 108, 32, 77, 97, 99, 32, 79, 83, 32, 88, 32, 49, 48, 95, 49, 49, 95, 52, 41, 32, 65, 112, 112, 108, 101, 87, 101, 98, 75, 105, 116, 47, 53, 51, 55, 46, 51, 54, 32, 40, 75, 72, 84, 77, 76, 44, 32, 108, 105, 107, 101, 32, 71, 101, 99, 107, 111, 41, 32, 67, 104, 114, 111, 109, 101, 47, 52, 57, 46, 48, 46, 50, 54, 50, 51, 46, 49, 49, 50, 32, 83, 97, 102, 97, 114, 105, 47, 53, 51, 55, 46, 51, 54, 32, 70, 105, 114, 101, 80, 72, 80, 47, 52, 67, 104, 114, 111, 109, 101, 13, 10, 65, 99, 99, 101, 112, 116, 45, 69, 110, 99, 111, 100, 105, 110, 103, 58, 32, 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 44, 32, 115, 100, 99, 104, 13, 10, 65, 99, 99, 101, 112, 116, 45, 76, 97, 110, 103, 117, 97, 103, 101, 58, 32, 106, 97, 44, 101, 110, 45, 85, 83, 59, 113, 61, 48, 46, 56, 44, 101, 110, 59, 113, 61, 48, 46, 54, 13, 10, 88, 45, 70, 105, 114, 101, 80, 72, 80, 45, 86, 101, 114, 115, 105, 111, 110, 58, 32, 48, 46, 48, 46, 54, 13, 10, 88, 45, 87, 102, 45, 77, 97, 120, 45, 67, 111, 109, 98, 105, 110, 101, 100, 45, 83, 105, 122, 101, 58, 32, 50, 54, 49, 49, 50, 48, 13, 10, 13, 10] - - func testHTTPRequest() { - // var request: HTTPRequest = HTTPRequest(bytes: data) - // request.bytes = HTTPRequestTests.data - } -} diff --git a/Tests/Media/IOAudioMonitorRingBufferTests.swift b/Tests/Media/IOAudioMonitorRingBufferTests.swift index 869319b51..0fab920e3 100644 --- a/Tests/Media/IOAudioMonitorRingBufferTests.swift +++ b/Tests/Media/IOAudioMonitorRingBufferTests.swift @@ -43,7 +43,7 @@ final class IOAudioMonitorRingBufferTests: XCTestCase { readBuffer.frameLength = AVAudioFrameCount(numSamples) for _ in 0..<30 { buffer?.appendSampleBuffer(sinWave) - readBuffer.int16ChannelData?[0].assign(repeating: 0, count: numSamples) + readBuffer.int16ChannelData?[0].update(repeating: 0, count: numSamples) _ = buffer?.render(UInt32(numSamples), ioData: readBuffer.mutableAudioBufferList) XCTAssertEqual(sinWave.dataBuffer?.data?.bytes, Data(bytes: bufferList[0].mData!, count: numSamples * Int(channels) * 2).bytes) } diff --git a/Tests/Net/NetStreamTests.swift b/Tests/Net/NetStreamTests.swift deleted file mode 100644 index 8a947acc9..000000000 --- a/Tests/Net/NetStreamTests.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation -import XCTest - -@testable import HaishinKit - -final class NetStreamTests: XCTestCase { -} From 7cb08c0cd40d0318fccaba562a148e1cd7d2f943 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Sat, 2 Sep 2023 20:48:18 +0900 Subject: [PATCH 2/7] Migration frameInterval to preferredFramesPerSecond. --- Sources/Media/IOUIScreenCaptureUnit.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Media/IOUIScreenCaptureUnit.swift b/Sources/Media/IOUIScreenCaptureUnit.swift index 74c42ec72..8204e302d 100644 --- a/Sources/Media/IOUIScreenCaptureUnit.swift +++ b/Sources/Media/IOUIScreenCaptureUnit.swift @@ -13,7 +13,7 @@ private extension CGRect { // MARK: - /// The IOUIScreenCaptureUnit class captures the UIView. public class IOUIScreenCaptureUnit: NSObject, IOScreenCaptureUnit { - static let defaultFrameInterval: Int = 2 + static let defaultPreferredFramesPerSecond: Int = 30 static let defaultAttributes: [NSString: NSObject] = [ kCVPixelBufferPixelFormatTypeKey: NSNumber(value: kCVPixelFormatType_32BGRA), kCVPixelBufferCGBitmapContextCompatibilityKey: true as NSObject @@ -24,7 +24,7 @@ public class IOUIScreenCaptureUnit: NSObject, IOScreenCaptureUnit { /// Specifies the boolean value that indicates whether the snapshot should be rendered after recent changes have been incorporated. public var afterScreenUpdates = false /// Specifies the number of shaphot that must pass before the display link notifies the target again. - public var frameInterval: Int = IOUIScreenCaptureUnit.defaultFrameInterval + public var preferredFramesPerSecond: Int = IOUIScreenCaptureUnit.defaultPreferredFramesPerSecond /// Specifies the CVPixelBufferPool's attrivutes. public var attributes: [NSString: NSObject] { var attributes: [NSString: NSObject] = IOUIScreenCaptureUnit.defaultAttributes @@ -153,7 +153,7 @@ extension IOUIScreenCaptureUnit: Running { self.pixelBufferPool = nil self.colorSpace = CGColorSpaceCreateDeviceRGB() self.displayLink = CADisplayLink(target: self, selector: #selector(onScreen)) - self.displayLink.frameInterval = self.frameInterval + self.displayLink.preferredFramesPerSecond = self.preferredFramesPerSecond self.displayLink.add(to: .main, forMode: .common) } } From 1c67bf64fc31213ebc6b6375d6ee40625fc39d08 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Sat, 2 Sep 2023 20:29:03 +0900 Subject: [PATCH 3/7] VideoSize to CGSize --- Examples/iOS/Screencast/SampleHandler.swift | 2 +- HaishinKit.xcodeproj/project.pbxproj | 5 ++--- Sources/Codec/VTSessionMode.swift | 4 ++-- Sources/Codec/VideoCodecSettings.swift | 4 ++-- Sources/Codec/VideoSize.swift | 20 -------------------- Sources/Media/IOMixer.swift | 4 ++-- 6 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 Sources/Codec/VideoSize.swift diff --git a/Examples/iOS/Screencast/SampleHandler.swift b/Examples/iOS/Screencast/SampleHandler.swift index 57d337ca8..8d2a9d61b 100644 --- a/Examples/iOS/Screencast/SampleHandler.swift +++ b/Examples/iOS/Screencast/SampleHandler.swift @@ -43,7 +43,7 @@ open class SampleHandler: RPBroadcastSampleHandler { case .video: if let description = CMSampleBufferGetFormatDescription(sampleBuffer) { let dimensions = CMVideoFormatDescriptionGetDimensions(description) - rtmpStream.videoSettings.videoSize = .init(width: dimensions.width, height: dimensions.height) + rtmpStream.videoSettings.videoSize = .init(width: CGFloat(dimensions.width), height: CGFloat(dimensions.height)) rtmpStream.videoSettings.profileLevel = kVTProfileLevel_H264_Baseline_AutoLevel as String } rtmpStream.appendSampleBuffer(sampleBuffer) diff --git a/HaishinKit.xcodeproj/project.pbxproj b/HaishinKit.xcodeproj/project.pbxproj index 9d0b1830c..7db554e49 100644 --- a/HaishinKit.xcodeproj/project.pbxproj +++ b/HaishinKit.xcodeproj/project.pbxproj @@ -198,7 +198,6 @@ BC72EF3325F24E500068F040 /* Logboard.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BC7C56B7299E579F00C41A9B /* AudioCodecSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */; }; BC7C56BB299E595000C41A9B /* VideoCodecSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */; }; - BC7C56BF299FC38D00C41A9B /* VideoSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56BE299FC38D00C41A9B /* VideoSize.swift */; }; BC7C56C329A1F28700C41A9B /* TSReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56C229A1F28700C41A9B /* TSReaderTests.swift */; }; BC7C56C729A7701F00C41A9B /* ESSpecificDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56C629A7701F00C41A9B /* ESSpecificDataTests.swift */; }; BC7C56CD29A786AE00C41A9B /* ADTS.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC7C56CC29A786AE00C41A9B /* ADTS.swift */; }; @@ -593,7 +592,6 @@ BC6FC9212961B3D800A746EE /* vImage_CGImageFormat+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "vImage_CGImageFormat+Extension.swift"; sourceTree = ""; }; BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioCodecSettings.swift; sourceTree = ""; }; BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoCodecSettings.swift; sourceTree = ""; }; - BC7C56BE299FC38D00C41A9B /* VideoSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoSize.swift; sourceTree = ""; }; BC7C56C229A1F28700C41A9B /* TSReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSReaderTests.swift; sourceTree = ""; }; BC7C56C629A7701F00C41A9B /* ESSpecificDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ESSpecificDataTests.swift; sourceTree = ""; }; BC7C56CC29A786AE00C41A9B /* ADTS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADTS.swift; sourceTree = ""; }; @@ -743,6 +741,8 @@ 29B876571CD70A7900FC07DA /* AudioCodec.swift */, BC44A1A823D31E92002D4297 /* AudioCodecRingBuffer.swift */, BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */, + 29B876591CD70A7900FC07DA /* VideoCodec.swift */, + BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */, BC4914A128DDD33D009E2DF6 /* VTSessionConvertible.swift */, BC4914B528DEC2FE009E2DF6 /* VTSessionMode.swift */, BC4914A528DDD367009E2DF6 /* VTSessionOption.swift */, @@ -1766,7 +1766,6 @@ 29B876BE1CD70B3900FC07DA /* EventDispatcher.swift in Sources */, BC2828AF2AA322E400741013 /* AVFrameRateRange+Extension.swift in Sources */, 29B8769D1CD70B1100FC07DA /* NetService.swift in Sources */, - BC7C56BF299FC38D00C41A9B /* VideoSize.swift in Sources */, 29B8769E1CD70B1100FC07DA /* NetSocket.swift in Sources */, 2958911A1EEB8E3F00CE51E1 /* FLVAudioCodec.swift in Sources */, BC4914B628DEC2FE009E2DF6 /* VTSessionMode.swift in Sources */, diff --git a/Sources/Codec/VTSessionMode.swift b/Sources/Codec/VTSessionMode.swift index bd38525dc..fc5b0b5cf 100644 --- a/Sources/Codec/VTSessionMode.swift +++ b/Sources/Codec/VTSessionMode.swift @@ -11,8 +11,8 @@ enum VTSessionMode { var session: VTCompressionSession? var status = VTCompressionSessionCreate( allocator: kCFAllocatorDefault, - width: videoCodec.settings.videoSize.width, - height: videoCodec.settings.videoSize.height, + width: Int32(videoCodec.settings.videoSize.width), + height: Int32(videoCodec.settings.videoSize.height), codecType: videoCodec.settings.format.codecType, encoderSpecification: nil, imageBufferAttributes: videoCodec.attributes as CFDictionary?, diff --git a/Sources/Codec/VideoCodecSettings.swift b/Sources/Codec/VideoCodecSettings.swift index 38bf447a8..21489619d 100644 --- a/Sources/Codec/VideoCodecSettings.swift +++ b/Sources/Codec/VideoCodecSettings.swift @@ -74,7 +74,7 @@ public struct VideoCodecSettings: Codable { } /// Specifies the video size of encoding video. - public var videoSize: VideoSize + public var videoSize: CGSize /// Specifies the bitrate. public var bitRate: UInt32 /// Specifies the keyframeInterval. @@ -102,7 +102,7 @@ public struct VideoCodecSettings: Codable { /// Creates a new VideoCodecSettings instance. public init( - videoSize: VideoSize = .init(width: 854, height: 480), + videoSize: CGSize = .init(width: 854, height: 480), profileLevel: String = kVTProfileLevel_H264_Baseline_3_1 as String, bitRate: UInt32 = 640 * 1000, maxKeyFrameIntervalDuration: Int32 = 2, diff --git a/Sources/Codec/VideoSize.swift b/Sources/Codec/VideoSize.swift deleted file mode 100644 index 6288eab7d..000000000 --- a/Sources/Codec/VideoSize.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -/// The VideoSize class represents video width and height. -public struct VideoSize: Equatable, Codable { - /// The video width. - public let width: Int32 - /// The video height. - public let height: Int32 - - /// Creates a VideoSize object. - public init(width: Int32, height: Int32) { - self.width = width - self.height = height - } - - /// Swap width for height. - public func swap() -> VideoSize { - return VideoSize(width: height, height: width) - } -} diff --git a/Sources/Media/IOMixer.swift b/Sources/Media/IOMixer.swift index bccd3185e..8834aa1c7 100644 --- a/Sources/Media/IOMixer.swift +++ b/Sources/Media/IOMixer.swift @@ -381,8 +381,8 @@ extension IOMixer: Running { let isMultiCamSupported = true #endif guard let device = error.device, let format = device.videoFormat( - width: sessionPreset.width ?? videoIO.codec.settings.videoSize.width, - height: sessionPreset.height ?? videoIO.codec.settings.videoSize.height, + width: sessionPreset.width ?? Int32(videoIO.codec.settings.videoSize.width), + height: sessionPreset.height ?? Int32(videoIO.codec.settings.videoSize.height), frameRate: videoIO.frameRate, isMultiCamSupported: isMultiCamSupported ), device.activeFormat != format else { From df1242d8cdeac0a9a97fb9ce53dda0a096b88b62 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Wed, 6 Sep 2023 21:42:46 +0900 Subject: [PATCH 4/7] Suppress warnings. --- HaishinKit.podspec | 10 +++---- HaishinKit.xcodeproj/project.pbxproj | 16 ++++++++++ ...xpressibleByIntegerLiteral+Extension.swift | 5 ++-- ...sibleByIntegerLiteral+ExtensionTests.swift | 30 +++++++++++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift diff --git a/HaishinKit.podspec b/HaishinKit.podspec index 06573ff49..e598d2a8b 100644 --- a/HaishinKit.podspec +++ b/HaishinKit.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = "HaishinKit" - s.version = "1.5.8" + s.version = "1.6.0" s.summary = "Camera and Microphone streaming library via RTMP, HLS for iOS, macOS and tvOS." - s.swift_version = "5.7" + s.swift_version = "5.8" s.description = <<-DESC HaishinKit. Camera and Microphone streaming library via RTMP, HLS for iOS, macOS and tvOS. @@ -15,16 +15,16 @@ Pod::Spec.new do |s| s.authors = { "shogo4405" => "shogo4405@gmail.com" } s.source = { :git => "https://github.com/shogo4405/HaishinKit.swift.git", :tag => "#{s.version}" } - s.ios.deployment_target = "11.0" + s.ios.deployment_target = "12.0" s.ios.source_files = "Platforms/iOS/*.{h,swift}" s.osx.deployment_target = "10.13" s.osx.source_files = "Platforms/iOS/*.{h,swift}" - s.tvos.deployment_target = "11.0" + s.tvos.deployment_target = "12.0" s.tvos.source_files = "Platforms/iOS/*.{h,swift}" s.source_files = "Sources/**/*.swift" - s.dependency 'Logboard', '~> 2.3.1' + s.dependency 'Logboard', '~> 2.4.1' end diff --git a/HaishinKit.xcodeproj/project.pbxproj b/HaishinKit.xcodeproj/project.pbxproj index 7db554e49..65efe56f1 100644 --- a/HaishinKit.xcodeproj/project.pbxproj +++ b/HaishinKit.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 2EC97B7327880FF400D8BE32 /* Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B6F27880FF400D8BE32 /* Views.swift */; }; 2EC97B7427880FF400D8BE32 /* MTHKSwiftUiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */; }; BC0394562AA8A384006EDE38 /* Logboard.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; }; + BC03945F2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */; }; BC0BF4F22985FA9000D72CB4 /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; }; BC0BF4F529866FDE00D72CB4 /* IOMixerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */; }; BC0D236D26331BAB001DDA0C /* DataBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0D236C26331BAB001DDA0C /* DataBuffer.swift */; }; @@ -547,6 +548,7 @@ 2EC97B6E27880FF400D8BE32 /* OnTapGestureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnTapGestureView.swift; sourceTree = ""; }; 2EC97B6F27880FF400D8BE32 /* Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Views.swift; sourceTree = ""; }; 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTHKSwiftUiView.swift; sourceTree = ""; }; + BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ExpressibleByIntegerLiteral+ExtensionTests.swift"; sourceTree = ""; }; BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOMixerTests.swift; sourceTree = ""; }; BC0D236C26331BAB001DDA0C /* DataBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataBuffer.swift; sourceTree = ""; }; BC11023D2917C35B00D48035 /* CVPixelBufferPool+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CVPixelBufferPool+Extension.swift"; sourceTree = ""; }; @@ -984,10 +986,15 @@ 29798E5A1CE60E5300F5CBD0 /* Tests */ = { isa = PBXGroup; children = ( + 29798E5D1CE60E5300F5CBD0 /* Info.plist */, + 295018211FFA1C9D00358E10 /* CMAudioSampleBufferTestUtil.swift */, + 294637A71EC89BC9008EEC71 /* Config.swift */, 291C2AD11CE9FF3E006F042B /* Asset */, 295018191FFA196800358E10 /* Codec */, 291C2AD21CE9FF48006F042B /* Core */, + BC03945D2AA8AFDD006EDE38 /* Extension */, BC1DC5022A02893600E928ED /* FLV */, + BC0BF4F329866FB700D72CB4 /* Media */, 291C2ACF1CE9FF2B006F042B /* MPEG */, 291C2ACF1CE9FF2B006F042B /* MPEG */, BC0BF4F329866FB700D72CB4 /* Media */, @@ -1160,6 +1167,14 @@ path = View; sourceTree = ""; }; + BC03945D2AA8AFDD006EDE38 /* Extension */ = { + isa = PBXGroup; + children = ( + BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */, + ); + path = Extension; + sourceTree = ""; + }; BC0BF4F329866FB700D72CB4 /* Media */ = { isa = PBXGroup; children = ( @@ -1827,6 +1842,7 @@ BCCBCE9B29A9D96A0095B51C /* NALUnitReaderTests.swift in Sources */, 290EA8A11DFB61B100053022 /* RTMPChunkTests.swift in Sources */, 290EA89F1DFB61B100053022 /* AMF0SerializerTests.swift in Sources */, + BC03945F2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift in Sources */, 290EA8AA1DFB61E700053022 /* CRC32Tests.swift in Sources */, 035AFA042263868E009DD0BB /* RTMPStreamTests.swift in Sources */, 290686031DFDB7A7008EB7ED /* RTMPConnectionTests.swift in Sources */, diff --git a/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift b/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift index f28be0e61..18e73618b 100644 --- a/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift +++ b/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift @@ -2,8 +2,9 @@ import Foundation extension ExpressibleByIntegerLiteral { var data: Data { - var value: Self = self - return Data(bytes: &value, count: MemoryLayout.size) + return withUnsafePointer(to: self) { value in + return Data(bytes: UnsafeRawPointer(value), count: MemoryLayout.size) + } } init(data: Data) { diff --git a/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift b/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift new file mode 100644 index 000000000..4f4b43ba1 --- /dev/null +++ b/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift @@ -0,0 +1,30 @@ +import Foundation +import XCTest + +@testable import HaishinKit + +final class ExpressibleByIntegerLiteralTests: XCTestCase { + func testInt32() { + XCTAssertEqual(Int32.min.bigEndian.data, Data([128, 0, 0, 0])) + XCTAssertEqual(Int32(32).bigEndian.data, Data([0, 0, 0, 32])) + XCTAssertEqual(Int32.max.bigEndian.data, Data([127, 255, 255, 255])) + } + + func testUInt32() { + XCTAssertEqual(UInt32.min.bigEndian.data, Data([0, 0, 0, 0])) + XCTAssertEqual(UInt32(32).bigEndian.data, Data([0, 0, 0, 32])) + XCTAssertEqual(UInt32.max.bigEndian.data, Data([255, 255, 255, 255])) + } + + func testInt64() { + XCTAssertEqual(Int64.min.bigEndian.data, Data([128, 0, 0, 0, 0, 0, 0, 0])) + XCTAssertEqual(Int64(32).bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 32])) + XCTAssertEqual(Int64.max.bigEndian.data, Data([127,255,255, 255, 255, 255, 255, 255])) + } + + func testUInt64() { + XCTAssertEqual(UInt64.min.bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 0])) + XCTAssertEqual(UInt64(32).bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 32])) + XCTAssertEqual(UInt64.max.bigEndian.data, Data([255, 255, 255, 255, 255, 255, 255, 255])) + } +} From 37d2903b7c0bd1dc81e227e3273f272b97fbf564 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Fri, 8 Sep 2023 02:59:19 +0900 Subject: [PATCH 5/7] Update RTMPStream.swift --- HaishinKit.xcodeproj/project.pbxproj | 9 --------- Package.swift | 2 +- Sources/RTMP/RTMPStream.swift | 4 ++-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/HaishinKit.xcodeproj/project.pbxproj b/HaishinKit.xcodeproj/project.pbxproj index 65efe56f1..8956a9412 100644 --- a/HaishinKit.xcodeproj/project.pbxproj +++ b/HaishinKit.xcodeproj/project.pbxproj @@ -743,15 +743,12 @@ 29B876571CD70A7900FC07DA /* AudioCodec.swift */, BC44A1A823D31E92002D4297 /* AudioCodecRingBuffer.swift */, BC7C56B6299E579F00C41A9B /* AudioCodecSettings.swift */, - 29B876591CD70A7900FC07DA /* VideoCodec.swift */, - BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */, BC4914A128DDD33D009E2DF6 /* VTSessionConvertible.swift */, BC4914B528DEC2FE009E2DF6 /* VTSessionMode.swift */, BC4914A528DDD367009E2DF6 /* VTSessionOption.swift */, BC4914B128DDFE31009E2DF6 /* VTSessionOptionKey.swift */, 29B876591CD70A7900FC07DA /* VideoCodec.swift */, BC7C56BA299E595000C41A9B /* VideoCodecSettings.swift */, - BC7C56BE299FC38D00C41A9B /* VideoSize.swift */, ); path = Codec; sourceTree = ""; @@ -986,18 +983,12 @@ 29798E5A1CE60E5300F5CBD0 /* Tests */ = { isa = PBXGroup; children = ( - 29798E5D1CE60E5300F5CBD0 /* Info.plist */, - 295018211FFA1C9D00358E10 /* CMAudioSampleBufferTestUtil.swift */, - 294637A71EC89BC9008EEC71 /* Config.swift */, 291C2AD11CE9FF3E006F042B /* Asset */, 295018191FFA196800358E10 /* Codec */, 291C2AD21CE9FF48006F042B /* Core */, BC03945D2AA8AFDD006EDE38 /* Extension */, BC1DC5022A02893600E928ED /* FLV */, - BC0BF4F329866FB700D72CB4 /* Media */, 291C2ACF1CE9FF2B006F042B /* MPEG */, - 291C2ACF1CE9FF2B006F042B /* MPEG */, - BC0BF4F329866FB700D72CB4 /* Media */, BC0BF4F329866FB700D72CB4 /* Media */, 291C2ACE1CE9FF25006F042B /* RTMP */, 291C2AD01CE9FF33006F042B /* Util */, diff --git a/Package.swift b/Package.swift index 1658a6963..e113bf7bf 100644 --- a/Package.swift +++ b/Package.swift @@ -35,7 +35,7 @@ let package = Package( "MPEG", "Net", "RTMP", - "Util", + "Util" ]), .target(name: "SRTHaishinKit", dependencies: [ diff --git a/Sources/RTMP/RTMPStream.swift b/Sources/RTMP/RTMPStream.swift index 2711f977a..5a9720b31 100644 --- a/Sources/RTMP/RTMPStream.swift +++ b/Sources/RTMP/RTMPStream.swift @@ -411,7 +411,7 @@ open class RTMPStream: NetStream { } /// Creates flv metadata for a stream. - open func createMetaData() -> ASObject { + open func makeMetaData() -> ASObject { var metadata: [String: Any] = [:] #if os(iOS) || os(macOS) if mixer.videoIO.capture.device != nil { @@ -521,7 +521,7 @@ open class RTMPStream: NetStream { dataTimeStamps.removeAll() FCPublish() case .publishing: - send(handlerName: "@setDataFrame", arguments: "onMetaData", createMetaData()) + send(handlerName: "@setDataFrame", arguments: "onMetaData", makeMetaData()) mixer.startEncoding(muxer) default: break From 97510b7b15a523833ff75c9a96b3663fdcd2f999 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Mon, 11 Sep 2023 20:21:09 +0900 Subject: [PATCH 6/7] Update README.md --- README.md | 86 +++++++++++++++++++------------------------------------ 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index bfc82ccf0..0612c148a 100644 --- a/README.md +++ b/README.md @@ -57,20 +57,13 @@ Project name |Notes |License - [x] _Tunneled (RTMPT over SSL/TLS) (Technical Preview)_ - [x] _RTMPT (Technical Preview)_ - [x] ReplayKit Live as a Broadcast Upload Extension -- [x] Supported codec - - Audio - - [x] AAC - - Video - - [x] H264/AVC - - ex: `stream.videoSettings.profileLevel = kVTProfileLevel_H264_Baseline_3_1 as String` - - [x] H265/HEVC ([Also server-side must support Enhanced RTMP.](https://github.com/veovera/enhanced-rtmp)) - - ex: `stream.videoSettings.profileLevel = kVTProfileLevel_HEVC_Main_AutoLevel as String` +- [x] Enhanced RTMP + +### HLS +- [x] HTTPService +- [x] HLS Publish ### SRT -It's a different framework. You can use it through SwiftPM. -```swift -import SRTHaishinKit -``` - [x] Publish and Recording (H264/AAC) - [x] Playback(beta) - [ ] mode @@ -78,11 +71,6 @@ import SRTHaishinKit - [x] listener - [ ] rendezvous - -### HLS -- [x] HTTPService -- [x] HLS Publish - ### Multi Camera Supports two camera video sources. A picture-in-picture display that shows the image of the secondary camera of the primary camera. Supports camera split display that displays horizontally and vertically. @@ -113,65 +101,51 @@ rtmpStream.attachAudio(AVCaptureDevice.default(for: .audio)) ### Others - [x] [Support multitasking camera access.](https://developer.apple.com/documentation/avfoundation/capture_setup/accessing_the_camera_while_multitasking) -- [x] _Support tvOS 11.0+ (Technical Preview)_ - - tvOS can't use camera and microphone devices. -- [x] Hardware acceleration for H264 video encoding, AAC audio encoding - [x] Support "Allow app extension API only" option -- [ ] ~~Support GPUImage framework (~> 0.5.12)~~ - - ~~https://github.com/shogo4405/GPUHaishinKit.swift/blob/master/README.md~~ -- [ ] ~~Objective-C Bridging~~ - -## 🌏 Requirements -|-|iOS|OSX|tvOS|Xcode|Swift| -|:----:|:----:|:----:|:----:|:----:|:----:| -|1.5.0+|11.0+|10.13+|10.2+|14.3+|5.7+| -|1.4.0+|11.0+|10.13+|10.2+|14.0+|5.7+| ## 🐾 Examples Examples project are available for iOS with UIKit, iOS with SwiftUI, macOS and tvOS. - [x] Camera and microphone publish. -- [x] RTMP Playback +- [x] RTMP Playback ```sh git clone https://github.com/shogo4405/HaishinKit.swift.git cd HaishinKit.swift -carthage bootstrap --use-xcframeworks +carthage bootstrap -platform iOS,macOS,tvOS --use-xcframeworks open HaishinKit.xcodeproj ``` -## ☕ Cocoa Keys +## 🌏 Requirements + +### Development +|Version|Xcode|Swift| +|:----:|:----:|:----:| +|1.6.0+|15.0+|5.8+| +|1.5.0+|14.0+|5.7+| + +### OS +|-|iOS|tvOS|macOS|visionOS|watchOS| +|:----|:----:|:----:|:----:|:----:|:----:| +|HaishinKit|12.0+|12.0+|10.13+|-|-| +|SRTHaishinKit|12.0+|-|-|-|-| + +### Cocoa Keys Please contains Info.plist. -iOS 10.0+ +**iOS 10.0+** * NSMicrophoneUsageDescription * NSCameraUsageDescription -macOS 10.14+ +**macOS 10.14+** * NSMicrophoneUsageDescription * NSCameraUsageDescription ## 🔧 Installation -### CocoaPods -```rb -source 'https://github.com/CocoaPods/Specs.git' -use_frameworks! - -def import_pods - pod 'HaishinKit', '~> 1.5.8 -end - -target 'Your Target' do - platform :ios, '11.0' - import_pods -end -``` -### Carthage -``` -github "shogo4405/HaishinKit.swift" ~> 1.5.8 -``` -### Swift Package Manager -``` -https://github.com/shogo4405/HaishinKit.swift -``` +HaishinKit has a multi-module configuration. If you want to use the SRT protocol, please use SRTHaishinKit. SRTHaishinKit supports SPM only. +| | HaishinKit | SRTHaishinKit | +| - | :- | :- | +| SPM | https://github.com/shogo4405/HaishinKit.swift | https://github.com/shogo4405/HaishinKit.swift | +| CocoaPods | source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

def import_pods
pod 'HaishinKit', '~> 1.6.0
end

target 'Your Target' do
platform :ios, '12.0'
import_pods
end
| Not supported. | +| Carthage | github "shogo4405/HaishinKit.swift" ~> 1.6.0 | Not supported. | ## 🔧 Prerequisites Make sure you setup and activate your AVAudioSession iOS. From 9df163ef8e620634a4b95830837294de1ed05ec3 Mon Sep 17 00:00:00 2001 From: shogo4405 Date: Mon, 11 Sep 2023 21:04:37 +0900 Subject: [PATCH 7/7] ExistentialAny --- Examples/iOS/LiveViewController.swift | 2 +- SRTHaishinKit/SRTStream.swift | 4 ++-- Sources/HTTP/HTTPStream.swift | 4 ++-- Sources/Media/IORecorder.swift | 6 +++--- Sources/Net/NetStream.swift | 6 +++--- Sources/RTMP/RTMPTSocket.swift | 24 ++++++++++++------------ 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Examples/iOS/LiveViewController.swift b/Examples/iOS/LiveViewController.swift index e9d03afdb..b25ee3432 100644 --- a/Examples/iOS/LiveViewController.swift +++ b/Examples/iOS/LiveViewController.swift @@ -88,7 +88,7 @@ final class LiveViewController: UIViewController { logger.warn(error) } rtmpStream.addObserver(self, forKeyPath: "currentFPS", options: .new, context: nil) - (view as? NetStreamDrawable)?.attachStream(rtmpStream) + (view as? (any NetStreamDrawable))?.attachStream(rtmpStream) NotificationCenter.default.addObserver(self, selector: #selector(didInterruptionNotification(_:)), name: AVAudioSession.interruptionNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didRouteChangeNotification(_:)), name: AVAudioSession.routeChangeNotification, object: nil) } diff --git a/SRTHaishinKit/SRTStream.swift b/SRTHaishinKit/SRTStream.swift index 1a55554c6..5d80d5483 100644 --- a/SRTHaishinKit/SRTStream.swift +++ b/SRTHaishinKit/SRTStream.swift @@ -112,7 +112,7 @@ public class SRTStream: NetStream { writer.expectedMedias.remove(type) } - override public func attachCamera(_ camera: AVCaptureDevice?, onError: ((Error) -> Void)? = nil) { + override public func attachCamera(_ camera: AVCaptureDevice?, onError: ((any Error) -> Void)? = nil) { if camera == nil { writer.expectedMedias.remove(.video) } else { @@ -121,7 +121,7 @@ public class SRTStream: NetStream { super.attachCamera(camera, onError: onError) } - override public func attachAudio(_ audio: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = true, onError: ((Error) -> Void)? = nil) { + override public func attachAudio(_ audio: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = true, onError: ((any Error) -> Void)? = nil) { if audio == nil { writer.expectedMedias.remove(.audio) } else { diff --git a/Sources/HTTP/HTTPStream.swift b/Sources/HTTP/HTTPStream.swift index 14c41cafb..f774d5ec8 100644 --- a/Sources/HTTP/HTTPStream.swift +++ b/Sources/HTTP/HTTPStream.swift @@ -32,7 +32,7 @@ open class HTTPStream: NetStream { } #if os(iOS) || os(macOS) - override open func attachCamera(_ device: AVCaptureDevice?, onError: ((Error) -> Void)? = nil) { + override open func attachCamera(_ device: AVCaptureDevice?, onError: ((any Error) -> Void)? = nil) { if device == nil { tsWriter.expectedMedias.remove(.video) } else { @@ -41,7 +41,7 @@ open class HTTPStream: NetStream { super.attachCamera(device, onError: onError) } - override open func attachAudio(_ device: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = true, onError: ((Error) -> Void)? = nil) { + override open func attachAudio(_ device: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = true, onError: ((any Error) -> Void)? = nil) { if device == nil { tsWriter.expectedMedias.remove(.audio) } else { diff --git a/Sources/Media/IORecorder.swift b/Sources/Media/IORecorder.swift index eb13f964e..0776e471a 100644 --- a/Sources/Media/IORecorder.swift +++ b/Sources/Media/IORecorder.swift @@ -17,13 +17,13 @@ public class IORecorder { /// The IORecorder error domain codes. public enum Error: Swift.Error { /// Failed to create the AVAssetWriter. - case failedToCreateAssetWriter(error: Swift.Error) + case failedToCreateAssetWriter(error: any Swift.Error) /// Failed to create the AVAssetWriterInput. case failedToCreateAssetWriterInput(error: NSException) /// Failed to append the PixelBuffer or SampleBuffer. - case failedToAppend(error: Swift.Error?) + case failedToAppend(error: (any Swift.Error)?) /// Failed to finish writing the AVAssetWriter. - case failedToFinishWriting(error: Swift.Error?) + case failedToFinishWriting(error: (any Swift.Error)?) } /// The default output settings for an IORecorder. diff --git a/Sources/Net/NetStream.swift b/Sources/Net/NetStream.swift index 908565106..cd581644a 100644 --- a/Sources/Net/NetStream.swift +++ b/Sources/Net/NetStream.swift @@ -191,7 +191,7 @@ open class NetStream: NSObject { #if os(iOS) || os(macOS) /// Attaches the primary camera object. /// - Warning: This method can't use appendSampleBuffer at the same time. - open func attachCamera(_ device: AVCaptureDevice?, onError: ((_ error: Error) -> Void)? = nil) { + open func attachCamera(_ device: AVCaptureDevice?, onError: ((_ error: any Error) -> Void)? = nil) { lockQueue.async { do { try self.mixer.videoIO.attachCamera(device) @@ -204,7 +204,7 @@ open class NetStream: NSObject { /// Attaches the 2ndary camera object for picture in picture. /// - Warning: This method can't use appendSampleBuffer at the same time. @available(iOS 13.0, *) - open func attachMultiCamera(_ device: AVCaptureDevice?, onError: ((_ error: Error) -> Void)? = nil) { + open func attachMultiCamera(_ device: AVCaptureDevice?, onError: ((_ error: any Error) -> Void)? = nil) { lockQueue.async { do { try self.mixer.videoIO.attachMultiCamera(device) @@ -216,7 +216,7 @@ open class NetStream: NSObject { /// Attaches the audio capture object. /// - Warning: This method can't use appendSampleBuffer at the same time. - open func attachAudio(_ device: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = false, onError: ((_ error: Error) -> Void)? = nil) { + open func attachAudio(_ device: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = false, onError: ((_ error: any Error) -> Void)? = nil) { lockQueue.async { do { try self.mixer.audioIO.attachAudio(device, automaticallyConfiguresApplicationAudioSession: automaticallyConfiguresApplicationAudioSession) diff --git a/Sources/RTMP/RTMPTSocket.swift b/Sources/RTMP/RTMPTSocket.swift index 7eba4e2eb..bb2429242 100644 --- a/Sources/RTMP/RTMPTSocket.swift +++ b/Sources/RTMP/RTMPTSocket.swift @@ -119,14 +119,14 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { doRequest("/close/\(connectionID)", Data(), didClose) } - private func listen(data: Data?, response: URLResponse?, error: Error?) { + private func listen(data: Data?, response: URLResponse?, error: (any Error)?) { lastResponse = Date() if logger.isEnabledFor(level: .trace) { logger.trace("\(String(describing: data)): \(String(describing: response)): \(String(describing: error))") } - if let error: Error = error { + if let error { logger.error("\(error)") if let lastRequestPathComponent: String = self.lastRequestPathComponent, @@ -193,8 +193,8 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { } } - private func didIdent2(data: Data?, response: URLResponse?, error: Error?) { - if let error: Error = error { + private func didIdent2(data: Data?, response: URLResponse?, error: (any Error)?) { + if let error { logger.error("\(error)") } doRequest("/open/1", Data([0x00]), didOpen) @@ -203,8 +203,8 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { } } - private func didOpen(data: Data?, response: URLResponse?, error: Error?) { - if let error: Error = error { + private func didOpen(data: Data?, response: URLResponse?, error: (any Error)?) { + if let error { logger.error("\(error)") } guard let data: Data = data else { @@ -217,8 +217,8 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { } } - private func didIdle0(data: Data?, response: URLResponse?, error: Error?) { - if let error: Error = error { + private func didIdle0(data: Data?, response: URLResponse?, error: (any Error)?) { + if let error { logger.error("\(error)") } connected = true @@ -227,8 +227,8 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { } } - private func didClose(data: Data?, response: URLResponse?, error: Error?) { - if let error: Error = error { + private func didClose(data: Data?, response: URLResponse?, error: (any Error)?) { + if let error { logger.error("\(error)") } connected = false @@ -246,7 +246,7 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { } } - private func didIdle(data: Data?, response: URLResponse?, error: Error?) { + private func didIdle(data: Data?, response: URLResponse?, error: (any Error)?) { listen(data: data, response: response, error: error) } @@ -268,7 +268,7 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible { return data.count } - private func doRequest(_ pathComponent: String, _ data: Data, _ completionHandler: @escaping ((Data?, URLResponse?, Error?) -> Void)) { + private func doRequest(_ pathComponent: String, _ data: Data, _ completionHandler: @escaping ((Data?, URLResponse?, (any Error)?) -> Void)) { isRequesting = true lastRequestPathComponent = pathComponent lastRequestData = data