Skip to content

Commit 677ad94

Browse files
committed
more logging for dynacast
1 parent d346763 commit 677ad94

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

example/lib/main.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import 'package:flutter/material.dart';
22
import 'package:livekit_example/theme.dart';
33
import 'package:logging/logging.dart';
4+
import 'package:intl/intl.dart';
45

56
import 'pages/connect.dart';
67

78
void main() {
9+
final format = DateFormat('HH:mm:ss');
810
// configure logs for debugging
911
Logger.root.level = Level.FINE;
1012
Logger.root.onRecord.listen((record) {
11-
print('${record.level.name}: ${record.message}');
13+
print('${format.format(record.time)}: ${record.message}');
1214
});
1315

1416
WidgetsFlutterBinding.ensureInitialized();

example/pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ packages:
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158158
version: "4.0.0"
159+
intl:
160+
dependency: "direct main"
161+
description:
162+
name: intl
163+
url: "https://pub.dartlang.org"
164+
source: hosted
165+
version: "0.17.0"
159166
js:
160167
dependency: transitive
161168
description:

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313

14+
intl: ^0.17.0
1415
flutter_background: 1.1.0
1516
provider: ^6.0.1
1617
logging: ^1.0.1

lib/src/core/room.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
177177
// Signal for Dynacast
178178
final options = roomOptions ?? const RoomOptions();
179179
// Dynacast is off or is unsupported
180-
if (!options.dynacast || _serverVersion == '0.15.1') return;
180+
if (!options.dynacast || _serverVersion == '0.15.1') {
181+
logger.fine('Received subscribed quality update'
182+
' but Dynacast is off or server version is not supported.');
183+
return;
184+
}
181185
// Find the publication
182186
final publication = localParticipant?.trackPublications[event.trackSid];
183187
if (publication == null) {

lib/src/publication/local.dart

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,24 @@ class LocalTrackPublication<T extends LocalTrack> extends TrackPublication<T> {
3737
@internal
3838
void updatePublishingLayers(List<lk_rtc.SubscribedQuality> layers) async {
3939
//
40+
logger.fine('Update publishing layers: $layers');
41+
4042
final params = track?.sender?.parameters;
41-
if (params == null) return;
43+
if (params == null) {
44+
logger.fine('Update publishing layers: sender params are null');
45+
return;
46+
}
4247

4348
final encodings = params.encodings;
44-
if (encodings == null) return;
49+
if (encodings == null) {
50+
logger.fine('Update publishing layers: encodings are null');
51+
return;
52+
}
4553

4654
bool didChange = false;
4755

4856
for (final encoding in encodings) {
57+
logger.fine('Processing encoding: ${encoding.rid}...');
4958
final layer = layers.firstWhereOrNull((e) =>
5059
// If there is exact match, use it
5160
(e.quality.toRid() == encoding.rid) ||
@@ -67,6 +76,8 @@ class LocalTrackPublication<T extends LocalTrack> extends TrackPublication<T> {
6776
if (result == false) {
6877
logger.warning('Failed to update sender parameters');
6978
}
79+
} else {
80+
logger.fine('Update publishing layers: nothing to change');
7081
}
7182
}
7283
}

0 commit comments

Comments
 (0)