Skip to content

Commit c15a3dc

Browse files
Generated protobufs updates for Stats (#788)
1 parent f11bfee commit c15a3dc

File tree

3 files changed

+145
-32
lines changed

3 files changed

+145
-32
lines changed

Sources/StreamVideo/protobuf/sfu/models/models.pb.swift

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,49 @@ struct Stream_Video_Sfu_Models_AppleState {
13731373
init() {}
13741374
}
13751375

1376+
/// PerformanceStats represents the encoding/decoding statistics for a track.
1377+
struct Stream_Video_Sfu_Models_PerformanceStats {
1378+
// SwiftProtobuf.Message conformance is added in an extension below. See the
1379+
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
1380+
// methods supported on all messages.
1381+
1382+
/// the type of the track (e.g., video, audio, screen share)
1383+
var trackType: Stream_Video_Sfu_Models_TrackType = .unspecified
1384+
1385+
/// the codec used for the track
1386+
var codec: Stream_Video_Sfu_Models_Codec {
1387+
get {return _codec ?? Stream_Video_Sfu_Models_Codec()}
1388+
set {_codec = newValue}
1389+
}
1390+
/// Returns true if `codec` has been explicitly set.
1391+
var hasCodec: Bool {return self._codec != nil}
1392+
/// Clears the value of `codec`. Subsequent reads from it will return its default value.
1393+
mutating func clearCodec() {self._codec = nil}
1394+
1395+
/// the average encode/decode time in ms
1396+
var avgFrameTimeMs: Float = 0
1397+
1398+
/// the average fps for the track
1399+
var avgFps: Float = 0
1400+
1401+
/// the track dimensions
1402+
var videoDimension: Stream_Video_Sfu_Models_VideoDimension {
1403+
get {return _videoDimension ?? Stream_Video_Sfu_Models_VideoDimension()}
1404+
set {_videoDimension = newValue}
1405+
}
1406+
/// Returns true if `videoDimension` has been explicitly set.
1407+
var hasVideoDimension: Bool {return self._videoDimension != nil}
1408+
/// Clears the value of `videoDimension`. Subsequent reads from it will return its default value.
1409+
mutating func clearVideoDimension() {self._videoDimension = nil}
1410+
1411+
var unknownFields = SwiftProtobuf.UnknownStorage()
1412+
1413+
init() {}
1414+
1415+
fileprivate var _codec: Stream_Video_Sfu_Models_Codec? = nil
1416+
fileprivate var _videoDimension: Stream_Video_Sfu_Models_VideoDimension? = nil
1417+
}
1418+
13761419
#if swift(>=5.5) && canImport(_Concurrency)
13771420
extension Stream_Video_Sfu_Models_PeerType: @unchecked Sendable {}
13781421
extension Stream_Video_Sfu_Models_ConnectionQuality: @unchecked Sendable {}
@@ -1410,6 +1453,7 @@ extension Stream_Video_Sfu_Models_CallGrants: @unchecked Sendable {}
14101453
extension Stream_Video_Sfu_Models_InputDevices: @unchecked Sendable {}
14111454
extension Stream_Video_Sfu_Models_AndroidState: @unchecked Sendable {}
14121455
extension Stream_Video_Sfu_Models_AppleState: @unchecked Sendable {}
1456+
extension Stream_Video_Sfu_Models_PerformanceStats: @unchecked Sendable {}
14131457
#endif // swift(>=5.5) && canImport(_Concurrency)
14141458

14151459
// MARK: - Code below here is support for the SwiftProtobuf runtime.
@@ -2802,3 +2846,63 @@ extension Stream_Video_Sfu_Models_AppleState: SwiftProtobuf.Message, SwiftProtob
28022846
return true
28032847
}
28042848
}
2849+
2850+
extension Stream_Video_Sfu_Models_PerformanceStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
2851+
static let protoMessageName: String = _protobuf_package + ".PerformanceStats"
2852+
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
2853+
1: .standard(proto: "track_type"),
2854+
2: .same(proto: "codec"),
2855+
3: .standard(proto: "avg_frame_time_ms"),
2856+
4: .standard(proto: "avg_fps"),
2857+
5: .standard(proto: "video_dimension"),
2858+
]
2859+
2860+
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
2861+
while let fieldNumber = try decoder.nextFieldNumber() {
2862+
// The use of inline closures is to circumvent an issue where the compiler
2863+
// allocates stack space for every case branch when no optimizations are
2864+
// enabled. https://github.com/apple/swift-protobuf/issues/1034
2865+
switch fieldNumber {
2866+
case 1: try { try decoder.decodeSingularEnumField(value: &self.trackType) }()
2867+
case 2: try { try decoder.decodeSingularMessageField(value: &self._codec) }()
2868+
case 3: try { try decoder.decodeSingularFloatField(value: &self.avgFrameTimeMs) }()
2869+
case 4: try { try decoder.decodeSingularFloatField(value: &self.avgFps) }()
2870+
case 5: try { try decoder.decodeSingularMessageField(value: &self._videoDimension) }()
2871+
default: break
2872+
}
2873+
}
2874+
}
2875+
2876+
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
2877+
// The use of inline closures is to circumvent an issue where the compiler
2878+
// allocates stack space for every if/case branch local when no optimizations
2879+
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
2880+
// https://github.com/apple/swift-protobuf/issues/1182
2881+
if self.trackType != .unspecified {
2882+
try visitor.visitSingularEnumField(value: self.trackType, fieldNumber: 1)
2883+
}
2884+
try { if let v = self._codec {
2885+
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
2886+
} }()
2887+
if self.avgFrameTimeMs != 0 {
2888+
try visitor.visitSingularFloatField(value: self.avgFrameTimeMs, fieldNumber: 3)
2889+
}
2890+
if self.avgFps != 0 {
2891+
try visitor.visitSingularFloatField(value: self.avgFps, fieldNumber: 4)
2892+
}
2893+
try { if let v = self._videoDimension {
2894+
try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
2895+
} }()
2896+
try unknownFields.traverse(visitor: &visitor)
2897+
}
2898+
2899+
static func ==(lhs: Stream_Video_Sfu_Models_PerformanceStats, rhs: Stream_Video_Sfu_Models_PerformanceStats) -> Bool {
2900+
if lhs.trackType != rhs.trackType {return false}
2901+
if lhs._codec != rhs._codec {return false}
2902+
if lhs.avgFrameTimeMs != rhs.avgFrameTimeMs {return false}
2903+
if lhs.avgFps != rhs.avgFps {return false}
2904+
if lhs._videoDimension != rhs._videoDimension {return false}
2905+
if lhs.unknownFields != rhs.unknownFields {return false}
2906+
return true
2907+
}
2908+
}

