Skip to content

Commit

Permalink
strip unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Nov 16, 2023
1 parent 6b1aff5 commit fabc152
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 191 deletions.
11 changes: 4 additions & 7 deletions Sources/LiveKit/Core/Engine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ import Foundation
@_implementationOnly import WebRTC

class Engine: MulticastDelegate<EngineDelegate> {
let queue = DispatchQueue(label: "LiveKitSDK.engine", qos: .default)

// MARK: - Public

public typealias ConditionEvalFunc = (_ newState: State, _ oldState: State?) -> Bool

struct State: ReconnectableState, Equatable {
struct State: Equatable {
var connectOptions: ConnectOptions
var url: String?
var token: String?
Expand Down Expand Up @@ -62,13 +60,12 @@ class Engine: MulticastDelegate<EngineDelegate> {
let block: () -> Void
}

var subscriberPrimary: Bool = false
private var primary: Transport? { subscriberPrimary ? subscriber : publisher }
public internal(set) var subscriberPrimary: Bool = false

// MARK: - DataChannels

var subscriberDC = DataChannelPair(target: .subscriber)
var publisherDC = DataChannelPair(target: .publisher)
public internal(set) var subscriberDC = DataChannelPair(target: .subscriber)
public internal(set) var publisherDC = DataChannelPair(target: .publisher)

private var _blockProcessQueue = DispatchQueue(label: "LiveKitSDK.engine.pendingBlocks",
qos: .default)
Expand Down
4 changes: 1 addition & 3 deletions Sources/LiveKit/Core/Room.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import Foundation
public class Room: NSObject, ObservableObject, Loggable {
// MARK: - MulticastDelegate

var delegates = MulticastDelegate<RoomDelegateObjC>()

let queue = DispatchQueue(label: "LiveKitSDK.room", qos: .default)
public let delegates = MulticastDelegate<RoomDelegateObjC>()

// MARK: - Public

Expand Down
5 changes: 2 additions & 3 deletions Sources/LiveKit/Core/SignalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class SignalClient: MulticastDelegate<SignalClientDelegate> {
let joinResponseCompleter = AsyncCompleter<Livekit_JoinResponse>(label: "Join response", timeOut: .defaultJoinResponse)
let _addTrackCompleters = CompleterMapActor<Livekit_TrackInfo>(label: "Completers for add track", timeOut: .defaultPublish)

struct State: ReconnectableState, Equatable {
var reconnectMode: ReconnectMode?
struct State: Equatable {
var connectionState: ConnectionState = .disconnected()
}

Expand Down Expand Up @@ -99,7 +98,7 @@ class SignalClient: MulticastDelegate<SignalClientDelegate> {
log("Connecting with url: \(urlString)")

_state.mutate {
$0.reconnectMode = reconnectMode
// $0.reconnectMode = reconnectMode
$0.connectionState = .connecting
}

Expand Down
2 changes: 0 additions & 2 deletions Sources/LiveKit/Extensions/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import Logging
/// Allows to extend with custom `log` method which automatically captures current type (class name).
public protocol Loggable {}

private var _scopedMetadataKey = "scopedMetadata"

public typealias ScopedMetadata = CustomStringConvertible
typealias ScopedMetadataContainer = [String: ScopedMetadata]

Expand Down
4 changes: 1 addition & 3 deletions Sources/LiveKit/Participant/Participant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ import Foundation
public class Participant: NSObject, ObservableObject, Loggable {
// MARK: - MulticastDelegate

var delegates = MulticastDelegate<ParticipantDelegate>()

let queue = DispatchQueue(label: "LiveKitSDK.participant", qos: .default)
public let delegates = MulticastDelegate<ParticipantDelegate>()

/// This will be an empty String for LocalParticipants until connected.
@objc
Expand Down
132 changes: 0 additions & 132 deletions Sources/LiveKit/Support/DisplayLink.swift

This file was deleted.

4 changes: 1 addition & 3 deletions Sources/LiveKit/Track/Capturers/VideoCapturer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public protocol VideoCapturerDelegate: AnyObject {
public class VideoCapturer: NSObject, Loggable, VideoCapturerProtocol {
// MARK: - MulticastDelegate

var delegates = MulticastDelegate<VideoCapturerDelegate>()

let queue = DispatchQueue(label: "LiveKitSDK.videoCapturer", qos: .default)
public let delegates = MulticastDelegate<VideoCapturerDelegate>()

/// Array of supported pixel formats that can be used to capture a frame.
///
Expand Down
4 changes: 1 addition & 3 deletions Sources/LiveKit/Track/Track.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public class Track: NSObject, Loggable {

// MARK: - Internal

var delegates = MulticastDelegate<TrackDelegate>()

let queue = DispatchQueue(label: "LiveKitSDK.track", qos: .default)
public let delegates = MulticastDelegate<TrackDelegate>()

/// Only for ``LocalTrack``s.
private(set) var _publishState: PublishState = .unpublished
Expand Down
5 changes: 0 additions & 5 deletions Sources/LiveKit/Types/ConnectionState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,3 @@ extension ConnectionState: Equatable {
return error
}
}

protocol ReconnectableState {
var reconnectMode: ReconnectMode? { get }
var connectionState: ConnectionState { get }
}
19 changes: 0 additions & 19 deletions Sources/LiveKit/Types/Dimensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ extension Dimensions {
Swift.max(width, height)
}

var sum: Int32 {
width + height
}

// TODO: Find better name
var area: Int32 {
width * height
Expand Down Expand Up @@ -155,17 +151,6 @@ extension Dimensions {
return VideoQuality.rids.compactMap { rid in result.first(where: { $0.rid == rid }) }
}

func computeSuggestedPresetIndex(in presets: [VideoParameters]) -> Int {
assert(!presets.isEmpty)
var result = 0
for preset in presets {
if width >= preset.dimensions.width, height >= preset.dimensions.height {
result += 1
}
}
return result
}

func videoLayers(for encodings: [LKRTCRtpEncodingParameters]) -> [Livekit_VideoLayer] {
encodings.filter(\.isActive).map { encoding in
let scaleDownBy = encoding.scaleResolutionDownBy?.doubleValue ?? 1.0
Expand All @@ -182,10 +167,6 @@ extension Dimensions {
// MARK: - Convert

extension Dimensions {
func toCGSize() -> CGSize {
CGSize(width: Int(width), height: Int(height))
}

func apply(rotation: RTCVideoRotation) -> Dimensions {
if rotation == ._90 || rotation == ._270 {
return swapped()
Expand Down
10 changes: 0 additions & 10 deletions Sources/LiveKit/Types/VideoQuality.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ extension VideoQuality {
}

extension Livekit_VideoQuality {
private static let toSDKTypeMap: [Livekit_VideoQuality: VideoQuality] = [
.low: .low,
.medium: .medium,
.high: .high,
]

func toSDKType() -> VideoQuality {
Self.toSDKTypeMap[self] ?? .low
}

static func from(rid: String?) -> Livekit_VideoQuality {
switch rid {
case "h": return Livekit_VideoQuality.medium
Expand Down
2 changes: 1 addition & 1 deletion Sources/LiveKit/Views/VideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protocol Mirrorable {
public class VideoView: NativeView, Loggable {
// MARK: - MulticastDelegate

var delegates = MulticastDelegate<VideoViewDelegate>()
public let delegates = MulticastDelegate<VideoViewDelegate>()

// MARK: - Static

Expand Down

0 comments on commit fabc152

Please sign in to comment.