From 950b91ad07cbcde1ddc888129075ba887afebe5c Mon Sep 17 00:00:00 2001 From: Brazol Date: Mon, 23 Dec 2024 16:23:06 +0100 Subject: [PATCH] added codec to track info --- .../lib/protobuf/video/sfu/models/models.pb.dart | 16 ++++++++++++++++ .../protobuf/video/sfu/models/models.pbjson.dart | 4 +++- .../video/sfu/signal_rpc/signal.pbjson.dart | 1 + .../lib/src/call/session/call_session.dart | 1 + .../lib/src/webrtc/model/rtc_tracks_info.dart | 5 ++++- .../stream_video/lib/src/webrtc/rtc_manager.dart | 3 +++ 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/stream_video/lib/protobuf/video/sfu/models/models.pb.dart b/packages/stream_video/lib/protobuf/video/sfu/models/models.pb.dart index 8e3f43ad4..553f882cd 100644 --- a/packages/stream_video/lib/protobuf/video/sfu/models/models.pb.dart +++ b/packages/stream_video/lib/protobuf/video/sfu/models/models.pb.dart @@ -1136,6 +1136,7 @@ class TrackInfo extends $pb.GeneratedMessage { $core.bool? stereo, $core.bool? red, $core.bool? muted, + Codec? codec, }) { final $result = create(); if (trackId != null) { @@ -1162,6 +1163,9 @@ class TrackInfo extends $pb.GeneratedMessage { if (muted != null) { $result.muted = muted; } + if (codec != null) { + $result.codec = codec; + } return $result; } TrackInfo._() : super(); @@ -1177,6 +1181,7 @@ class TrackInfo extends $pb.GeneratedMessage { ..aOB(8, _omitFieldNames ? '' : 'stereo') ..aOB(9, _omitFieldNames ? '' : 'red') ..aOB(10, _omitFieldNames ? '' : 'muted') + ..aOM(11, _omitFieldNames ? '' : 'codec', subBuilder: Codec.create) ..hasRequiredFields = false ; @@ -1267,6 +1272,17 @@ class TrackInfo extends $pb.GeneratedMessage { $core.bool hasMuted() => $_has(7); @$pb.TagNumber(10) void clearMuted() => clearField(10); + + @$pb.TagNumber(11) + Codec get codec => $_getN(8); + @$pb.TagNumber(11) + set codec(Codec v) { setField(11, v); } + @$pb.TagNumber(11) + $core.bool hasCodec() => $_has(8); + @$pb.TagNumber(11) + void clearCodec() => clearField(11); + @$pb.TagNumber(11) + Codec ensureCodec() => $_ensure(8); } class Error extends $pb.GeneratedMessage { diff --git a/packages/stream_video/lib/protobuf/video/sfu/models/models.pbjson.dart b/packages/stream_video/lib/protobuf/video/sfu/models/models.pbjson.dart index 821a63529..a932c725c 100644 --- a/packages/stream_video/lib/protobuf/video/sfu/models/models.pbjson.dart +++ b/packages/stream_video/lib/protobuf/video/sfu/models/models.pbjson.dart @@ -480,6 +480,7 @@ const TrackInfo$json = { {'1': 'stereo', '3': 8, '4': 1, '5': 8, '10': 'stereo'}, {'1': 'red', '3': 9, '4': 1, '5': 8, '10': 'red'}, {'1': 'muted', '3': 10, '4': 1, '5': 8, '10': 'muted'}, + {'1': 'codec', '3': 11, '4': 1, '5': 11, '6': '.stream.video.sfu.models.Codec', '10': 'codec'}, ], }; @@ -489,7 +490,8 @@ final $typed_data.Uint8List trackInfoDescriptor = $convert.base64Decode( 'EoDjIiLnN0cmVhbS52aWRlby5zZnUubW9kZWxzLlRyYWNrVHlwZVIJdHJhY2tUeXBlEjsKBmxh' 'eWVycxgFIAMoCzIjLnN0cmVhbS52aWRlby5zZnUubW9kZWxzLlZpZGVvTGF5ZXJSBmxheWVycx' 'IQCgNtaWQYBiABKAlSA21pZBIQCgNkdHgYByABKAhSA2R0eBIWCgZzdGVyZW8YCCABKAhSBnN0' - 'ZXJlbxIQCgNyZWQYCSABKAhSA3JlZBIUCgVtdXRlZBgKIAEoCFIFbXV0ZWQ='); + 'ZXJlbxIQCgNyZWQYCSABKAhSA3JlZBIUCgVtdXRlZBgKIAEoCFIFbXV0ZWQSNAoFY29kZWMYCy' + 'ABKAsyHi5zdHJlYW0udmlkZW8uc2Z1Lm1vZGVscy5Db2RlY1IFY29kZWM='); @$core.Deprecated('Use errorDescriptor instead') const Error$json = { diff --git a/packages/stream_video/lib/protobuf/video/sfu/signal_rpc/signal.pbjson.dart b/packages/stream_video/lib/protobuf/video/sfu/signal_rpc/signal.pbjson.dart index b54eed6a9..7cf5b4ae0 100644 --- a/packages/stream_video/lib/protobuf/video/sfu/signal_rpc/signal.pbjson.dart +++ b/packages/stream_video/lib/protobuf/video/sfu/signal_rpc/signal.pbjson.dart @@ -384,6 +384,7 @@ const $core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> SignalServ '.stream.video.sfu.models.TrackInfo': $0.TrackInfo$json, '.stream.video.sfu.models.VideoLayer': $0.VideoLayer$json, '.stream.video.sfu.models.VideoDimension': $0.VideoDimension$json, + '.stream.video.sfu.models.Codec': $0.Codec$json, '.stream.video.sfu.signal.SetPublisherResponse': SetPublisherResponse$json, '.stream.video.sfu.models.Error': $0.Error$json, '.stream.video.sfu.signal.SendAnswerRequest': SendAnswerRequest$json, diff --git a/packages/stream_video/lib/src/call/session/call_session.dart b/packages/stream_video/lib/src/call/session/call_session.dart index d7c7dc3e8..b957b413c 100644 --- a/packages/stream_video/lib/src/call/session/call_session.dart +++ b/packages/stream_video/lib/src/call/session/call_session.dart @@ -1030,6 +1030,7 @@ extension RtcTracksInfoMapper on List { trackId: info.trackId, trackType: info.trackType?.toDTO(), mid: info.mid, + codec: info.codec?.toDTO(), layers: info.layers?.map((layer) { return sfu_models.VideoLayer( rid: layer.rid, diff --git a/packages/stream_video/lib/src/webrtc/model/rtc_tracks_info.dart b/packages/stream_video/lib/src/webrtc/model/rtc_tracks_info.dart index 23d315942..7342232ba 100644 --- a/packages/stream_video/lib/src/webrtc/model/rtc_tracks_info.dart +++ b/packages/stream_video/lib/src/webrtc/model/rtc_tracks_info.dart @@ -1,3 +1,4 @@ +import '../../sfu/data/models/sfu_codec.dart'; import '../../sfu/data/models/sfu_track_type.dart'; import 'rtc_video_parameters.dart'; @@ -7,17 +8,19 @@ class RtcTrackInfo { required this.trackType, required this.mid, required this.layers, + required this.codec, }); final String? trackId; final SfuTrackType? trackType; final String? mid; final List? layers; + final SfuCodec? codec; @override String toString() { return 'RtcTrackInfo{trackId: $trackId, trackType: $trackType, ' - 'mid: $mid, layers: $layers}'; + 'mid: $mid, layers: $layers, codec: $codec}'; } } diff --git a/packages/stream_video/lib/src/webrtc/rtc_manager.dart b/packages/stream_video/lib/src/webrtc/rtc_manager.dart index 6a399508f..3ccbd7f4b 100644 --- a/packages/stream_video/lib/src/webrtc/rtc_manager.dart +++ b/packages/stream_video/lib/src/webrtc/rtc_manager.dart @@ -7,6 +7,7 @@ import 'package:stream_webrtc_flutter/stream_webrtc_flutter.dart' as rtc; import '../../stream_video.dart'; import '../disposable.dart'; import '../errors/video_error_composer.dart'; +import '../sfu/data/models/sfu_model_mapper_extensions.dart'; import '../sfu/data/models/sfu_model_parser.dart'; import '../sfu/data/models/sfu_publish_options.dart'; import '../sfu/data/models/sfu_video_sender.dart'; @@ -551,6 +552,7 @@ extension PublisherRtcManager on RtcManager { sdp, ), layers: [], + codec: transceiverCache.publishOption.codec, ); } else if (track is RtcLocalVideoTrack) { final dimension = _getTrackDimension(track); @@ -568,6 +570,7 @@ extension PublisherRtcManager on RtcManager { transceiverInitialIndex, sdp, ), + codec: transceiverCache.publishOption.codec, layers: encodings.map((it) { final scale = it.scaleResolutionDownBy ?? 1; return RtcVideoLayer(