Sources/StreamVideo/protobuf/sfu/signal_rpc/signal.pb.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,23 @@ struct Stream_Video_Sfu_Signal_SendStatsRequest {
254254
set {_uniqueStorage()._publisherRtcStats = newValue}
255255
}
256256

257+
var rtcStats: String {
258+
get {return _storage._rtcStats}
259+
set {_uniqueStorage()._rtcStats = newValue}
260+
}
261+
262+
/// Encode stats for the publisher
263+
var encodeStats: [Stream_Video_Sfu_Models_PerformanceStats] {
264+
get {return _storage._encodeStats}
265+
set {_uniqueStorage()._encodeStats = newValue}
266+
}
267+
268+
/// Decode stats for the subscriber
269+
var decodeStats: [Stream_Video_Sfu_Models_PerformanceStats] {
270+
get {return _storage._decodeStats}
271+
set {_uniqueStorage()._decodeStats = newValue}
272+
}
273+
257274
var unknownFields = SwiftProtobuf.UnknownStorage()
258275

259276
enum OneOf_DeviceState: Equatable {
@@ -867,6 +884,9 @@ extension Stream_Video_Sfu_Signal_SendStatsRequest: SwiftProtobuf.Message, Swift
867884
12: .same(proto: "rtmp"),
868885
13: .standard(proto: "subscriber_rtc_stats"),
869886
14: .standard(proto: "publisher_rtc_stats"),
887+
15: .standard(proto: "rtc_stats"),
888+
16: .standard(proto: "encode_stats"),
889+
17: .standard(proto: "decode_stats"),
870890
]
871891

