Send DC info for syncState (#88)
* dc private methods * impl * pub * id * fix test
This commit is contained in:
@@ -51,4 +51,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||||
|
|
||||||
COCOAPODS: 1.11.2
|
COCOAPODS: 1.11.3
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ packages:
|
|||||||
name: dart_webrtc
|
name: dart_webrtc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -176,7 +176,7 @@ packages:
|
|||||||
name: flutter_webrtc
|
name: flutter_webrtc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.3"
|
version: "0.8.5"
|
||||||
google_fonts:
|
google_fonts:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -510,7 +510,7 @@ packages:
|
|||||||
name: webrtc_interface
|
name: webrtc_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.3"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+17
-10
@@ -529,6 +529,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
|||||||
answer: answer,
|
answer: answer,
|
||||||
subscription: subscription,
|
subscription: subscription,
|
||||||
publishTracks: publishTracks,
|
publishTracks: publishTracks,
|
||||||
|
dataChannelInfo: dataChannelInfo(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,7 +644,16 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension EngineInternalMethods on Engine {
|
extension EnginePrivateMethods on Engine {
|
||||||
|
// publisher data channel for the reliability
|
||||||
|
rtc.RTCDataChannel? _publisherDataChannel(Reliability reliability) =>
|
||||||
|
reliability == Reliability.reliable ? _reliableDCPub : _lossyDCPub;
|
||||||
|
|
||||||
|
// state of the publisher data channel
|
||||||
|
rtc.RTCDataChannelState _publisherDataChannelState(Reliability reliability) =>
|
||||||
|
_publisherDataChannel(reliability)?.state ??
|
||||||
|
rtc.RTCDataChannelState.RTCDataChannelClosed;
|
||||||
|
|
||||||
void _updateConnectionState(ConnectionState newValue) {
|
void _updateConnectionState(ConnectionState newValue) {
|
||||||
if (_connectionState == newValue) return;
|
if (_connectionState == newValue) return;
|
||||||
|
|
||||||
@@ -664,13 +674,10 @@ extension EngineInternalMethods on Engine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension EnginePrivateMethods on Engine {
|
extension EngineInternalMethods on Engine {
|
||||||
// publisher data channel for the reliability
|
@internal
|
||||||
rtc.RTCDataChannel? _publisherDataChannel(Reliability reliability) =>
|
List<lk_rtc.DataChannelInfo> dataChannelInfo() => [
|
||||||
reliability == Reliability.reliable ? _reliableDCPub : _lossyDCPub;
|
_reliableDCPub,
|
||||||
|
_lossyDCPub
|
||||||
// state of the publisher data channel
|
].whereNotNull().map((e) => e.toLKInfoType()).toList();
|
||||||
rtc.RTCDataChannelState _publisherDataChannelState(Reliability reliability) =>
|
|
||||||
_publisherDataChannel(reliability)?.state ??
|
|
||||||
rtc.RTCDataChannelState.RTCDataChannelClosed;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,12 +352,14 @@ extension SignalClientRequests on SignalClient {
|
|||||||
required lk_rtc.SessionDescription? answer,
|
required lk_rtc.SessionDescription? answer,
|
||||||
required lk_rtc.UpdateSubscription subscription,
|
required lk_rtc.UpdateSubscription subscription,
|
||||||
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
|
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
|
||||||
|
required Iterable<lk_rtc.DataChannelInfo>? dataChannelInfo,
|
||||||
}) =>
|
}) =>
|
||||||
_sendRequest(lk_rtc.SignalRequest(
|
_sendRequest(lk_rtc.SignalRequest(
|
||||||
syncState: lk_rtc.SyncState(
|
syncState: lk_rtc.SyncState(
|
||||||
answer: answer,
|
answer: answer,
|
||||||
subscription: subscription,
|
subscription: subscription,
|
||||||
publishTracks: publishTracks,
|
publishTracks: publishTracks,
|
||||||
|
dataChannels: dataChannelInfo,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ extension ReliabilityExt on Reliability {
|
|||||||
}[this]!;
|
}[this]!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension RTCDataChannelExt on rtc.RTCDataChannel {
|
||||||
|
lk_rtc.DataChannelInfo toLKInfoType() => lk_rtc.DataChannelInfo(
|
||||||
|
id: id,
|
||||||
|
label: label,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
extension RTCIceCandidateExt on rtc.RTCIceCandidate {
|
extension RTCIceCandidateExt on rtc.RTCIceCandidate {
|
||||||
static rtc.RTCIceCandidate fromJson(String jsonString) {
|
static rtc.RTCIceCandidate fromJson(String jsonString) {
|
||||||
final map = json.decode(jsonString) as Map<String, dynamic>;
|
final map = json.decode(jsonString) as Map<String, dynamic>;
|
||||||
|
|||||||
+4
-4
@@ -114,12 +114,12 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
dart_webrtc:
|
dart_webrtc:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: dart_webrtc
|
name: dart_webrtc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.5"
|
||||||
device_info_plus:
|
device_info_plus:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -218,7 +218,7 @@ packages:
|
|||||||
name: flutter_webrtc
|
name: flutter_webrtc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.3"
|
version: "0.8.5"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -496,7 +496,7 @@ packages:
|
|||||||
name: webrtc_interface
|
name: webrtc_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.3"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+1
-2
@@ -22,8 +22,7 @@ dependencies:
|
|||||||
uuid: ^3.0.4
|
uuid: ^3.0.4
|
||||||
synchronized: ^3.0.0
|
synchronized: ^3.0.0
|
||||||
protobuf: ^2.0.1
|
protobuf: ^2.0.1
|
||||||
flutter_webrtc: ^0.8.3
|
flutter_webrtc: ^0.8.5
|
||||||
dart_webrtc: ^1.0.3
|
|
||||||
device_info_plus: ^3.2.1
|
device_info_plus: ^3.2.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ import 'package:flutter_webrtc/flutter_webrtc.dart';
|
|||||||
|
|
||||||
class MockDataChannel extends RTCDataChannel {
|
class MockDataChannel extends RTCDataChannel {
|
||||||
final String? _label;
|
final String? _label;
|
||||||
|
final int _id;
|
||||||
RTCDataChannelState? _state = RTCDataChannelState.RTCDataChannelOpen;
|
RTCDataChannelState? _state = RTCDataChannelState.RTCDataChannelOpen;
|
||||||
|
|
||||||
MockDataChannel(this._label);
|
MockDataChannel(this._id, this._label);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String? get label => _label;
|
String? get label => _label;
|
||||||
@@ -20,4 +21,11 @@ class MockDataChannel extends RTCDataChannel {
|
|||||||
_state = RTCDataChannelState.RTCDataChannelClosing;
|
_state = RTCDataChannelState.RTCDataChannelClosing;
|
||||||
_state = RTCDataChannelState.RTCDataChannelClosed;
|
_state = RTCDataChannelState.RTCDataChannelClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement bufferedAmount
|
||||||
|
int? get bufferedAmount => throw UnimplementedError();
|
||||||
|
|
||||||
|
@override
|
||||||
|
int? get id => _id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class MockPeerConnection extends RTCPeerConnection {
|
|||||||
@override
|
@override
|
||||||
Future<RTCDataChannel> createDataChannel(
|
Future<RTCDataChannel> createDataChannel(
|
||||||
String label, RTCDataChannelInit dataChannelDict) async {
|
String label, RTCDataChannelInit dataChannelDict) async {
|
||||||
return MockDataChannel(label);
|
return MockDataChannel(dataChannelDict.id, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user