Skip to content

Commit

Permalink
Merge branch 'main' into hiroshi/adm-audioengine
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie authored Dec 19, 2024
2 parents c5f4154 + b47dd40 commit 3fddf16
Show file tree
Hide file tree
Showing 5 changed files with 615 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Sources/LiveKit/Core/RTC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ private class VideoEncoderFactorySimulcast: LKRTCVideoEncoderFactorySimulcast {
}

class RTC {
static var bypassVoiceProcessing: Bool = false
private static var _bypassVoiceProcessing: Bool = false
private static var _peerConnectionFactoryInitialized = false

static var bypassVoiceProcessing: Bool {
get { _bypassVoiceProcessing }
set {
if _peerConnectionFactoryInitialized {
logger.log("Warning: Setting bypassVoiceProcessing after PeerConnectionFactory initialization has no effect. Set it at application launch.", .warning, type: Room.self)
}
_bypassVoiceProcessing = newValue
}
}

static let h264BaselineLevel5CodecInfo: LKRTCVideoCodecInfo = {
// this should never happen
Expand Down Expand Up @@ -91,6 +102,7 @@ class RTC {

logger.log("Initializing PeerConnectionFactory...", type: Room.self)

_peerConnectionFactoryInitialized = true
return LKRTCPeerConnectionFactory(bypassVoiceProcessing: bypassVoiceProcessing,
encoderFactory: encoderFactory,
decoderFactory: decoderFactory,
Expand Down
1 change: 1 addition & 0 deletions Sources/LiveKit/Core/Room.swift
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ extension Room: AppStateDelegate {
public extension Room {
/// Set this to true to bypass initialization of voice processing.
/// Must be set before RTCPeerConnectionFactory gets initialized.
/// The most reliable place to set this is in your application's initialization process.
@objc
static var bypassVoiceProcessing: Bool {
get { RTC.bypassVoiceProcessing }
Expand Down
1 change: 1 addition & 0 deletions Sources/LiveKit/Core/SignalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ private extension SignalClient {
_lastJoinResponse = joinResponse
_delegate.notifyDetached { await $0.signalClient(self, didReceiveConnectResponse: .join(joinResponse)) }
_connectResponseCompleter.resume(returning: .join(joinResponse))
print("creationTime: \(joinResponse.room.creationTime)")
await _restartPingTimer()

case let .reconnect(response):
Expand Down
21 changes: 21 additions & 0 deletions Sources/LiveKit/Protos/livekit_metrics.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ enum Livekit_MetricLabel: SwiftProtobuf.Enum, Swift.CaseIterable {

/// total duration spent in other quality limitation
case clientVideoPublisherQualityLimitationDurationOther // = 16

/// Publisher RTT (participant -> server)
case publisherRtt // = 17

/// RTT between publisher node and subscriber node (could involve intermedia node(s))
case serverMeshRtt // = 18

/// Subscribe RTT (server -> participant)
case subscriberRtt // = 19
case predefinedMaxValue // = 4096
case UNRECOGNIZED(Int)

Expand All @@ -100,6 +109,9 @@ enum Livekit_MetricLabel: SwiftProtobuf.Enum, Swift.CaseIterable {
case 14: self = .clientVideoPublisherQualityLimitationDurationBandwidth
case 15: self = .clientVideoPublisherQualityLimitationDurationCpu
case 16: self = .clientVideoPublisherQualityLimitationDurationOther
case 17: self = .publisherRtt
case 18: self = .serverMeshRtt
case 19: self = .subscriberRtt
case 4096: self = .predefinedMaxValue
default: self = .UNRECOGNIZED(rawValue)
}
Expand All @@ -124,6 +136,9 @@ enum Livekit_MetricLabel: SwiftProtobuf.Enum, Swift.CaseIterable {
case .clientVideoPublisherQualityLimitationDurationBandwidth: return 14
case .clientVideoPublisherQualityLimitationDurationCpu: return 15
case .clientVideoPublisherQualityLimitationDurationOther: return 16
case .publisherRtt: return 17
case .serverMeshRtt: return 18
case .subscriberRtt: return 19
case .predefinedMaxValue: return 4096
case .UNRECOGNIZED(let i): return i
}
Expand All @@ -148,6 +163,9 @@ enum Livekit_MetricLabel: SwiftProtobuf.Enum, Swift.CaseIterable {
.clientVideoPublisherQualityLimitationDurationBandwidth,
.clientVideoPublisherQualityLimitationDurationCpu,
.clientVideoPublisherQualityLimitationDurationOther,
.publisherRtt,
.serverMeshRtt,
.subscriberRtt,
.predefinedMaxValue,
]

Expand Down Expand Up @@ -321,6 +339,9 @@ extension Livekit_MetricLabel: SwiftProtobuf._ProtoNameProviding {
14: .same(proto: "CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_BANDWIDTH"),
15: .same(proto: "CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_CPU"),
16: .same(proto: "CLIENT_VIDEO_PUBLISHER_QUALITY_LIMITATION_DURATION_OTHER"),
17: .same(proto: "PUBLISHER_RTT"),
18: .same(proto: "SERVER_MESH_RTT"),
19: .same(proto: "SUBSCRIBER_RTT"),
4096: .same(proto: "METRIC_LABEL_PREDEFINED_MAX_VALUE"),
]
}
Expand Down
Loading

0 comments on commit 3fddf16

Please sign in to comment.