872892
fileprivate class _StorageClass: @unchecked Sendable {
@@ -883,6 +903,9 @@ fileprivate class _StorageClass: @unchecked Sendable {
883903
var _rtmp: Stream_Video_Sfu_Models_RTMPIngress? = nil
884904
var _subscriberRtcStats: String = String()
885905
var _publisherRtcStats: String = String()
906+
var _rtcStats: String = String()
907+
var _encodeStats: [Stream_Video_Sfu_Models_PerformanceStats] = []
908+
var _decodeStats: [Stream_Video_Sfu_Models_PerformanceStats] = []
886909

887910
static let defaultInstance = _StorageClass()
888911

@@ -902,6 +925,9 @@ fileprivate class _StorageClass: @unchecked Sendable {
902925
_rtmp = source._rtmp
903926
_subscriberRtcStats = source._subscriberRtcStats
904927
_publisherRtcStats = source._publisherRtcStats
928+
_rtcStats = source._rtcStats
929+
_encodeStats = source._encodeStats
930+
_decodeStats = source._decodeStats
905931
}
906932
}
907933

@@ -958,6 +984,9 @@ fileprivate class _StorageClass: @unchecked Sendable {
958984
case 12: try { try decoder.decodeSingularMessageField(value: &_storage._rtmp) }()
959985
case 13: try { try decoder.decodeSingularStringField(value: &_storage._subscriberRtcStats) }()
960986
case 14: try { try decoder.decodeSingularStringField(value: &_storage._publisherRtcStats) }()
987+
case 15: try { try decoder.decodeSingularStringField(value: &_storage._rtcStats) }()
988+
case 16: try { try decoder.decodeRepeatedMessageField(value: &_storage._encodeStats) }()
989+
case 17: try { try decoder.decodeRepeatedMessageField(value: &_storage._decodeStats) }()
961990
default: break
962991
}
963992
}
@@ -1017,6 +1046,15 @@ fileprivate class _StorageClass: @unchecked Sendable {
10171046
if !_storage._publisherRtcStats.isEmpty {
10181047
try visitor.visitSingularStringField(value: _storage._publisherRtcStats, fieldNumber: 14)
10191048
}
1049+
if !_storage._rtcStats.isEmpty {
1050+
try visitor.visitSingularStringField(value: _storage._rtcStats, fieldNumber: 15)
1051+
}
1052+
if !_storage._encodeStats.isEmpty {
1053+
try visitor.visitRepeatedMessageField(value: _storage._encodeStats, fieldNumber: 16)
1054+
}
1055+
if !_storage._decodeStats.isEmpty {
1056+
try visitor.visitRepeatedMessageField(value: _storage._decodeStats, fieldNumber: 17)
1057+
}
10201058
}
10211059
try unknownFields.traverse(visitor: &visitor)
10221060
}
@@ -1039,6 +1077,9 @@ fileprivate class _StorageClass: @unchecked Sendable {
10391077
if _storage._rtmp != rhs_storage._rtmp {return false}
10401078
if _storage._subscriberRtcStats != rhs_storage._subscriberRtcStats {return false}
10411079
if _storage._publisherRtcStats != rhs_storage._publisherRtcStats {return false}
1080+
if _storage._rtcStats != rhs_storage._rtcStats {return false}
1081+
if _storage._encodeStats != rhs_storage._encodeStats {return false}
1082+
if _storage._decodeStats != rhs_storage._decodeStats {return false}
10421083
return true
10431084
}
10441085
if !storagesAreEqual {return false}

