Skip to content

Commit

Permalink
Added preferred subscribe options (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski authored Dec 10, 2024
1 parent ef297a9 commit 41e2316
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Sources/StreamVideo/protobuf/sfu/event/events.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,11 @@ struct Stream_Video_Sfu_Event_JoinRequest {
set {_uniqueStorage()._preferredPublishOptions = newValue}
}

var preferredSubscribeOptions: [Stream_Video_Sfu_Models_SubscribeOption] {
get {return _storage._preferredSubscribeOptions}
set {_uniqueStorage()._preferredSubscribeOptions = newValue}
}

var unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
Expand Down Expand Up @@ -2288,6 +2293,7 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
6: .standard(proto: "fast_reconnect"),
7: .standard(proto: "reconnect_details"),
9: .standard(proto: "preferred_publish_options"),
10: .standard(proto: "preferred_subscribe_options"),
]

fileprivate class _StorageClass {
Expand All @@ -2300,6 +2306,7 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
var _fastReconnect: Bool = false
var _reconnectDetails: Stream_Video_Sfu_Event_ReconnectDetails? = nil
var _preferredPublishOptions: [Stream_Video_Sfu_Models_PublishOption] = []
var _preferredSubscribeOptions: [Stream_Video_Sfu_Models_SubscribeOption] = []

static let defaultInstance = _StorageClass()

Expand All @@ -2315,6 +2322,7 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
_fastReconnect = source._fastReconnect
_reconnectDetails = source._reconnectDetails
_preferredPublishOptions = source._preferredPublishOptions
_preferredSubscribeOptions = source._preferredSubscribeOptions
}
}

Expand Down Expand Up @@ -2342,6 +2350,7 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
case 7: try { try decoder.decodeSingularMessageField(value: &_storage._reconnectDetails) }()
case 8: try { try decoder.decodeSingularStringField(value: &_storage._publisherSdp) }()
case 9: try { try decoder.decodeRepeatedMessageField(value: &_storage._preferredPublishOptions) }()
case 10: try { try decoder.decodeRepeatedMessageField(value: &_storage._preferredSubscribeOptions) }()
default: break
}
}
Expand Down Expand Up @@ -2381,6 +2390,9 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
if !_storage._preferredPublishOptions.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._preferredPublishOptions, fieldNumber: 9)
}
if !_storage._preferredSubscribeOptions.isEmpty {
try visitor.visitRepeatedMessageField(value: _storage._preferredSubscribeOptions, fieldNumber: 10)
}
}
try unknownFields.traverse(visitor: &visitor)
}
Expand All @@ -2399,6 +2411,7 @@ extension Stream_Video_Sfu_Event_JoinRequest: SwiftProtobuf.Message, SwiftProtob
if _storage._fastReconnect != rhs_storage._fastReconnect {return false}
if _storage._reconnectDetails != rhs_storage._reconnectDetails {return false}
if _storage._preferredPublishOptions != rhs_storage._preferredPublishOptions {return false}
if _storage._preferredSubscribeOptions != rhs_storage._preferredSubscribeOptions {return false}
return true
}
if !storagesAreEqual {return false}
Expand Down
56 changes: 56 additions & 0 deletions Sources/StreamVideo/protobuf/sfu/models/models.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,23 @@ struct Stream_Video_Sfu_Models_VideoLayer {
fileprivate var _videoDimension: Stream_Video_Sfu_Models_VideoDimension? = nil
}

/// SubscribeOption represents the configuration options for subscribing to a track.
struct Stream_Video_Sfu_Models_SubscribeOption {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.

/// The type of the track being subscribed (e.g., video, screenshare).
var trackType: Stream_Video_Sfu_Models_TrackType = .unspecified

/// The codecs supported by the subscriber for decoding tracks.
var codecs: [Stream_Video_Sfu_Models_Codec] = []

var unknownFields = SwiftProtobuf.UnknownStorage()

init() {}
}

/// PublishOption represents the configuration options for publishing a track.
struct Stream_Video_Sfu_Models_PublishOption {
// SwiftProtobuf.Message conformance is added in an extension below. See the
Expand Down Expand Up @@ -1334,6 +1351,7 @@ extension Stream_Video_Sfu_Models_Participant: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_StreamQuality: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_VideoDimension: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_VideoLayer: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_SubscribeOption: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_PublishOption: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_Codec: @unchecked Sendable {}
extension Stream_Video_Sfu_Models_ICETrickle: @unchecked Sendable {}
Expand Down Expand Up @@ -1864,6 +1882,44 @@ extension Stream_Video_Sfu_Models_VideoLayer: SwiftProtobuf.Message, SwiftProtob
}
}

extension Stream_Video_Sfu_Models_SubscribeOption: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".SubscribeOption"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
1: .standard(proto: "track_type"),
2: .same(proto: "codecs"),
]

mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
// The use of inline closures is to circumvent an issue where the compiler
// 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.decodeSingularEnumField(value: &self.trackType) }()
case 2: try { try decoder.decodeRepeatedMessageField(value: &self.codecs) }()
default: break
}
}
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if self.trackType != .unspecified {
try visitor.visitSingularEnumField(value: self.trackType, fieldNumber: 1)
}
if !self.codecs.isEmpty {
try visitor.visitRepeatedMessageField(value: self.codecs, fieldNumber: 2)
}
try unknownFields.traverse(visitor: &visitor)
}

static func ==(lhs: Stream_Video_Sfu_Models_SubscribeOption, rhs: Stream_Video_Sfu_Models_SubscribeOption) -> Bool {
if lhs.trackType != rhs.trackType {return false}
if lhs.codecs != rhs.codecs {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension Stream_Video_Sfu_Models_PublishOption: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
static let protoMessageName: String = _protobuf_package + ".PublishOption"
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
Expand Down

0 comments on commit 41e2316

Please sign in to comment.