Skip to content

Commit bc4f9e7

Browse files
committed
internal renaming
1 parent 7e28cd3 commit bc4f9e7

20 files changed

+37
-39
lines changed

Sources/LiveKit/Broadcast/BroadcastScreenCapturer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public extension LocalVideoTrack {
9595
options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
9696
reportStatistics: Bool = false) -> LocalVideoTrack
9797
{
98-
let videoSource = Engine.createVideoSource(forScreenShare: true)
98+
let videoSource = RTC.createVideoSource(forScreenShare: true)
9999
let capturer = BroadcastScreenCapturer(delegate: videoSource, options: BufferCaptureOptions(from: options))
100100
return LocalVideoTrack(
101101
name: name,

Sources/LiveKit/Core/DataChannelPairActor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ actor DataChannelPairActor: NSObject, Loggable {
8585
}
8686

8787
let serializedData = try packet.serializedData()
88-
let rtcData = Engine.createDataBuffer(data: serializedData)
88+
let rtcData = RTC.createDataBuffer(data: serializedData)
8989

9090
let channel = (kind == .reliable) ? _reliableChannel : _lossyChannel
9191
guard let sendDataResult = channel?.sendData(rtcData), sendDataResult else {

Sources/LiveKit/Core/Engine.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ extension Engine {
295295
// data over pub channel for backwards compatibility
296296

297297
let reliableDataChannel = await publisher.dataChannel(for: LKRTCDataChannel.labels.reliable,
298-
configuration: Engine.createDataChannelConfiguration())
298+
configuration: RTC.createDataChannelConfiguration())
299299

300300
let lossyDataChannel = await publisher.dataChannel(for: LKRTCDataChannel.labels.lossy,
301-
configuration: Engine.createDataChannelConfiguration(maxRetransmits: 0))
301+
configuration: RTC.createDataChannelConfiguration(maxRetransmits: 0))
302302

303303
await publisherDataChannel.set(reliable: reliableDataChannel)
304304
await publisherDataChannel.set(lossy: lossyDataChannel)

Sources/LiveKit/Core/Engine+WebRTC.swift Sources/LiveKit/Core/RTC.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Foundation
2121
private extension Array where Element: LKRTCVideoCodecInfo {
2222
func rewriteCodecsIfNeeded() -> [LKRTCVideoCodecInfo] {
2323
// rewrite H264's profileLevelId to 42e032
24-
let codecs = map { $0.name == kRTCVideoCodecH264Name ? Engine.h264BaselineLevel5CodecInfo : $0 }
24+
let codecs = map { $0.name == kRTCVideoCodecH264Name ? RTC.h264BaselineLevel5CodecInfo : $0 }
2525
// logger.log("supportedCodecs: \(codecs.map({ "\($0.name) - \($0.parameters)" }).joined(separator: ", "))", type: Engine.self)
2626
return codecs
2727
}
@@ -45,7 +45,7 @@ private class VideoEncoderFactorySimulcast: LKRTCVideoEncoderFactorySimulcast {
4545
}
4646
}
4747

48-
extension Engine {
48+
class RTC {
4949
static var bypassVoiceProcessing: Bool = false
5050

5151
static let h264BaselineLevel5CodecInfo: LKRTCVideoCodecInfo = {

Sources/LiveKit/Core/Room.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public extension Room {
416416
/// Must be set before RTCPeerConnectionFactory gets initialized.
417417
@objc
418418
static var bypassVoiceProcessing: Bool {
419-
get { Engine.bypassVoiceProcessing }
420-
set { Engine.bypassVoiceProcessing = newValue }
419+
get { RTC.bypassVoiceProcessing }
420+
set { RTC.bypassVoiceProcessing = newValue }
421421
}
422422
}

Sources/LiveKit/Core/SignalClient.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private extension SignalClient {
285285
_delegate.notifyDetached { await $0.signalClient(self, didReceiveOffer: sd.toRTCType()) }
286286

287287
case let .trickle(trickle):
288-
guard let rtcCandidate = try? Engine.createIceCandidate(fromJsonString: trickle.candidateInit) else {
288+
guard let rtcCandidate = try? RTC.createIceCandidate(fromJsonString: trickle.candidateInit) else {
289289
return
290290
}
291291

Sources/LiveKit/Core/Transport.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ actor Transport: NSObject, Loggable {
7676
delegate: TransportDelegate) throws
7777
{
7878
// try create peerConnection
79-
guard let pc = Engine.createPeerConnection(config,
80-
constraints: .defaultPCConstraints)
81-
else {
79+
guard let pc = RTC.createPeerConnection(config, constraints: .defaultPCConstraints) else {
8280
// log("[WebRTC] Failed to create PeerConnection", .error)
8381
throw LiveKitError(.webRTC, message: "Failed to create PeerConnection")
8482
}

Sources/LiveKit/E2EE/E2EEManager.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class E2EEManager: NSObject, ObservableObject, Loggable {
110110
}
111111

112112
guard let frameCryptor = DispatchQueue.liveKitWebRTC.sync(execute: {
113-
LKRTCFrameCryptor(factory: Engine.peerConnectionFactory,
113+
LKRTCFrameCryptor(factory: RTC.peerConnectionFactory,
114114
rtpSender: sender,
115115
participantId: participantIdentity.stringValue,
116116
algorithm: .aesGcm,
@@ -141,7 +141,7 @@ public class E2EEManager: NSObject, ObservableObject, Loggable {
141141
}
142142

143143
guard let frameCryptor = DispatchQueue.liveKitWebRTC.sync(execute: {
144-
LKRTCFrameCryptor(factory: Engine.peerConnectionFactory,
144+
LKRTCFrameCryptor(factory: RTC.peerConnectionFactory,
145145
rtpReceiver: receiver,
146146
participantId: participantIdentity.stringValue,
147147
algorithm: .aesGcm,

Sources/LiveKit/Extensions/RTCRtpTransceiver.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension LKRTCRtpTransceiver: Loggable {
2222
/// Attempts to set preferred video codec.
2323
func set(preferredVideoCodec codec: VideoCodec, exceptCodec: VideoCodec? = nil) {
2424
// Get list of supported codecs...
25-
let allVideoCodecs = Engine.videoSenderCapabilities.codecs
25+
let allVideoCodecs = RTC.videoSenderCapabilities.codecs
2626

2727
// Get the RTCRtpCodecCapability of the preferred codec
2828
let preferredCodecCapability = allVideoCodecs.first { $0.name.lowercased() == codec.id }

Sources/LiveKit/Participant/LocalParticipant.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ private extension LocalParticipant {
534534
self.log("[publish] maxBitrate: \(encoding.maxBitrate)")
535535

536536
transInit.sendEncodings = [
537-
Engine.createRtpEncodingParameters(encoding: encoding),
537+
RTC.createRtpEncodingParameters(encoding: encoding),
538538
]
539539
}
540540

Sources/LiveKit/Support/Utils.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ class Utils {
212212
if let videoCodec, videoCodec.isSVC {
213213
// SVC mode
214214
logger.log("Using SVC mode", type: Utils.self)
215-
return [Engine.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)]
215+
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)]
216216
} else if !publishOptions.simulcast {
217217
// Not-simulcast mode
218218
logger.log("Simulcast not enabled", type: Utils.self)
219-
return [Engine.createRtpEncodingParameters(encoding: encoding)]
219+
return [RTC.createRtpEncodingParameters(encoding: encoding)]
220220
}
221221

222222
// Continue to simulcast encoding computation...

Sources/LiveKit/Track/AudioManager.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ public class AudioManager: Loggable {
156156

157157
private lazy var capturePostProcessingDelegateAdapter: AudioCustomProcessingDelegateAdapter = {
158158
let adapter = AudioCustomProcessingDelegateAdapter(target: nil)
159-
Engine.audioProcessingModule.capturePostProcessingDelegate = adapter
159+
RTC.audioProcessingModule.capturePostProcessingDelegate = adapter
160160
return adapter
161161
}()
162162

163163
private lazy var renderPreProcessingDelegateAdapter: AudioCustomProcessingDelegateAdapter = {
164164
let adapter = AudioCustomProcessingDelegateAdapter(target: nil)
165-
Engine.audioProcessingModule.renderPreProcessingDelegate = adapter
165+
RTC.audioProcessingModule.renderPreProcessingDelegate = adapter
166166
return adapter
167167
}()
168168

@@ -183,26 +183,26 @@ public class AudioManager: Loggable {
183183
public let defaultInputDevice = AudioDevice(ioDevice: LKRTCIODevice.defaultDevice(with: .input))
184184

185185
public var outputDevices: [AudioDevice] {
186-
Engine.audioDeviceModule.outputDevices.map { AudioDevice(ioDevice: $0) }
186+
RTC.audioDeviceModule.outputDevices.map { AudioDevice(ioDevice: $0) }
187187
}
188188

189189
public var inputDevices: [AudioDevice] {
190-
Engine.audioDeviceModule.inputDevices.map { AudioDevice(ioDevice: $0) }
190+
RTC.audioDeviceModule.inputDevices.map { AudioDevice(ioDevice: $0) }
191191
}
192192

193193
public var outputDevice: AudioDevice {
194-
get { AudioDevice(ioDevice: Engine.audioDeviceModule.outputDevice) }
195-
set { Engine.audioDeviceModule.outputDevice = newValue._ioDevice }
194+
get { AudioDevice(ioDevice: RTC.audioDeviceModule.outputDevice) }
195+
set { RTC.audioDeviceModule.outputDevice = newValue._ioDevice }
196196
}
197197

198198
public var inputDevice: AudioDevice {
199-
get { AudioDevice(ioDevice: Engine.audioDeviceModule.inputDevice) }
200-
set { Engine.audioDeviceModule.inputDevice = newValue._ioDevice }
199+
get { AudioDevice(ioDevice: RTC.audioDeviceModule.inputDevice) }
200+
set { RTC.audioDeviceModule.inputDevice = newValue._ioDevice }
201201
}
202202

203203
public var onDeviceUpdate: DeviceUpdateFunc? {
204204
didSet {
205-
Engine.audioDeviceModule.setDevicesUpdatedHandler { [weak self] in
205+
RTC.audioDeviceModule.setDevicesUpdatedHandler { [weak self] in
206206
guard let self else { return }
207207
self.onDeviceUpdate?(self)
208208
}

Sources/LiveKit/Track/Capturers/BufferCapturer.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Foundation
2929
/// since dimensions must be resolved at the time of publishing (to compute video parameters).
3030
///
3131
public class BufferCapturer: VideoCapturer {
32-
private let capturer = Engine.createVideoCapturer()
32+
private let capturer = RTC.createVideoCapturer()
3333

3434
/// The ``BufferCaptureOptions`` used for this capturer.
3535
public let options: BufferCaptureOptions
@@ -57,7 +57,7 @@ public extension LocalVideoTrack {
5757
options: BufferCaptureOptions = BufferCaptureOptions(),
5858
reportStatistics: Bool = false) -> LocalVideoTrack
5959
{
60-
let videoSource = Engine.createVideoSource(forScreenShare: source == .screenShareVideo)
60+
let videoSource = RTC.createVideoSource(forScreenShare: source == .screenShareVideo)
6161
let capturer = BufferCapturer(delegate: videoSource, options: options)
6262
return LocalVideoTrack(name: name,
6363
source: source,

Sources/LiveKit/Track/Capturers/CameraCapturer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public extension LocalVideoTrack {
257257
options: CameraCaptureOptions? = nil,
258258
reportStatistics: Bool = false) -> LocalVideoTrack
259259
{
260-
let videoSource = Engine.createVideoSource(forScreenShare: false)
260+
let videoSource = RTC.createVideoSource(forScreenShare: false)
261261
let capturer = CameraCapturer(delegate: videoSource, options: options ?? CameraCaptureOptions())
262262
return LocalVideoTrack(name: name ?? Track.cameraName,
263263
source: .camera,

Sources/LiveKit/Track/Capturers/InAppCapturer.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import ReplayKit
2424

2525
@available(macOS 11.0, iOS 11.0, *)
2626
public class InAppScreenCapturer: VideoCapturer {
27-
private let capturer = Engine.createVideoCapturer()
27+
private let capturer = RTC.createVideoCapturer()
2828
private let options: ScreenShareCaptureOptions
2929

3030
init(delegate: LKRTCVideoCapturerDelegate, options: ScreenShareCaptureOptions) {
@@ -69,7 +69,7 @@ public extension LocalVideoTrack {
6969
options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
7070
reportStatistics: Bool = false) -> LocalVideoTrack
7171
{
72-
let videoSource = Engine.createVideoSource(forScreenShare: true)
72+
let videoSource = RTC.createVideoSource(forScreenShare: true)
7373
let capturer = InAppScreenCapturer(delegate: videoSource, options: options)
7474
return LocalVideoTrack(name: name,
7575
source: .screenShareVideo,

Sources/LiveKit/Track/Capturers/MacOSScreenCapturer.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import ScreenCaptureKit
2727

2828
@available(macOS 12.3, *)
2929
public class MacOSScreenCapturer: VideoCapturer {
30-
private let capturer = Engine.createVideoCapturer()
30+
private let capturer = RTC.createVideoCapturer()
3131

3232
// TODO: Make it possible to change dynamically
3333
public let captureSource: MacOSScreenCaptureSource?
@@ -254,7 +254,7 @@ public extension LocalVideoTrack {
254254
options: ScreenShareCaptureOptions = ScreenShareCaptureOptions(),
255255
reportStatistics: Bool = false) -> LocalVideoTrack
256256
{
257-
let videoSource = Engine.createVideoSource(forScreenShare: true)
257+
let videoSource = RTC.createVideoSource(forScreenShare: true)
258258
let capturer = MacOSScreenCapturer(delegate: videoSource, captureSource: source, options: options)
259259
return LocalVideoTrack(name: name,
260260
source: .screenShareVideo,

Sources/LiveKit/Track/Local/LocalAudioTrack.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public class LocalAudioTrack: Track, LocalTrack, AudioTrack {
5151
let audioConstraints = DispatchQueue.liveKitWebRTC.sync { LKRTCMediaConstraints(mandatoryConstraints: nil,
5252
optionalConstraints: constraints) }
5353

54-
let audioSource = Engine.createAudioSource(audioConstraints)
55-
let rtcTrack = Engine.createAudioTrack(source: audioSource)
54+
let audioSource = RTC.createAudioSource(audioConstraints)
55+
let rtcTrack = RTC.createAudioTrack(source: audioSource)
5656
rtcTrack.isEnabled = true
5757

5858
return LocalAudioTrack(name: name,

Sources/LiveKit/Track/Local/LocalVideoTrack.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class LocalVideoTrack: Track, LocalTrack, VideoTrack {
3131
videoSource: LKRTCVideoSource,
3232
reportStatistics: Bool)
3333
{
34-
let rtcTrack = Engine.createVideoTrack(source: videoSource)
34+
let rtcTrack = RTC.createVideoTrack(source: videoSource)
3535
rtcTrack.isEnabled = true
3636

3737
self.capturer = capturer

Sources/LiveKit/Types/Dimensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ extension Dimensions {
142142
continue
143143
}
144144

145-
let parameters = Engine.createRtpEncodingParameters(
145+
let parameters = RTC.createRtpEncodingParameters(
146146
rid: rid,
147147
encoding: preset.encoding,
148148
scaleDownBy: Double(max) / Double(preset.dimensions.max)

Sources/LiveKit/Types/SessionDescription.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ extension Livekit_SessionDescription {
4444
default: fatalError("Unknown state \(type)") // This should never happen
4545
}
4646

47-
return Engine.createSessionDescription(type: sdpType, sdp: sdp)
47+
return RTC.createSessionDescription(type: sdpType, sdp: sdp)
4848
}
4949
}

0 commit comments

Comments
 (0)