Skip to content

Commit

Permalink
feat: update to the newest protocol, support publishing multiple trac…
Browse files Browse the repository at this point in the history
…ks of the same kind
  • Loading branch information
oliverlaz committed Dec 3, 2024
1 parent 7240b55 commit cf4ed2f
Show file tree
Hide file tree
Showing 12 changed files with 467 additions and 634 deletions.
76 changes: 57 additions & 19 deletions packages/client/src/gen/video/sfu/event/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,6 @@ export interface SfuEvent {
*/
participantMigrationComplete: ParticipantMigrationComplete;
}
| {
oneofKind: 'changePublishOptionsComplete';
/**
* ChangePublishOptionsComplete is sent to signal the completion of a ChangePublishOptions request.
*
* @generated from protobuf field: stream.video.sfu.event.ChangePublishOptionsComplete change_publish_options_complete = 26;
*/
changePublishOptionsComplete: ChangePublishOptionsComplete;
}
| {
oneofKind: 'changePublishOptions';
/**
Expand All @@ -270,9 +261,13 @@ export interface SfuEvent {
*/
export interface ChangePublishOptions {
/**
* @generated from protobuf field: stream.video.sfu.models.PublishOption publish_option = 1;
* @generated from protobuf field: repeated stream.video.sfu.models.PublishOption publish_options = 1;
*/
publishOptions: PublishOption[];
/**
* @generated from protobuf field: string reason = 2;
*/
publishOption?: PublishOption;
reason: string;
}
/**
* @generated from protobuf message stream.video.sfu.event.ChangePublishOptionsComplete
Expand Down Expand Up @@ -731,6 +726,14 @@ export interface AudioSender {
* @generated from protobuf field: stream.video.sfu.models.Codec codec = 2;
*/
codec?: Codec;
/**
* @generated from protobuf field: stream.video.sfu.models.TrackType track_type = 3;
*/
trackType: TrackType;
/**
* @generated from protobuf field: int32 publish_option_id = 4;
*/
publishOptionId: number;
}
/**
* VideoLayerSetting is used to specify various parameters of a particular encoding in simulcast.
Expand Down Expand Up @@ -781,6 +784,14 @@ export interface VideoSender {
* @generated from protobuf field: repeated stream.video.sfu.event.VideoLayerSetting layers = 3;
*/
layers: VideoLayerSetting[];
/**
* @generated from protobuf field: stream.video.sfu.models.TrackType track_type = 4;
*/
trackType: TrackType;
/**
* @generated from protobuf field: int32 publish_option_id = 5;
*/
publishOptionId: number;
}
/**
* sent to users when they need to change the quality of their video
Expand Down Expand Up @@ -1002,13 +1013,6 @@ class SfuEvent$Type extends MessageType<SfuEvent> {
oneof: 'eventPayload',
T: () => ParticipantMigrationComplete,
},
{
no: 26,
name: 'change_publish_options_complete',
kind: 'message',
oneof: 'eventPayload',
T: () => ChangePublishOptionsComplete,
},
{
no: 27,
name: 'change_publish_options',
Expand All @@ -1029,10 +1033,12 @@ class ChangePublishOptions$Type extends MessageType<ChangePublishOptions> {
super('stream.video.sfu.event.ChangePublishOptions', [
{
no: 1,
name: 'publish_option',
name: 'publish_options',
kind: 'message',
repeat: 1 /*RepeatType.PACKED*/,
T: () => PublishOption,
},
{ no: 2, name: 'reason', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
]);
}
}
Expand Down Expand Up @@ -1589,6 +1595,22 @@ class AudioSender$Type extends MessageType<AudioSender> {
constructor() {
super('stream.video.sfu.event.AudioSender', [
{ no: 2, name: 'codec', kind: 'message', T: () => Codec },
{
no: 3,
name: 'track_type',
kind: 'enum',
T: () => [
'stream.video.sfu.models.TrackType',
TrackType,
'TRACK_TYPE_',
],
},
{
no: 4,
name: 'publish_option_id',
kind: 'scalar',
T: 5 /*ScalarType.INT32*/,
},
]);
}
}
Expand Down Expand Up @@ -1641,6 +1663,22 @@ class VideoSender$Type extends MessageType<VideoSender> {
repeat: 1 /*RepeatType.PACKED*/,
T: () => VideoLayerSetting,
},
{
no: 4,
name: 'track_type',
kind: 'enum',
T: () => [
'stream.video.sfu.models.TrackType',
TrackType,
'TRACK_TYPE_',
],
},
{
no: 5,
name: 'publish_option_id',
kind: 'scalar',
T: 5 /*ScalarType.INT32*/,
},
]);
}
}
Expand Down
18 changes: 18 additions & 0 deletions packages/client/src/gen/video/sfu/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ export interface PublishOption {
* @generated from protobuf field: stream.video.sfu.models.VideoDimension video_dimension = 7;
*/
videoDimension?: VideoDimension;
/**
* 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.
*
* @generated from protobuf field: int32 id = 8;
*/
id: number;
}
/**
* @generated from protobuf message stream.video.sfu.models.Codec
Expand Down Expand Up @@ -1159,6 +1176,7 @@ class PublishOption$Type extends MessageType<PublishOption> {
kind: 'message',
T: () => VideoDimension,
},
{ no: 8, name: 'id', kind: 'scalar', T: 5 /*ScalarType.INT32*/ },
]);
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/rtc/Dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const sfuEventKinds: { [key in SfuEventKinds]: undefined } = {
callEnded: undefined,
participantUpdated: undefined,
participantMigrationComplete: undefined,
changePublishOptionsComplete: undefined,
changePublishOptions: undefined,
};

Expand Down
Loading

0 comments on commit cf4ed2f

Please sign in to comment.