Skip to content

Commit 9d55b4d

Browse files
authored
fix(llc): Fixes for various small ringing issues (#840)
* call cleanup + small ringing fixes * more fixes * method rename * tweaks
1 parent 2d33299 commit 9d55b4d

File tree

14 files changed

+250
-70
lines changed

14 files changed

+250
-70
lines changed

dogfooding/lib/app/app_content.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
5858

5959
Future<bool> _handleRemoteMessage(RemoteMessage message) async {
6060
final streamVideo = locator.get<StreamVideo>();
61-
return streamVideo.handleVoipPushNotification(message.data);
61+
return streamVideo.handleRingingFlowNotifications(message.data);
6262
}
6363

6464
class StreamDogFoodingAppContent extends StatefulWidget {

dogfooding/lib/screens/home_screen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class _HomeScreenState extends State<HomeScreen> {
7575
closedCaptionsVisibleCaptions: 3,
7676
closedCaptionsVisibilityDurationMs: 5000,
7777
),
78+
7879
// Uncomment to force a specific codec when publishing video track
7980
// preferences: DefaultCallPreferences(
8081
// clientPublishOptions: ClientPublishOptions(

packages/stream_video/lib/src/call/call.dart

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ class Call {
908908
StreamBackstageSettings? backstage,
909909
StreamGeofencingSettings? geofencing,
910910
StreamLimitsSettings? limits,
911+
StreamBroadcastingSettings? broadcasting,
911912
}) {
912913
return _coordinatorClient.updateCall(
913914
callCid: callCid,
@@ -972,15 +973,19 @@ class Call {
972973
_streamVideo.state.currentUser.type == UserType.anonymous,
973974
);
974975

975-
_subscriptions.add(
976-
_idSessionStats,
977-
StatsReporter(
978-
rtcManager: session.rtcManager!,
979-
stateManager: _stateManager,
980-
).run(interval: _preferences.callStatsReportingInterval).listen((stats) {
981-
_stats.emit(stats);
982-
}),
983-
);
976+
if (session.rtcManager != null) {
977+
_subscriptions.add(
978+
_idSessionStats,
979+
StatsReporter(
980+
rtcManager: session.rtcManager!,
981+
stateManager: _stateManager,
982+
)
983+
.run(interval: _preferences.callStatsReportingInterval)
984+
.listen((stats) {
985+
_stats.emit(stats);
986+
}),
987+
);
988+
}
984989

985990
if (_statsReportingIntervalMs != null) {
986991
_sfuStatsReporter = SfuStatsReporter(
@@ -1263,8 +1268,15 @@ class Call {
12631268
_cancelables.cancelAll();
12641269
await _session?.dispose();
12651270
await dynascaleManager.dispose();
1266-
await _streamVideo.state.setActiveCall(null);
1267-
await _streamVideo.state.setOutgoingCall(null);
1271+
1272+
if (_streamVideo.state.activeCall.valueOrNull?.callCid == callCid) {
1273+
await _streamVideo.state.setActiveCall(null);
1274+
}
1275+
1276+
if (_streamVideo.state.outgoingCall.valueOrNull?.callCid == callCid) {
1277+
await _streamVideo.state.setOutgoingCall(null);
1278+
}
1279+
12681280
_logger.v(() => '[clear] completed');
12691281
}
12701282

@@ -1688,6 +1700,8 @@ class Call {
16881700
StreamLimitsSettings? limits,
16891701
StreamRecordingSettings? recording,
16901702
StreamTranscriptionSettings? transcription,
1703+
StreamBroadcastingSettings? broadcasting,
1704+
StreamGeofencingSettings? geofencing,
16911705
Map<String, Object> custom = const {},
16921706
}) async {
16931707
_logger.d(
@@ -1708,6 +1722,8 @@ class Call {
17081722
limits: limits?.toOpenDto(),
17091723
transcription: transcription?.toOpenDto(),
17101724
recording: recording?.toOpenDto(),
1725+
broadcasting: broadcasting?.toOpenDto(),
1726+
geofencing: geofencing?.toOpenDto(),
17111727
);
17121728

17131729
final response = await _coordinatorClient.getOrCreateCall(
@@ -2127,14 +2143,20 @@ class Call {
21272143
/// Starts the livestreaming of the call.
21282144
Future<Result<CallMetadata>> goLive({
21292145
bool? startHls,
2146+
bool? startRtmpBroadcasts,
21302147
bool? startRecording,
21312148
bool? startTranscription,
2149+
bool? startClosedCaption,
2150+
String? transcriptionStorageName,
21322151
}) async {
21332152
final result = await _coordinatorClient.goLive(
21342153
callCid: callCid,
21352154
startHls: startHls,
2155+
startRtmpBroadcasts: startRtmpBroadcasts,
21362156
startRecording: startRecording,
21372157
startTranscription: startTranscription,
2158+
startClosedCaption: startClosedCaption,
2159+
transcriptionStorageName: transcriptionStorageName,
21382160
);
21392161

21402162
if (result.isSuccess) {

packages/stream_video/lib/src/call/session/dynascale_manager.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ class DynascaleManager {
9494
incomingVideoSettings?.preferredResolution;
9595

9696
if (enabled == null) {
97-
subscribtions[key] = value;
97+
if (value.dimension != null) {
98+
subscribtions[key] = value;
99+
}
98100
} else if (enabled) {
99101
subscribtions[key] = value.copyWith(dimension: preferredResolution);
100102
}

packages/stream_video/lib/src/coordinator/coordinator_client.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,11 @@ abstract class CoordinatorClient {
234234
Future<Result<CallMetadata>> goLive({
235235
required StreamCallCid callCid,
236236
bool? startHls,
237+
bool? startRtmpBroadcasts,
237238
bool? startRecording,
238239
bool? startTranscription,
240+
bool? startClosedCaption,
241+
String? transcriptionStorageName,
239242
});
240243

241244
Future<Result<CallMetadata>> stopLive(StreamCallCid callCid);

packages/stream_video/lib/src/coordinator/models/coordinator_events.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ class CoordinatorCallCreatedEvent extends CoordinatorCallEvent {
100100
class CoordinatorCallRingingEvent extends CoordinatorCallEvent {
101101
const CoordinatorCallRingingEvent({
102102
required this.data,
103+
required this.video,
103104
required this.sessionId,
104105
required this.createdAt,
105106
});
106107

107108
final CallRingingData data;
109+
final bool video;
108110
final String sessionId;
109111
final DateTime createdAt;
110112

packages/stream_video/lib/src/coordinator/open_api/coordinator_client_open_api.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ class CoordinatorClientOpenApi extends CoordinatorClient {
152152
return const Result.success(none);
153153
}
154154

155-
_logger.d(() =>
156-
'[waitUntilConnected] user.id: ${_user?.id}, current state: ${_connectionState.value},');
155+
_logger.d(
156+
() =>
157+
'[waitUntilConnected] user.id: ${_user?.id}, current state: ${_connectionState.value},',
158+
);
157159
return _connectionState
158160
.firstWhere(
159161
(it) => it.isConnected,
@@ -1110,8 +1112,11 @@ class CoordinatorClientOpenApi extends CoordinatorClient {
11101112
Future<Result<CallMetadata>> goLive({
11111113
required StreamCallCid callCid,
11121114
bool? startHls,
1115+
bool? startRtmpBroadcasts,
11131116
bool? startRecording,
11141117
bool? startTranscription,
1118+
bool? startClosedCaption,
1119+
String? transcriptionStorageName,
11151120
}) async {
11161121
try {
11171122
final connectionResult = await _waitUntilConnected();
@@ -1126,6 +1131,9 @@ class CoordinatorClientOpenApi extends CoordinatorClient {
11261131
startHls: startHls,
11271132
startRecording: startRecording,
11281133
startTranscription: startTranscription,
1134+
startClosedCaption: startClosedCaption,
1135+
startRtmpBroadcasts: startRtmpBroadcasts,
1136+
transcriptionStorageName: transcriptionStorageName,
11291137
),
11301138
);
11311139
if (result == null) {

packages/stream_video/lib/src/coordinator/open_api/open_api_extensions.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ extension on open.HLSSettingsResponse {
304304
extension on open.RTMPSettingsResponse {
305305
StreamRtmpSettings toSettingsDomain() {
306306
return StreamRtmpSettings(
307-
quality: quality,
307+
quality: RTMPSettingsQuality.fromString(quality),
308308
enabled: enabled,
309309
);
310310
}

packages/stream_video/lib/src/coordinator/open_api/open_api_mapper_extensions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extension WebsocketEventMapperExt on OpenApiEvent {
5353
ringing: true,
5454
metadata: call.toCallMetadata(members: event.members),
5555
),
56+
video: event.video,
5657
sessionId: event.sessionId,
5758
createdAt: event.createdAt,
5859
);

packages/stream_video/lib/src/coordinator/retry/coordinator_client_retry.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,21 @@ class CoordinatorClientRetry extends CoordinatorClient {
170170
Future<Result<CallMetadata>> goLive({
171171
required StreamCallCid callCid,
172172
bool? startHls,
173+
bool? startRtmpBroadcasts,
173174
bool? startRecording,
174175
bool? startTranscription,
176+
bool? startClosedCaption,
177+
String? transcriptionStorageName,
175178
}) {
176179
return _retryManager.execute(
177180
() => _delegate.goLive(
178181
callCid: callCid,
179182
startHls: startHls,
183+
startRtmpBroadcasts: startRtmpBroadcasts,
180184
startRecording: startRecording,
181185
startTranscription: startTranscription,
186+
startClosedCaption: startClosedCaption,
187+
transcriptionStorageName: transcriptionStorageName,
182188
),
183189
(error, nextAttemptDelay) async {
184190
_logRetry('goLive', error, nextAttemptDelay);

0 commit comments

Comments
 (0)