Skip to content

Commit

Permalink
fix: Optimize stats display (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc authored Oct 9, 2024
1 parent 1953be8 commit 519b25b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions example/lib/widgets/participant_stats.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ class _ParticipantStatsWidgetState extends State<ParticipantStatsWidget> {
event.stats['f'] ?? event.stats['h'] ?? event.stats['q'];
if (firstStats != null) {
stats['encoder'] = firstStats.encoderImplementation ?? '';
stats['codec'] =
'${firstStats.mimeType!.split('/')[1]}/${firstStats.clockRate}';
if (firstStats.mimeType != null) {
stats['codec'] =
'${firstStats.mimeType!.split('/')[1]}/${firstStats.clockRate}';
}
stats['payload'] = '${firstStats.payloadType}';
stats['qualityLimitationReason'] =
firstStats.qualityLimitationReason ?? '';
Expand All @@ -54,8 +56,10 @@ class _ParticipantStatsWidgetState extends State<ParticipantStatsWidget> {
Map<String, String> stats = {};
setState(() {
stats['rx'] = '${event.currentBitrate.toInt()} kpbs';
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}';
if (event.stats.mimeType != null) {
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}';
}
stats['payload'] = '${event.stats.payloadType}';
stats['size/fps'] =
'${event.stats.frameWidth}x${event.stats.frameHeight} ${event.stats.framesPerSecond?.toDouble()}fps';
Expand All @@ -76,8 +80,10 @@ class _ParticipantStatsWidgetState extends State<ParticipantStatsWidget> {
Map<String, String> stats = {};
setState(() {
stats['tx'] = '${event.currentBitrate.toInt()} kpbs';
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}/${event.stats.channels}';
if (event.stats.mimeType != null) {
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}/${event.stats.channels}';
}
stats['payload'] = '${event.stats.payloadType}';
this.stats['audio']!.addEntries(stats.entries);
});
Expand All @@ -88,8 +94,10 @@ class _ParticipantStatsWidgetState extends State<ParticipantStatsWidget> {
Map<String, String> stats = {};
setState(() {
stats['rx'] = '${event.currentBitrate.toInt()} kpbs';
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}/${event.stats.channels}';
if (event.stats.mimeType != null) {
stats['codec'] =
'${event.stats.mimeType!.split('/')[1]}/${event.stats.clockRate}/${event.stats.channels}';
}
stats['payload'] = '${event.stats.payloadType}';
stats['jitter'] = '${event.stats.jitter} s';
//stats['concealed samples'] =
Expand Down

0 comments on commit 519b25b

Please sign in to comment.