Skip to content

Commit

Permalink
added codec to track info
Browse files Browse the repository at this point in the history
  • Loading branch information
Brazol committed Dec 23, 2024
1 parent 8b9d35e commit 950b91a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
16 changes: 16 additions & 0 deletions packages/stream_video/lib/protobuf/video/sfu/models/models.pb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand All @@ -1177,6 +1181,7 @@ class TrackInfo extends $pb.GeneratedMessage {
..aOB(8, _omitFieldNames ? '' : 'stereo')
..aOB(9, _omitFieldNames ? '' : 'red')
..aOB(10, _omitFieldNames ? '' : 'muted')
..aOM<Codec>(11, _omitFieldNames ? '' : 'codec', subBuilder: Codec.create)
..hasRequiredFields = false
;

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
],
};

Expand All @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ extension RtcTracksInfoMapper on List<RtcTrackInfo> {
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../../sfu/data/models/sfu_codec.dart';
import '../../sfu/data/models/sfu_track_type.dart';
import 'rtc_video_parameters.dart';

Expand All @@ -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<RtcVideoLayer>? layers;
final SfuCodec? codec;

@override
String toString() {
return 'RtcTrackInfo{trackId: $trackId, trackType: $trackType, '
'mid: $mid, layers: $layers}';
'mid: $mid, layers: $layers, codec: $codec}';
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/stream_video/lib/src/webrtc/rtc_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -551,6 +552,7 @@ extension PublisherRtcManager on RtcManager {
sdp,
),
layers: [],
codec: transceiverCache.publishOption.codec,
);
} else if (track is RtcLocalVideoTrack) {
final dimension = _getTrackDimension(track);
Expand All @@ -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(
Expand Down

0 comments on commit 950b91a

Please sign in to comment.