StreamVideo.xcodeproj/project.pbxproj

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,6 @@
17381738
404A81372DA3CC0C001F7FA8 /* CallConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallConfiguration.swift; sourceTree = "<group>"; };
17391739
4051A26E2D665B03000C3167 /* Sendable+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Sendable+Extensions.swift"; sourceTree = "<group>"; };
17401740
4051A2722D673430000C3167 /* CustomStringConvertible+Conformances.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CustomStringConvertible+Conformances.swift"; sourceTree = "<group>"; };
1741-
4052BF4E2DBA2AC70085AFA5 /* ProximityPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProximityPolicy.swift; sourceTree = "<group>"; };
1742-
4052BF522DBA2E510085AFA5 /* VideoProximityPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoProximityPolicy.swift; sourceTree = "<group>"; };
17431741
4052BF542DBA830D0085AFA5 /* MockAppStateAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAppStateAdapter.swift; sourceTree = "<group>"; };
17441742
405687AD2D78A0E700093B98 /* QRCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeView.swift; sourceTree = "<group>"; };
17451743
4059C3412AAF0CE40006928E /* DemoChatViewModel+Injection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DemoChatViewModel+Injection.swift"; sourceTree = "<group>"; };
@@ -2200,8 +2198,6 @@
22002198
40FE5EBA2C9C7D40006B0881 /* StreamVideoCaptureHandler_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamVideoCaptureHandler_Tests.swift; sourceTree = "<group>"; };
22012199
40FE5EBC2C9C82A6006B0881 /* MockRTCVideoCapturerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRTCVideoCapturerDelegate.swift; sourceTree = "<group>"; };
22022200
40FE5EBE2C9C82CD006B0881 /* CVPixelBuffer+Convenience.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CVPixelBuffer+Convenience.swift"; sourceTree = "<group>"; };
2203-
40FEA2C52DA4000A00AC523B /* SpeakerProximityPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpeakerProximityPolicy.swift; sourceTree = "<group>"; };
2204-
40FEA2C82DA4015300AC523B /* ProximityMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProximityMonitor.swift; sourceTree = "<group>"; };
22052201
40FF825C2D63527D0029AA80 /* Comparator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comparator.swift; sourceTree = "<group>"; };
22062202
40FF825E2D63532C0029AA80 /* Participants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Participants.swift; sourceTree = "<group>"; };
22072203
40FF82602D6353AB0029AA80 /* Presets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Presets.swift; sourceTree = "<group>"; };
@@ -3469,33 +3465,6 @@
34693465
path = Swift6Migration;
34703466
sourceTree = "<group>";
34713467
};
3472-
4052BF4D2DBA28700085AFA5 /* Proximity */ = {
3473-
isa = PBXGroup;
3474-
children = (
3475-
4052BF512DBA2AD80085AFA5 /* Monitor */,
3476-
4052BF502DBA2AD10085AFA5 /* Policies */,
3477-
);
3478-
path = Proximity;
3479-
sourceTree = "<group>";
3480-
};
3481-
4052BF502DBA2AD10085AFA5 /* Policies */ = {
3482-
isa = PBXGroup;
3483-
children = (
3484-
4052BF4E2DBA2AC70085AFA5 /* ProximityPolicy.swift */,
3485-
40FEA2C52DA4000A00AC523B /* SpeakerProximityPolicy.swift */,
3486-
4052BF522DBA2E510085AFA5 /* VideoProximityPolicy.swift */,
3487-
);
3488-
path = Policies;
3489-
sourceTree = "<group>";
3490-
};
3491-
4052BF512DBA2AD80085AFA5 /* Monitor */ = {
3492-
isa = PBXGroup;
3493-
children = (
3494-
40FEA2C82DA4015300AC523B /* ProximityMonitor.swift */,
3495-
);
3496-
path = Monitor;
3497-
sourceTree = "<group>";
3498-
};
34993468
4061287F2CF32FE4007F5CDC /* SDP Parsing */ = {
35003469
isa = PBXGroup;
35013470
children = (
@@ -5752,7 +5721,6 @@
57525721
84AF64D3287C79220012A503 /* Utils */ = {
57535722
isa = PBXGroup;
57545723
children = (
5755-
4052BF4D2DBA28700085AFA5 /* Proximity */,
57565724
40FF825B2D63523C0029AA80 /* Sorting */,
57575725
403A4FE92D660E3E00ECD46A /* Swift6Migration */,
57585726
40ADB85D2D65DFB000B06AAF /* CustomStringInterpolation */,

0 commit comments

Comments
 (0)