diff --git a/Example/MediasoupExample/ViewController.swift b/Example/MediasoupExample/ViewController.swift index 9c31fe0..1351d01 100644 --- a/Example/MediasoupExample/ViewController.swift +++ b/Example/MediasoupExample/ViewController.swift @@ -17,6 +17,8 @@ final class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + // debug + Logger.setLogLevel(with: 3) guard AVCaptureDevice.authorizationStatus(for: .audio) == .authorized else { self.label.text = "accept all permission requests and restart the app" diff --git a/Example/Podfile.lock b/Example/Podfile.lock index a1e1cdc..2b1ac89 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Mediasoup-Client-Swift (0.8.0) + - Mediasoup-Client-Swift (0.8.1) DEPENDENCIES: - Mediasoup-Client-Swift (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Mediasoup-Client-Swift: c6c318be2f5940a25eac32ee983840603de7a56e + Mediasoup-Client-Swift: 3137c3db16de07aab3a9f771bc31254372f7b0bb PODFILE CHECKSUM: d4fe3294dd9c7fc46519b6a7b26527f1f545e8d3 diff --git a/Mediasoup-Client-Swift.podspec b/Mediasoup-Client-Swift.podspec index df2a170..0f74606 100644 --- a/Mediasoup-Client-Swift.podspec +++ b/Mediasoup-Client-Swift.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |spec| } spec.name = "Mediasoup-Client-Swift" - spec.version = "0.8.0" + spec.version = "0.8.1" spec.platform = :ios, "14.0" spec.module_name = "Mediasoup" spec.module_map = "Mediasoup/Mediasoup.modulemap" diff --git a/Mediasoup.xcodeproj/project.pbxproj b/Mediasoup.xcodeproj/project.pbxproj index e8cce34..f0b5b9d 100644 --- a/Mediasoup.xcodeproj/project.pbxproj +++ b/Mediasoup.xcodeproj/project.pbxproj @@ -21,6 +21,9 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 22DEF8D22BBBCC900082149D /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22DEF8D12BBBCC900082149D /* Logger.swift */; }; + 22DEF8D52BBBCCAA0082149D /* LoggerWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 22DEF8D32BBBCCAA0082149D /* LoggerWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 22DEF8D62BBBCCAA0082149D /* LoggerWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 22DEF8D42BBBCCAA0082149D /* LoggerWrapper.mm */; }; FF1E63582A5655830022A44A /* DataConsumerWrapper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = FF1E63522A5655830022A44A /* DataConsumerWrapper.hpp */; settings = {ATTRIBUTES = (Private, ); }; }; FF1E635A2A5655830022A44A /* DataConsumerWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = FF1E63542A5655830022A44A /* DataConsumerWrapper.mm */; }; FF1E635B2A5655830022A44A /* DataConsumerWrapperDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FF1E63552A5655830022A44A /* DataConsumerWrapperDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -87,6 +90,9 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 22DEF8D12BBBCC900082149D /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; + 22DEF8D32BBBCCAA0082149D /* LoggerWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggerWrapper.h; sourceTree = ""; }; + 22DEF8D42BBBCCAA0082149D /* LoggerWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggerWrapper.mm; sourceTree = ""; }; FF1E63522A5655830022A44A /* DataConsumerWrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DataConsumerWrapper.hpp; sourceTree = ""; }; FF1E63532A5655830022A44A /* DataConsumerListenerAdapterDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataConsumerListenerAdapterDelegate.h; sourceTree = ""; }; FF1E63542A5655830022A44A /* DataConsumerWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataConsumerWrapper.mm; sourceTree = ""; }; @@ -181,6 +187,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 2269118E2BBBB35C007DB207 /* Logger */ = { + isa = PBXGroup; + children = ( + 22DEF8D32BBBCCAA0082149D /* LoggerWrapper.h */, + 22DEF8D42BBBCCAA0082149D /* LoggerWrapper.mm */, + ); + path = Logger; + sourceTree = ""; + }; FF1E63512A56555F0022A44A /* DataConsumer */ = { isa = PBXGroup; children = ( @@ -217,6 +232,7 @@ FF3AEE0227F2CDD1001A81AB /* Mediasoup */ = { isa = PBXGroup; children = ( + 22DEF8D12BBBCC900082149D /* Logger.swift */, FF49F0E72804049300B64D36 /* Consumer.swift */, FF49F0E9280404E400B64D36 /* ConsumerDelegate.swift */, FF1E635E2A566C500022A44A /* DataConsumer.swift */, @@ -285,6 +301,7 @@ FF89EFCF27F5C51500EEF5CD /* Mediasoup_Private */ = { isa = PBXGroup; children = ( + 2269118E2BBBB35C007DB207 /* Logger */, FF1E63512A56555F0022A44A /* DataConsumer */, FFB7DDB5282289AD00FE2CC2 /* Consumer */, FF7FA6C827FE9661000B6470 /* Producer */, @@ -371,6 +388,7 @@ FF7FA6CE27FE9A4B000B6470 /* ProducerWrapper.hpp in Headers */, FF1E635B2A5655830022A44A /* DataConsumerWrapperDelegate.h in Headers */, FFB7DDC22823989A00FE2CC2 /* ReceiveTransportListenerAdapter.hpp in Headers */, + 22DEF8D52BBBCCAA0082149D /* LoggerWrapper.h in Headers */, FF61457527F30FDC0067B2C4 /* DeviceWrapper.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -508,7 +526,9 @@ FFF0050D2B5A631D007BA500 /* RTPEncodingParameters+Internal.mm in Sources */, FFF0050B2B5A62FD007BA500 /* RTPEncodingParameters.mm in Sources */, FFC5AC72282500A500C92A96 /* TransportConnectionState.swift in Sources */, + 22DEF8D62BBBCCAA0082149D /* LoggerWrapper.mm in Sources */, FF7FA69A27FAACEE000B6470 /* SendTransportWrapper.mm in Sources */, + 22DEF8D22BBBCC900082149D /* Logger.swift in Sources */, FF7FA69527FAA930000B6470 /* SendTransport.swift in Sources */, FF49F0EA280404E400B64D36 /* ConsumerDelegate.swift in Sources */, FF7FA69127FAA8E9000B6470 /* SendTransportDelegate.swift in Sources */, diff --git a/Mediasoup/Logger.swift b/Mediasoup/Logger.swift new file mode 100644 index 0000000..4b86d12 --- /dev/null +++ b/Mediasoup/Logger.swift @@ -0,0 +1,20 @@ +import Foundation +import Mediasoup_Private + +public class Logger { + public static func setLogLevel(with level: UInt8) { + LoggerWrapper.setLogLevel(level) + } + + public static func error(_ log: String) { + LoggerWrapper.error(withLog: log) + } + + public static func warn(_ log: String) { + LoggerWrapper.warn(withLog: log) + } + + public static func debug(_ log: String) { + LoggerWrapper.debug(withLog: log) + } +} diff --git a/Mediasoup_Private/Logger/LoggerWrapper.h b/Mediasoup_Private/Logger/LoggerWrapper.h new file mode 100644 index 0000000..d85229f --- /dev/null +++ b/Mediasoup_Private/Logger/LoggerWrapper.h @@ -0,0 +1,13 @@ +#ifndef LoggerWrapper_h +#define LoggerWrapper_h + +#import + +@interface LoggerWrapper : NSObject ++ (void)setLogLevel:(uint8_t)level; ++ (void)errorWithLog:(NSString *_Nonnull)log; ++ (void)warnWithLog:(NSString *_Nonnull)log; ++ (void)debugWithLog:(NSString *_Nonnull)log; +@end + +#endif \ No newline at end of file diff --git a/Mediasoup_Private/Logger/LoggerWrapper.mm b/Mediasoup_Private/Logger/LoggerWrapper.mm new file mode 100644 index 0000000..15bc3ce --- /dev/null +++ b/Mediasoup_Private/Logger/LoggerWrapper.mm @@ -0,0 +1,72 @@ +#define MSC_CLASS "LoggerWrapper" + +#import +#import "LoggerWrapper.h" + +#import +#import + +using namespace mediasoupclient; + +class DefaultLogHandler final : public mediasoupclient::Logger::LogHandlerInterface { +public: + DefaultLogHandler() { + } + + void OnLog(mediasoupclient::Logger::LogLevel level, char *payload, size_t len) override { + std::string message(payload, len); + switch (level) { + case mediasoupclient::Logger::LogLevel::LOG_ERROR: + std::cout << message << std::endl; + break; + case mediasoupclient::Logger::LogLevel::LOG_WARN: + std::cout << message << std::endl; + break; + case mediasoupclient::Logger::LogLevel::LOG_DEBUG: + std::cout << message << std::endl; + break; + case mediasoupclient::Logger::LogLevel::LOG_TRACE: + std::cout << message << std::endl; + break; + default: + break; + } + } + + mediasoupclient::Logger::LogLevel toEnum(uint8_t level) { + switch (level) { + case 1: + return mediasoupclient::Logger::LogLevel::LOG_ERROR; + case 2: + return mediasoupclient::Logger::LogLevel::LOG_WARN; + case 3: + return mediasoupclient::Logger::LogLevel::LOG_DEBUG; + case 4: + return mediasoupclient::Logger::LogLevel::LOG_TRACE; + default: + return mediasoupclient::Logger::LogLevel::LOG_NONE; + } + } +}; + +DefaultLogHandler *globalLogHandler = new DefaultLogHandler(); + +@implementation LoggerWrapper ++ (void)setLogLevel:(uint8_t)level { + mediasoupclient::Logger::LogLevel logLevel = globalLogHandler->toEnum(level); + mediasoupclient::Logger::SetLogLevel(logLevel); + mediasoupclient::Logger::SetHandler(globalLogHandler); +} + ++ (void)errorWithLog:(NSString *)log { + MSC_ERROR("%s", log.UTF8String); +} + ++ (void)warnWithLog:(NSString *)log { + MSC_WARN("%s", log.UTF8String); +} + ++ (void)debugWithLog:(NSString *)log { + MSC_DEBUG("%s", log.UTF8String); +} +@end diff --git a/Mediasoup_Private/Mediasoup_Private.modulemap b/Mediasoup_Private/Mediasoup_Private.modulemap index 377d91e..e1e38af 100644 --- a/Mediasoup_Private/Mediasoup_Private.modulemap +++ b/Mediasoup_Private/Mediasoup_Private.modulemap @@ -16,4 +16,5 @@ module Mediasoup_Private { private header "PrivateHeaders/DataConsumerWrapper.hpp" private header "PrivateHeaders/DataConsumerWrapperDelegate.h" private header "PrivateHeaders/ScalabilityMode.h" + private header "PrivateHeaders/LoggerWrapper.h" } diff --git a/Package.swift b/Package.swift index 4c8f1fb..4e5aa25 100644 --- a/Package.swift +++ b/Package.swift @@ -2,9 +2,9 @@ import PackageDescription -let version = "0.8.0" -let mediasoupChecksum = "cad81c6d038021ebe98edb5ff8876e658d253f9d4a721d6ba028616cab32a754" -let webrtcChecksum = "b2186d4cc9f940432d4751f56f657d1d571be39470e3061c47cbbd36fc26383d" +let version = "0.8.1" +let mediasoupChecksum = "d791d60fce826b7efd041c33b8576f0ccefb87c2f31fb216431b7ac294503a0e" +let webrtcChecksum = "6fd8501746d1de14cc2b2aa86d1ea4e081d8ad50ad190c99fb12fdbfdf3257bf" let package = Package( diff --git a/README.md b/README.md index da0f485..7645230 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Swift wrapper for libmediasoupclient with iOS support If you don't need to customize Mediasoup-Client-Swift itself or its dependencies, just use Swift Package Manager or CocoaPods: ```Ruby - pod 'Mediasoup-Client-Swift', '0.8.0' + pod 'Mediasoup-Client-Swift', '0.8.1' ``` 3. **Ease of building from scratch** diff --git a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Info.plist b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Info.plist index 17fef9f..02d7f06 100644 Binary files a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Info.plist and b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Info.plist differ diff --git a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Mediasoup b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Mediasoup index 0443590..4ed2c91 100755 Binary files a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Mediasoup and b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Mediasoup differ diff --git a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo index 10fe195..8833fea 100644 Binary files a/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo and b/bin/Mediasoup.xcframework/ios-arm64/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo differ diff --git a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Info.plist b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Info.plist index 700f945..0d39f30 100644 Binary files a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Info.plist and b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Info.plist differ diff --git a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Mediasoup b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Mediasoup index 244cbe0..1e0c616 100755 Binary files a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Mediasoup and b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Mediasoup differ diff --git a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo index 73ce483..4469d5e 100644 Binary files a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo and b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo differ diff --git a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo index 908a91d..378db9e 100644 Binary files a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo and b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo differ diff --git a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/_CodeSignature/CodeResources b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/_CodeSignature/CodeResources index 89d1fe7..53fd5be 100644 --- a/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/_CodeSignature/CodeResources +++ b/bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/_CodeSignature/CodeResources @@ -10,15 +10,15 @@ Info.plist - nRi2EjqFnDODwy09IKFHivrl7DA= + 5G2KKnbHdTDrTylaZRSgSjTMsEU= Modules/Mediasoup.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo - ZSnoC3NsYHNe3/T+1nGuZb0cFI8= + xmXY62TQvmJQCStVDugnakUv1Ss= Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo - wU5UMWPWPv7+LHY6Ko4g7TF1BvU= + uzwRua7XNqKWUIVIOurM5RlbZiw= Modules/Mediasoup.swiftmodule/arm64-apple-ios-simulator.abi.json @@ -162,14 +162,14 @@ hash2 - NgBFl0peSUfxj+G3rieIjbK6J3XOIBy7hBgjLO9fJdk= + hn9/7gz40ncsuM0LziqRuVzMEXZrQXZjppnzhJi/MY0= Modules/Mediasoup.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo hash2 - 2xhuqvadOgV1gYuZMaJEUqhogxKoTwBXrWka6LXX+jk= + wD4YYMuiw0wM/SJwjuM6E/AFBsI0MnHewZw3ZRLrR1g= Modules/Mediasoup.swiftmodule/arm64-apple-ios-simulator.abi.json diff --git a/bin/WebRTC.xcframework/ios-arm64/WebRTC.framework/Info.plist b/bin/WebRTC.xcframework/ios-arm64/WebRTC.framework/Info.plist index 794c9a2..5da1096 100644 Binary files a/bin/WebRTC.xcframework/ios-arm64/WebRTC.framework/Info.plist and b/bin/WebRTC.xcframework/ios-arm64/WebRTC.framework/Info.plist differ diff --git a/bin/WebRTC.xcframework/ios-arm64_x86_64-simulator/WebRTC.framework/Info.plist b/bin/WebRTC.xcframework/ios-arm64_x86_64-simulator/WebRTC.framework/Info.plist index 22e8c76..cfd443d 100644 Binary files a/bin/WebRTC.xcframework/ios-arm64_x86_64-simulator/WebRTC.framework/Info.plist and b/bin/WebRTC.xcframework/ios-arm64_x86_64-simulator/WebRTC.framework/Info.plist differ diff --git a/bin/mediasoupclient.xcframework/ios-arm64/libmediasoupclient.a b/bin/mediasoupclient.xcframework/ios-arm64/libmediasoupclient.a index 7956f81..c9a92b3 100644 Binary files a/bin/mediasoupclient.xcframework/ios-arm64/libmediasoupclient.a and b/bin/mediasoupclient.xcframework/ios-arm64/libmediasoupclient.a differ diff --git a/bin/mediasoupclient.xcframework/ios-arm64_x86_64-simulator/libmediasoupclient.a b/bin/mediasoupclient.xcframework/ios-arm64_x86_64-simulator/libmediasoupclient.a index 29e596b..f608fae 100644 Binary files a/bin/mediasoupclient.xcframework/ios-arm64_x86_64-simulator/libmediasoupclient.a and b/bin/mediasoupclient.xcframework/ios-arm64_x86_64-simulator/libmediasoupclient.a differ diff --git a/bin/sdptransform.xcframework/Info.plist b/bin/sdptransform.xcframework/Info.plist index bd1e2f6..0fa938d 100644 --- a/bin/sdptransform.xcframework/Info.plist +++ b/bin/sdptransform.xcframework/Info.plist @@ -8,32 +8,32 @@ BinaryPath libsdptransform.a LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath libsdptransform.a SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator BinaryPath libsdptransform.a LibraryIdentifier - ios-arm64_x86_64-simulator + ios-arm64 LibraryPath libsdptransform.a SupportedArchitectures arm64 - x86_64 SupportedPlatform ios - SupportedPlatformVariant - simulator CFBundlePackageType diff --git a/bin/sdptransform.xcframework/ios-arm64/libsdptransform.a b/bin/sdptransform.xcframework/ios-arm64/libsdptransform.a index 0bed88b..1e7d277 100644 Binary files a/bin/sdptransform.xcframework/ios-arm64/libsdptransform.a and b/bin/sdptransform.xcframework/ios-arm64/libsdptransform.a differ diff --git a/bin/sdptransform.xcframework/ios-arm64_x86_64-simulator/libsdptransform.a b/bin/sdptransform.xcframework/ios-arm64_x86_64-simulator/libsdptransform.a index 156ef56..886b2ef 100644 Binary files a/bin/sdptransform.xcframework/ios-arm64_x86_64-simulator/libsdptransform.a and b/bin/sdptransform.xcframework/ios-arm64_x86_64-simulator/libsdptransform.a differ diff --git a/build.sh b/build.sh index e758a9d..de4d0ff 100755 --- a/build.sh +++ b/build.sh @@ -83,7 +83,7 @@ function refetchLibmediasoupclient() { echo 'Cloning libmediasoupclient' cd $WORK_DIR rm -rf libmediasoupclient - git clone -b vl-3.4.1 --depth 1 https://github.com/VLprojects/libmediasoupclient.git + git clone -b vl-m120 --depth 1 https://github.com/VLprojects/libmediasoupclient.git } if [ -d $WORK_DIR/libmediasoupclient ]