diff --git a/MembraneRTC.podspec b/MembraneRTC.podspec index da37deda..4469689c 100644 --- a/MembraneRTC.podspec +++ b/MembraneRTC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.swift_version = '5.0' s.source_files = 'Sources/MembraneRTC/**/*' - s.dependency 'WebRTC-SDK', '=114.5735.08' + s.dependency 'WebRTCMembrane', '=104.5112.17' s.dependency 'SwiftProtobuf' s.dependency 'PromisesSwift' s.dependency 'SwiftPhoenixClient', '~> 4.0.0' diff --git a/MembraneRTCTest/PeerConnectionManagerTest.swift b/MembraneRTCTest/PeerConnectionManagerTest.swift index 0e7f4641..6b85589e 100644 --- a/MembraneRTCTest/PeerConnectionManagerTest.swift +++ b/MembraneRTCTest/PeerConnectionManagerTest.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane import XCTest @testable import MembraneRTC diff --git a/Package.resolved b/Package.resolved index 2720a861..0052fe36 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,6 +1,15 @@ { "object": { "pins": [ + { + "package": "WebRTCMembrane", + "repositoryURL": "https://github.com/jellyfish-dev/ios-webrtc-specs.git", + "state": { + "branch": null, + "revision": "0ca2f6f4786a0592be4ee3046478e9cd138cf043", + "version": "104.5112.17" + } + }, { "package": "Promises", "repositoryURL": "https://github.com/google/promises.git", @@ -19,15 +28,6 @@ "version": "6.6.0" } }, - { - "package": "WebRTC", - "repositoryURL": "https://github.com/webrtc-sdk/Specs.git", - "state": { - "branch": null, - "revision": "4fa8d6d647fc759cdd0265fd413d2f28ea2e0e08", - "version": "114.5735.8" - } - }, { "package": "Starscream", "repositoryURL": "https://github.com/daltoniam/Starscream.git", diff --git a/Package.swift b/Package.swift index 1c52d78e..ab18dbe0 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,8 @@ let package = Package( ) ], dependencies: [ - .package(name: "WebRTC", url: "https://github.com/webrtc-sdk/Specs.git", .exact("114.5735.08")), + .package( + name: "WebRTCMembrane", url: "https://github.com/jellyfish-dev/ios-webrtc-specs.git", .exact("104.5112.17")), .package( name: "SwiftProtobuf", url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.18.0")), @@ -35,7 +36,7 @@ let package = Package( .target( name: "MembraneRTC", dependencies: [ - "WebRTC", "SwiftProtobuf", "Promises", "SwiftPhoenixClient", + "WebRTCMembrane", "SwiftProtobuf", "Promises", "SwiftPhoenixClient", .product(name: "FBLPromises", package: "Promises"), .product(name: "Logging", package: "swift-log"), ], diff --git a/ScreenBroadcastExt/SampleHandler.swift b/ScreenBroadcastExt/SampleHandler.swift index dbce776b..1c298058 100644 --- a/ScreenBroadcastExt/SampleHandler.swift +++ b/ScreenBroadcastExt/SampleHandler.swift @@ -1,7 +1,7 @@ import Foundation import MembraneRTC import ReplayKit -import WebRTC +import WebRTCMembrane import os.log /// App Group used by the extension to exchange buffers with the target application diff --git a/Sources/MembraneRTC/Constants.swift b/Sources/MembraneRTC/Constants.swift index 9483f6f2..b4fd8a0b 100644 --- a/Sources/MembraneRTC/Constants.swift +++ b/Sources/MembraneRTC/Constants.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane struct Constants { static func simulcastEncodings() -> [RTCRtpEncodingParameters] { diff --git a/Sources/MembraneRTC/Media/BroadcastSampleSource.swift b/Sources/MembraneRTC/Media/BroadcastSampleSource.swift index e891742c..07dc6820 100644 --- a/Sources/MembraneRTC/Media/BroadcastSampleSource.swift +++ b/Sources/MembraneRTC/Media/BroadcastSampleSource.swift @@ -1,6 +1,6 @@ import CoreMedia import ReplayKit -import WebRTC +import WebRTCMembrane /// A class working as a source of screen broadcast samples. /// diff --git a/Sources/MembraneRTC/Media/Capturers/CameraCapturer.swift b/Sources/MembraneRTC/Media/Capturers/CameraCapturer.swift index 0f806978..e9dc928a 100644 --- a/Sources/MembraneRTC/Media/Capturers/CameraCapturer.swift +++ b/Sources/MembraneRTC/Media/Capturers/CameraCapturer.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// `VideoCapturer` responsible for capturing device's camera. class CameraCapturer: VideoCapturer { diff --git a/Sources/MembraneRTC/Media/Capturers/FileCapturer.swift b/Sources/MembraneRTC/Media/Capturers/FileCapturer.swift index df053fdc..921ce0f7 100644 --- a/Sources/MembraneRTC/Media/Capturers/FileCapturer.swift +++ b/Sources/MembraneRTC/Media/Capturers/FileCapturer.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// `VideoCapturer` responsible for capturing video from given file class FileCapturer: VideoCapturer { diff --git a/Sources/MembraneRTC/Media/Capturers/ScreenBroadcastCapturer.swift b/Sources/MembraneRTC/Media/Capturers/ScreenBroadcastCapturer.swift index 81f2d0d5..23c10f2e 100644 --- a/Sources/MembraneRTC/Media/Capturers/ScreenBroadcastCapturer.swift +++ b/Sources/MembraneRTC/Media/Capturers/ScreenBroadcastCapturer.swift @@ -1,5 +1,5 @@ import Foundation -import WebRTC +import WebRTCMembrane internal func downscaleResolution(from: Dimensions, to: Dimensions) -> Dimensions { if from.height > to.height { diff --git a/Sources/MembraneRTC/Media/Capturers/ScreenCapturer.swift b/Sources/MembraneRTC/Media/Capturers/ScreenCapturer.swift index 73d6d945..a552a77d 100644 --- a/Sources/MembraneRTC/Media/Capturers/ScreenCapturer.swift +++ b/Sources/MembraneRTC/Media/Capturers/ScreenCapturer.swift @@ -1,6 +1,6 @@ import Foundation import ReplayKit -import WebRTC +import WebRTCMembrane /// `VideoCapturer` responsible for capturing in-app screen, for device screen capture go see `BroadcastScreenCapture` class ScreenCapturer: RTCVideoCapturer, VideoCapturer { diff --git a/Sources/MembraneRTC/Media/Tracks/AudioTrack.swift b/Sources/MembraneRTC/Media/Tracks/AudioTrack.swift index 3fb9bc1c..a0104e9b 100644 --- a/Sources/MembraneRTC/Media/Tracks/AudioTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/AudioTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane public class AudioTrack: MediaTrackProvider, Equatable { func rtcTrack() -> RTCMediaStreamTrack { diff --git a/Sources/MembraneRTC/Media/Tracks/LocalAudioTrack.swift b/Sources/MembraneRTC/Media/Tracks/LocalAudioTrack.swift index b5af1e2a..42745c58 100644 --- a/Sources/MembraneRTC/Media/Tracks/LocalAudioTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/LocalAudioTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// Utility wrapper around a local `RTCAudioTrack` managing a local audio session. public class LocalAudioTrack: AudioTrack, LocalTrack { diff --git a/Sources/MembraneRTC/Media/Tracks/LocalScreenBroadcastTrack.swift b/Sources/MembraneRTC/Media/Tracks/LocalScreenBroadcastTrack.swift index 6b51566c..521ac5de 100644 --- a/Sources/MembraneRTC/Media/Tracks/LocalScreenBroadcastTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/LocalScreenBroadcastTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane public protocol LocalScreenBroadcastTrackDelegate: AnyObject { func started() diff --git a/Sources/MembraneRTC/Media/Tracks/LocalVideoTrack.swift b/Sources/MembraneRTC/Media/Tracks/LocalVideoTrack.swift index 691d3d92..c539fbca 100644 --- a/Sources/MembraneRTC/Media/Tracks/LocalVideoTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/LocalVideoTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// Utility wrapper around a local `RTCVideoTrack` also managing an instance of `VideoCapturer` public class LocalVideoTrack: VideoTrack, LocalTrack { diff --git a/Sources/MembraneRTC/Media/Tracks/MediaTrackProvider.swift b/Sources/MembraneRTC/Media/Tracks/MediaTrackProvider.swift index adea6622..08c2f86e 100644 --- a/Sources/MembraneRTC/Media/Tracks/MediaTrackProvider.swift +++ b/Sources/MembraneRTC/Media/Tracks/MediaTrackProvider.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane // a utility protocol that allows to hide WebRTC internals from the package's user // and still alowing the `MembraneRTC` to operate on WebRTC structures diff --git a/Sources/MembraneRTC/Media/Tracks/RemoteAudioTrack.swift b/Sources/MembraneRTC/Media/Tracks/RemoteAudioTrack.swift index f6f23b53..81a5b006 100644 --- a/Sources/MembraneRTC/Media/Tracks/RemoteAudioTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/RemoteAudioTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// Utility wrapper around a remote `RTCAudioTrack`. public class RemoteAudioTrack: AudioTrack, RemoteTrack { diff --git a/Sources/MembraneRTC/Media/Tracks/RemoteVideoTrack.swift b/Sources/MembraneRTC/Media/Tracks/RemoteVideoTrack.swift index 81c72990..c2d2e23c 100644 --- a/Sources/MembraneRTC/Media/Tracks/RemoteVideoTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/RemoteVideoTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// Utility wrapper around a remote `RTCVideoTrack`. public class RemoteVideoTrack: VideoTrack, RemoteTrack { diff --git a/Sources/MembraneRTC/Media/Tracks/VideoTrack.swift b/Sources/MembraneRTC/Media/Tracks/VideoTrack.swift index 608c58cb..88a9f253 100644 --- a/Sources/MembraneRTC/Media/Tracks/VideoTrack.swift +++ b/Sources/MembraneRTC/Media/Tracks/VideoTrack.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane public class VideoTrack: MediaTrackProvider, Equatable { func rtcTrack() -> RTCMediaStreamTrack { diff --git a/Sources/MembraneRTC/MembraneRTC.swift b/Sources/MembraneRTC/MembraneRTC.swift index f669c0c2..04314c74 100644 --- a/Sources/MembraneRTC/MembraneRTC.swift +++ b/Sources/MembraneRTC/MembraneRTC.swift @@ -1,6 +1,6 @@ import Foundation import Logging -import WebRTC +import WebRTCMembrane internal var sdkLogger = Logger(label: "org.membrane.ios") internal let pcLogPrefix = "[PeerConnection]" diff --git a/Sources/MembraneRTC/PeerConnectionFactoryWrapper.swift b/Sources/MembraneRTC/PeerConnectionFactoryWrapper.swift index 0a2d0538..670d450d 100644 --- a/Sources/MembraneRTC/PeerConnectionFactoryWrapper.swift +++ b/Sources/MembraneRTC/PeerConnectionFactoryWrapper.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane // class for managing RTCPeerConnection responsible for managing its media sources and // handling various kinds of notifications @@ -11,11 +11,11 @@ internal class PeerConnectionFactoryWrapper { let decoderFactory = RTCDefaultVideoDecoderFactory() let encoderFactory = getEncoderFactory(from: encoder) - let simulcastFactory = RTCVideoEncoderFactorySimulcast( - primary: encoderFactory, fallback: RTCDefaultVideoEncoderFactory()) + // let simulcastFactory = RTCVideoEncoderFactorySimulcast( + // primary: encoderFactory, fallback: RTCDefaultVideoEncoderFactory()) self.factory = RTCPeerConnectionFactory( - encoderFactory: simulcastFactory, decoderFactory: decoderFactory) + encoderFactory: encoderFactory, decoderFactory: decoderFactory) } func createPeerConnection(_ configuration: RTCConfiguration, constraints: RTCMediaConstraints) diff --git a/Sources/MembraneRTC/PeerConnectionListener.swift b/Sources/MembraneRTC/PeerConnectionListener.swift index aaf88cf2..53208872 100644 --- a/Sources/MembraneRTC/PeerConnectionListener.swift +++ b/Sources/MembraneRTC/PeerConnectionListener.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane internal protocol PeerConnectionListener { func onAddTrack(trackId: String, track: RTCMediaStreamTrack) diff --git a/Sources/MembraneRTC/PeerConnectionManager.swift b/Sources/MembraneRTC/PeerConnectionManager.swift index 5e13dda5..6da2c640 100644 --- a/Sources/MembraneRTC/PeerConnectionManager.swift +++ b/Sources/MembraneRTC/PeerConnectionManager.swift @@ -1,6 +1,6 @@ import Foundation import Logging -import WebRTC +import WebRTCMembrane internal class PeerConnectionManager: NSObject, RTCPeerConnectionDelegate { // `RTCPeerConnection` config diff --git a/Sources/MembraneRTC/Types/Encoder.swift b/Sources/MembraneRTC/Types/Encoder.swift index d19337fa..5a285568 100644 --- a/Sources/MembraneRTC/Types/Encoder.swift +++ b/Sources/MembraneRTC/Types/Encoder.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane /// Enum describing possible encoders. /// `DEFAULT` - default encoder, most likely software vp8 encoder (libvpx) diff --git a/Sources/MembraneRTC/Types/TrackData.swift b/Sources/MembraneRTC/Types/TrackData.swift index b871c864..eba19b1b 100644 --- a/Sources/MembraneRTC/Types/TrackData.swift +++ b/Sources/MembraneRTC/Types/TrackData.swift @@ -1,12 +1,18 @@ -public struct TrackData: Codable{ +public struct TrackData: Codable { public let metadata: Metadata public let simulcastConfig: SimulcastConfig? - - public init (metadata : Metadata, simulcastConfig : SimulcastConfig? = nil) { + + public init(metadata: Metadata, simulcastConfig: SimulcastConfig? = nil) { self.metadata = metadata self.simulcastConfig = simulcastConfig } - + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.metadata = try container.decodeIfPresent(Metadata.self, forKey: .metadata) ?? Metadata() + self.simulcastConfig = try container.decodeIfPresent(SimulcastConfig.self, forKey: .simulcastConfig) + } + func copyWith(metadata: Metadata? = nil, simulcastConfig: SimulcastConfig? = nil) -> TrackData { return TrackData( metadata: metadata ?? self.metadata, diff --git a/Sources/MembraneRTC/UI/VideoView.swift b/Sources/MembraneRTC/UI/VideoView.swift index 11997137..3a3a000e 100644 --- a/Sources/MembraneRTC/UI/VideoView.swift +++ b/Sources/MembraneRTC/UI/VideoView.swift @@ -1,5 +1,5 @@ import UIKit -import WebRTC +import WebRTCMembrane public protocol VideoViewDelegate: AnyObject { func didChange(dimensions: Dimensions) diff --git a/Sources/MembraneRTC/Utilities/SimulcastUtils.swift b/Sources/MembraneRTC/Utilities/SimulcastUtils.swift index 945667c8..2ec0e198 100644 --- a/Sources/MembraneRTC/Utilities/SimulcastUtils.swift +++ b/Sources/MembraneRTC/Utilities/SimulcastUtils.swift @@ -1,4 +1,4 @@ -import WebRTC +import WebRTCMembrane extension RTCRtpEncodingParameters { static func create(rid: String, active: Bool, scaleResolutionDownBy: NSNumber)