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
|
||||
|
||||
COCOAPODS: 1.11.2
|
||||
COCOAPODS: 1.11.3
|
||||
|
||||
@@ -56,7 +56,7 @@ packages:
|
||||
name: dart_webrtc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
device_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -176,7 +176,7 @@ packages:
|
||||
name: flutter_webrtc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.3"
|
||||
version: "0.8.5"
|
||||
google_fonts:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -510,7 +510,7 @@ packages:
|
||||
name: webrtc_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+17
-10
@@ -529,6 +529,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
||||
answer: answer,
|
||||
subscription: subscription,
|
||||
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) {
|
||||
if (_connectionState == newValue) return;
|
||||
|
||||
@@ -664,13 +674,10 @@ 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;
|
||||
extension EngineInternalMethods on Engine {
|
||||
@internal
|
||||
List<lk_rtc.DataChannelInfo> dataChannelInfo() => [
|
||||
_reliableDCPub,
|
||||
_lossyDCPub
|
||||
].whereNotNull().map((e) => e.toLKInfoType()).toList();
|
||||
}
|
||||
|
||||
@@ -352,12 +352,14 @@ extension SignalClientRequests on SignalClient {
|
||||
required lk_rtc.SessionDescription? answer,
|
||||
required lk_rtc.UpdateSubscription subscription,
|
||||
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
|
||||
required Iterable<lk_rtc.DataChannelInfo>? dataChannelInfo,
|
||||
}) =>
|
||||
_sendRequest(lk_rtc.SignalRequest(
|
||||
syncState: lk_rtc.SyncState(
|
||||
answer: answer,
|
||||
subscription: subscription,
|
||||
publishTracks: publishTracks,
|
||||
dataChannels: dataChannelInfo,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
@@ -53,6 +53,13 @@ extension ReliabilityExt on Reliability {
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
extension RTCDataChannelExt on rtc.RTCDataChannel {
|
||||
lk_rtc.DataChannelInfo toLKInfoType() => lk_rtc.DataChannelInfo(
|
||||
id: id,
|
||||
label: label,
|
||||
);
|
||||
}
|
||||
|
||||
extension RTCIceCandidateExt on rtc.RTCIceCandidate {
|
||||
static rtc.RTCIceCandidate fromJson(String jsonString) {
|
||||
final map = json.decode(jsonString) as Map<String, dynamic>;
|
||||
|
||||
+4
-4
@@ -114,12 +114,12 @@ packages:
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
dart_webrtc:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_webrtc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
device_info_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -218,7 +218,7 @@ packages:
|
||||
name: flutter_webrtc
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.3"
|
||||
version: "0.8.5"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -496,7 +496,7 @@ packages:
|
||||
name: webrtc_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+1
-2
@@ -22,8 +22,7 @@ dependencies:
|
||||
uuid: ^3.0.4
|
||||
synchronized: ^3.0.0
|
||||
protobuf: ^2.0.1
|
||||
flutter_webrtc: ^0.8.3
|
||||
dart_webrtc: ^1.0.3
|
||||
flutter_webrtc: ^0.8.5
|
||||
device_info_plus: ^3.2.1
|
||||
|
||||
dev_dependencies:
|
||||
|
||||
@@ -2,9 +2,10 @@ import 'package:flutter_webrtc/flutter_webrtc.dart';
|
||||
|
||||
class MockDataChannel extends RTCDataChannel {
|
||||
final String? _label;
|
||||
final int _id;
|
||||
RTCDataChannelState? _state = RTCDataChannelState.RTCDataChannelOpen;
|
||||
|
||||
MockDataChannel(this._label);
|
||||
MockDataChannel(this._id, this._label);
|
||||
|
||||
@override
|
||||
String? get label => _label;
|
||||
@@ -20,4 +21,11 @@ class MockDataChannel extends RTCDataChannel {
|
||||
_state = RTCDataChannelState.RTCDataChannelClosing;
|
||||
_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
|
||||
Future<RTCDataChannel> createDataChannel(
|
||||
String label, RTCDataChannelInit dataChannelDict) async {
|
||||
return MockDataChannel(label);
|
||||
return MockDataChannel(dataChannelDict.id, label);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user