From 2653e1d638bde16a4c6ab5b15004e7c57528f56b Mon Sep 17 00:00:00 2001 From: Stream Bot Date: Mon, 2 Dec 2024 16:38:21 +0100 Subject: [PATCH] Generated updated code for codec negotiation --- ..._SfuEvent.OneOf_EventPayload+Payload.swift | 2 - .../StreamVideo/WebSockets/Events/Event.swift | 1 - .../protobuf/sfu/event/events.pb.swift | 66 ++++--------------- .../protobuf/sfu/models/models.pb.swift | 20 ++++++ 4 files changed, 34 insertions(+), 55 deletions(-) diff --git a/Sources/StreamVideo/WebRTC/v2/SFU/Extensions/Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload+Payload.swift b/Sources/StreamVideo/WebRTC/v2/SFU/Extensions/Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload+Payload.swift index d36316b95..995719f18 100644 --- a/Sources/StreamVideo/WebRTC/v2/SFU/Extensions/Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload+Payload.swift +++ b/Sources/StreamVideo/WebRTC/v2/SFU/Extensions/Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload+Payload.swift @@ -61,8 +61,6 @@ extension Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload { return payload as? T case let .changePublishOptions(payload): return payload as? T - case let .changePublishOptionsComplete(payload): - return payload as? T } } } diff --git a/Sources/StreamVideo/WebSockets/Events/Event.swift b/Sources/StreamVideo/WebSockets/Events/Event.swift index 97945e0d4..e5e6ee4e2 100644 --- a/Sources/StreamVideo/WebSockets/Events/Event.swift +++ b/Sources/StreamVideo/WebSockets/Events/Event.swift @@ -122,7 +122,6 @@ extension Stream_Video_Sfu_Event_SfuEvent.OneOf_EventPayload: Event { case .participantUpdated: return "participantUpdated" case .participantMigrationComplete: return "participantMigrationComplete" case .changePublishOptions: return "changePublishOptions" - case .changePublishOptionsComplete: return "changePublishOptionsComplete" } } } diff --git a/Sources/StreamVideo/protobuf/sfu/event/events.pb.swift b/Sources/StreamVideo/protobuf/sfu/event/events.pb.swift index d6aad4020..eb9b19ae5 100644 --- a/Sources/StreamVideo/protobuf/sfu/event/events.pb.swift +++ b/Sources/StreamVideo/protobuf/sfu/event/events.pb.swift @@ -239,15 +239,6 @@ struct Stream_Video_Sfu_Event_SfuEvent { set {eventPayload = .participantMigrationComplete(newValue)} } - /// ChangePublishOptionsComplete is sent to signal the completion of a ChangePublishOptions request. - var changePublishOptionsComplete: Stream_Video_Sfu_Event_ChangePublishOptionsComplete { - get { - if case .changePublishOptionsComplete(let v)? = eventPayload {return v} - return Stream_Video_Sfu_Event_ChangePublishOptionsComplete() - } - set {eventPayload = .changePublishOptionsComplete(newValue)} - } - /// ChangePublishOptions is sent to signal the change in publish options such as a new codec or simulcast layers var changePublishOptions: Stream_Video_Sfu_Event_ChangePublishOptions { get { @@ -324,8 +315,6 @@ struct Stream_Video_Sfu_Event_SfuEvent { case participantUpdated(Stream_Video_Sfu_Event_ParticipantUpdated) /// ParticipantMigrationComplete is sent when the participant migration is complete case participantMigrationComplete(Stream_Video_Sfu_Event_ParticipantMigrationComplete) - /// ChangePublishOptionsComplete is sent to signal the completion of a ChangePublishOptions request. - case changePublishOptionsComplete(Stream_Video_Sfu_Event_ChangePublishOptionsComplete) /// ChangePublishOptions is sent to signal the change in publish options such as a new codec or simulcast layers case changePublishOptions(Stream_Video_Sfu_Event_ChangePublishOptions) @@ -419,10 +408,6 @@ struct Stream_Video_Sfu_Event_SfuEvent { guard case .participantMigrationComplete(let l) = lhs, case .participantMigrationComplete(let r) = rhs else { preconditionFailure() } return l == r }() - case (.changePublishOptionsComplete, .changePublishOptionsComplete): return { - guard case .changePublishOptionsComplete(let l) = lhs, case .changePublishOptionsComplete(let r) = rhs else { preconditionFailure() } - return l == r - }() case (.changePublishOptions, .changePublishOptions): return { guard case .changePublishOptions(let l) = lhs, case .changePublishOptions(let r) = rhs else { preconditionFailure() } return l == r @@ -441,20 +426,13 @@ struct Stream_Video_Sfu_Event_ChangePublishOptions { // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. - var publishOption: Stream_Video_Sfu_Models_PublishOption { - get {return _publishOption ?? Stream_Video_Sfu_Models_PublishOption()} - set {_publishOption = newValue} - } - /// Returns true if `publishOption` has been explicitly set. - var hasPublishOption: Bool {return self._publishOption != nil} - /// Clears the value of `publishOption`. Subsequent reads from it will return its default value. - mutating func clearPublishOption() {self._publishOption = nil} + var publishOption: [Stream_Video_Sfu_Models_PublishOption] = [] + + var reason: String = String() var unknownFields = SwiftProtobuf.UnknownStorage() init() {} - - fileprivate var _publishOption: Stream_Video_Sfu_Models_PublishOption? = nil } struct Stream_Video_Sfu_Event_ChangePublishOptionsComplete { @@ -1291,7 +1269,6 @@ extension Stream_Video_Sfu_Event_SfuEvent: SwiftProtobuf.Message, SwiftProtobuf. 23: .standard(proto: "call_ended"), 24: .standard(proto: "participant_updated"), 25: .standard(proto: "participant_migration_complete"), - 26: .standard(proto: "change_publish_options_complete"), 27: .standard(proto: "change_publish_options"), ] @@ -1574,19 +1551,6 @@ extension Stream_Video_Sfu_Event_SfuEvent: SwiftProtobuf.Message, SwiftProtobuf. self.eventPayload = .participantMigrationComplete(v) } }() - case 26: try { - var v: Stream_Video_Sfu_Event_ChangePublishOptionsComplete? - var hadOneofValue = false - if let current = self.eventPayload { - hadOneofValue = true - if case .changePublishOptionsComplete(let m) = current {v = m} - } - try decoder.decodeSingularMessageField(value: &v) - if let v = v { - if hadOneofValue {try decoder.handleConflictingOneOf()} - self.eventPayload = .changePublishOptionsComplete(v) - } - }() case 27: try { var v: Stream_Video_Sfu_Event_ChangePublishOptions? var hadOneofValue = false @@ -1695,10 +1659,6 @@ extension Stream_Video_Sfu_Event_SfuEvent: SwiftProtobuf.Message, SwiftProtobuf. guard case .participantMigrationComplete(let v)? = self.eventPayload else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 25) }() - case .changePublishOptionsComplete?: try { - guard case .changePublishOptionsComplete(let v)? = self.eventPayload else { preconditionFailure() } - try visitor.visitSingularMessageField(value: v, fieldNumber: 26) - }() case .changePublishOptions?: try { guard case .changePublishOptions(let v)? = self.eventPayload else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 27) @@ -1719,6 +1679,7 @@ extension Stream_Video_Sfu_Event_ChangePublishOptions: SwiftProtobuf.Message, Sw static let protoMessageName: String = _protobuf_package + ".ChangePublishOptions" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 1: .standard(proto: "publish_option"), + 2: .same(proto: "reason"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -1727,25 +1688,26 @@ extension Stream_Video_Sfu_Event_ChangePublishOptions: SwiftProtobuf.Message, Sw // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._publishOption) }() + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.publishOption) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.reason) }() default: break } } } func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._publishOption { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() + if !self.publishOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.publishOption, fieldNumber: 1) + } + if !self.reason.isEmpty { + try visitor.visitSingularStringField(value: self.reason, fieldNumber: 2) + } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Stream_Video_Sfu_Event_ChangePublishOptions, rhs: Stream_Video_Sfu_Event_ChangePublishOptions) -> Bool { - if lhs._publishOption != rhs._publishOption {return false} + if lhs.publishOption != rhs.publishOption {return false} + if lhs.reason != rhs.reason {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Sources/StreamVideo/protobuf/sfu/models/models.pb.swift b/Sources/StreamVideo/protobuf/sfu/models/models.pb.swift index 9aeea3a74..09b18af62 100644 --- a/Sources/StreamVideo/protobuf/sfu/models/models.pb.swift +++ b/Sources/StreamVideo/protobuf/sfu/models/models.pb.swift @@ -984,6 +984,20 @@ struct Stream_Video_Sfu_Models_PublishOption { /// Clears the value of `videoDimension`. Subsequent reads from it will return its default value. mutating func clearVideoDimension() {self._videoDimension = nil} + /// The unique identifier for the publish request. + /// - This `id` is assigned exclusively by the SFU. Any `id` set by the client + /// in the `PublishOption` will be ignored and overwritten by the SFU. + /// - The primary purpose of this `id` is to uniquely identify each publish + /// request, even in scenarios where multiple publish requests for the same + /// `track_type` and `codec` are active simultaneously. + /// For example: + /// - A user may publish two tracks of the same type (e.g., video) and codec + /// (e.g., VP9) concurrently. + /// - This uniqueness ensures that individual requests can be managed + /// independently. For instance, an `id` is critical when stopping a specific + /// publish request without affecting others. + var id: Int32 = 0 + var unknownFields = SwiftProtobuf.UnknownStorage() init() {} @@ -1860,6 +1874,7 @@ extension Stream_Video_Sfu_Models_PublishOption: SwiftProtobuf.Message, SwiftPro 5: .standard(proto: "max_spatial_layers"), 6: .standard(proto: "max_temporal_layers"), 7: .standard(proto: "video_dimension"), + 8: .same(proto: "id"), ] mutating func decodeMessage(decoder: inout D) throws { @@ -1875,6 +1890,7 @@ extension Stream_Video_Sfu_Models_PublishOption: SwiftProtobuf.Message, SwiftPro case 5: try { try decoder.decodeSingularInt32Field(value: &self.maxSpatialLayers) }() case 6: try { try decoder.decodeSingularInt32Field(value: &self.maxTemporalLayers) }() case 7: try { try decoder.decodeSingularMessageField(value: &self._videoDimension) }() + case 8: try { try decoder.decodeSingularInt32Field(value: &self.id) }() default: break } } @@ -1906,6 +1922,9 @@ extension Stream_Video_Sfu_Models_PublishOption: SwiftProtobuf.Message, SwiftPro try { if let v = self._videoDimension { try visitor.visitSingularMessageField(value: v, fieldNumber: 7) } }() + if self.id != 0 { + try visitor.visitSingularInt32Field(value: self.id, fieldNumber: 8) + } try unknownFields.traverse(visitor: &visitor) } @@ -1917,6 +1936,7 @@ extension Stream_Video_Sfu_Models_PublishOption: SwiftProtobuf.Message, SwiftPro if lhs.maxSpatialLayers != rhs.maxSpatialLayers {return false} if lhs.maxTemporalLayers != rhs.maxTemporalLayers {return false} if lhs._videoDimension != rhs._videoDimension {return false} + if lhs.id != rhs.id {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true }