Skip to content

Commit

Permalink
feat: codec negotiation (#811)
Browse files Browse the repository at this point in the history
* Video filters

* tweak

* fix

* custom filter added

* fix

* tweaks

* Codec negotiation

* client publish options added

* force TF build

* dep fix

* replace duplicate resource bundle name

* fixed target name

* use xcode 16 to distribte

* podfile test

* remove duplicate bundle

* remove resource bundle 2

* podfile fix

* fixes

* tweaks

* don't log stats request

* setting publish options when reconnecting

* log tweaks

* dogfooding: disable autocorrect in call id input

* announce tracks change for reconnect

* enable env switcher

* log tweak

* added codec to track info

* added muted to track info

* revert temp changes

* publish option id added to trackinfo

* fmtp line

* fix

* fix for race between negotiation and initial track creation

* cleanup

* tweaks

* changelog
  • Loading branch information
Brazol authored Jan 15, 2025
1 parent 52df588 commit 32f8517
Show file tree
Hide file tree
Showing 54 changed files with 2,344 additions and 516 deletions.
2 changes: 1 addition & 1 deletion dogfooding/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion dogfooding/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end

# fix xcode 15 DT_TOOLCHAIN_DIR - remove after fix oficially - https://github.com/CocoaPods/CocoaPods/issues/12065
installer.aggregate_targets.each do |target|
target.xcconfigs.each do |variant, xcconfig|
Expand Down
277 changes: 161 additions & 116 deletions dogfooding/lib/screens/call_stats_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,134 +28,180 @@ class CallStatsScreen extends StatelessWidget {
final subscriberBitrate = state?.subscriberStats?.bitrateKbps;
final publisherBitrate = state?.publisherStats?.bitrateKbps;

return Scaffold(
appBar: AppBar(
title: Text(
'Stats',
style: textTheme.title3.apply(color: Colors.white),
),
centerTitle: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
actions: [
IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
onPressed: () {
Navigator.of(context).pop();
},
return SafeArea(
top: false,
child: Scaffold(
appBar: AppBar(
title: Text(
'Stats',
style: textTheme.title3.apply(color: Colors.white),
),
],
),
body: SingleChildScrollView(
child: Column(
children: [
ListTile(
leading: StreamUserAvatar(user: currentUser!),
title: const Text(
'Call ID',
style: TextStyle(color: Colors.white),
),
subtitle: Text(
call.callCid.value,
style: const TextStyle(color: Colors.white),
centerTitle: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
actions: [
IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
onPressed: () {
Navigator.of(context).pop();
},
),
if (snapshot.hasData) ...[
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
],
),
body: SingleChildScrollView(
child: Column(
children: [
ListTile(
leading: StreamUserAvatar(user: currentUser!),
title: const Text(
'Call ID',
style: TextStyle(color: Colors.white),
),
subtitle: Text(
call.callCid.value,
style: const TextStyle(color: Colors.white),
),
),
if (snapshot.hasData) ...[
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
const Icon(Icons.network_check,
color: Colors.white),
const SizedBox(width: 8),
Text(
'Call latency',
style:
textTheme.title3.apply(color: Colors.white),
),
],
),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'Very high latency values may reduce call quality, cause lag, and make the call less enjoyable.',
style: TextStyle(color: Colors.white),
),
),
const SizedBox(
height: 16,
),
SizedBox(
height: 200,
child: StatsLatencyChart(
latencyHistory: state!.latencyHistory,
),
),
const SizedBox(
height: 16,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
const Icon(Icons.bar_chart, color: Colors.white),
const SizedBox(width: 8),
Text(
'Call performance',
style:
textTheme.title3.apply(color: Colors.white),
),
],
),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'Review the key data points below to assess call performance.',
style: TextStyle(color: Colors.white),
),
),
const SizedBox(
height: 16,
),
Row(
children: [
const Icon(Icons.network_check, color: Colors.white),
const SizedBox(width: 8),
Text(
'Call latency',
style: textTheme.title3.apply(color: Colors.white),
Expanded(
child: LatencyOrJitterItem(
title: 'Latency',
value: state.publisherStats?.latency ?? 0,
),
),
],
),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'Very high latency values may reduce call quality, cause lag, and make the call less enjoyable.',
style: TextStyle(color: Colors.white),
Row(
children: [
Expanded(
child: LatencyOrJitterItem(
title: 'Receive jitter',
value: state.subscriberStats?.jitterInMs,
),
),
Expanded(
child: LatencyOrJitterItem(
title: 'Publish jitter',
value: state.publisherStats?.jitterInMs,
),
),
],
),
),
const SizedBox(
height: 16,
),
SizedBox(
height: 200,
child: StatsLatencyChart(
latencyHistory: state!.latencyHistory,
Row(
children: [
Expanded(
child: StatsItem(
title: 'Publish bitrate',
value: publisherBitrate == null
? '--'
: '${state.publisherStats?.bitrateKbps} Kbps',
),
),
Expanded(
child: StatsItem(
title: 'Receive bitrate',
value: subscriberBitrate == null
? '--'
: '${state.subscriberStats?.bitrateKbps} Kbps',
),
),
],
),
),
const SizedBox(
height: 16,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
Row(
children: [
const Icon(Icons.bar_chart, color: Colors.white),
const SizedBox(width: 8),
Text(
'Call performance',
style: textTheme.title3.apply(color: Colors.white),
Expanded(
child: StatsItem(
title: 'Publish resolution',
value:
"${state.publisherStats?.resolution} | ${state.publisherStats?.videoCodec?.join('+')}",
),
),
Expanded(
child: StatsItem(
title: 'Reveive resolution',
value:
"${state.subscriberStats?.resolution} | ${state.subscriberStats?.videoCodec?.join('+')}",
),
),
],
),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
'Review the key data points below to assess call performance.',
style: TextStyle(color: Colors.white),
StatsItem(
title: 'Region',
value: state.localStats?.sfu,
),
),
const SizedBox(
height: 16,
),
LatencyOrJitterItem(
title: 'Latency',
value: state.publisherStats?.latency ?? 0,
),
LatencyOrJitterItem(
title: 'Receive jitter',
value: state.subscriberStats?.jitterInMs,
),
LatencyOrJitterItem(
title: 'Publish jitter',
value: state.publisherStats?.jitterInMs,
),
StatsItem(
title: 'Region',
value: state.localStats?.sfu,
),
StatsItem(
title: 'SDK Version',
value: state.localStats?.sdkVersion,
),
StatsItem(
title: 'WebRTC Version',
value: state.localStats?.webRtcVersion,
),
StatsItem(
title: 'Publish bitrate',
value: publisherBitrate == null
? '--'
: '${state.publisherStats?.bitrateKbps} Kbps',
),
StatsItem(
title: 'Receive bitrate',
value: subscriberBitrate == null
? '--'
: '${state.subscriberStats?.bitrateKbps} Kbps',
),
]
],
StatsItem(
title: 'SDK Version',
value: state.localStats?.sdkVersion,
),
StatsItem(
title: 'WebRTC Version',
value: state.localStats?.webRtcVersion,
),
]
],
),
),
),
);
Expand Down Expand Up @@ -205,7 +251,7 @@ class StatsItem extends StatelessWidget {
final theme = StreamVideoTheme.of(context);

return Container(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: AppColorPalette.buttonSecondary,
Expand All @@ -232,7 +278,6 @@ class StatsItem extends StatelessWidget {
),
),
if (trailing != null) ...[
const Spacer(),
trailing!,
],
],
Expand Down
16 changes: 15 additions & 1 deletion dogfooding/lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ class _HomeScreenState extends State<HomeScreen> {
if (callId.isEmpty) callId = generateAlphanumericString(12);

unawaited(showLoadingIndicator(context));
_call = _streamVideo.makeCall(callType: kCallType, id: callId);
_call = _streamVideo.makeCall(
callType: kCallType,
id: callId,
// Uncomment to force a specific codec when publishing video track
// preferences: DefaultCallPreferences(
// clientPublishOptions: ClientPublishOptions(
// preferredCodec: PreferredCodec.av1,
// fmtpLine: 'level-idx=5;profile=0;tier=0',
// ),
// ),
);

bool isRinging = memberIds.isNotEmpty;

Expand Down Expand Up @@ -283,6 +293,8 @@ class _JoinForm extends StatelessWidget {
child: TextField(
controller: callIdController,
style: const TextStyle(color: Colors.white),
autocorrect: false,
enableSuggestions: false,
decoration: InputDecoration(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(
Expand All @@ -296,6 +308,8 @@ class _JoinForm extends StatelessWidget {
),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
isDense: true,
hintStyle:
const TextStyle(color: AppColorPalette.secondaryText),
hintText: 'Enter call id',
// suffix button to generate a random call id
suffixIcon: IconButton(
Expand Down
2 changes: 1 addition & 1 deletion dogfooding/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
stream_video_screen_sharing: ^0.6.1

dependency_overrides:
archive: ^3.6.1
wakelock_plus: ^1.2.9
stream_video:
path: ../packages/stream_video
stream_video_flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,3 @@ class TranscriptionSettingsResponseModeEnumTypeTransformer {
/// Singleton [TranscriptionSettingsResponseModeEnumTypeTransformer] instance.
static TranscriptionSettingsResponseModeEnumTypeTransformer? _instance;
}


Loading

0 comments on commit 32f8517

Please sign in to comment.