Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated updated code for codec negotiation #610

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
1 change: 0 additions & 1 deletion Sources/StreamVideo/WebSockets/Events/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
66 changes: 14 additions & 52 deletions Sources/StreamVideo/protobuf/sfu/event/events.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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"),
]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
Expand All @@ -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<V: SwiftProtobuf.Visitor>(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
}
Expand Down
20 changes: 20 additions & 0 deletions Sources/StreamVideo/protobuf/sfu/models/models.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -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<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
Expand All @@ -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
}
}
Expand Down Expand Up @@ -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)
}

Expand All @@ -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
}
Expand Down
Loading