From 8b88f9cb34ebd185e8a777cbdd9c0a3a26d35be3 Mon Sep 17 00:00:00 2001 From: CloudWebRTC Date: Wed, 7 Sep 2022 15:15:23 +0800 Subject: [PATCH] Expose dataChannel for e2e testing. (#161) --- example/pubspec.lock | 6 +++--- lib/src/core/engine.dart | 9 +++++++++ pubspec.lock | 6 +++--- pubspec.yaml | 6 +++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 1ba9ac7..bd98477 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -105,7 +105,7 @@ packages: name: dart_webrtc url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "1.0.8" dbus: dependency: transitive description: @@ -232,7 +232,7 @@ packages: name: flutter_webrtc url: "https://pub.dartlang.org" source: hosted - version: "0.9.4" + version: "0.9.6" google_fonts: dependency: "direct main" description: @@ -573,7 +573,7 @@ packages: name: webrtc_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "1.0.8" win32: dependency: transitive description: diff --git a/lib/src/core/engine.dart b/lib/src/core/engine.dart index 4961eb5..f5a1169 100644 --- a/lib/src/core/engine.dart +++ b/lib/src/core/engine.dart @@ -43,6 +43,10 @@ class Engine extends Disposable with EventsEmittable { @internal Transport? get primary => _subscriberPrimary ? subscriber : publisher; + rtc.RTCDataChannel? get dataChannel => _subscriberPrimary + ? _reliableDCSub ?? _lossyDCSub + : _reliableDCPub ?? _lossyDCPub; + // data channels for packets rtc.RTCDataChannel? _reliableDCPub; rtc.RTCDataChannel? _lossyDCPub; @@ -110,6 +114,11 @@ class Engine extends Disposable with EventsEmittable { this.roomOptions = roomOptions ?? this.roomOptions; this.fastConnectOptions = fastConnectOptions; + if (connectionState == ConnectionState.connected) { + logger.fine('already connected'); + return; + } + _updateConnectionState(ConnectionState.connecting); try { diff --git a/pubspec.lock b/pubspec.lock index c74d1a1..bf5605d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -161,7 +161,7 @@ packages: name: dart_webrtc url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "1.0.8" dbus: dependency: transitive description: @@ -267,7 +267,7 @@ packages: name: flutter_webrtc url: "https://pub.dartlang.org" source: hosted - version: "0.9.4" + version: "0.9.6" glob: dependency: transitive description: @@ -559,7 +559,7 @@ packages: name: webrtc_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.7" + version: "1.0.8" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a0a5301..61a92e0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,10 +23,10 @@ dependencies: uuid: ^3.0.6 synchronized: ^3.0.0 protobuf: ^2.0.1 - flutter_webrtc: 0.9.4 - dart_webrtc: 1.0.7 + flutter_webrtc: 0.9.6 + dart_webrtc: 1.0.8 device_info_plus: ^3.2.3 - webrtc_interface: 1.0.7 + webrtc_interface: 1.0.8 dev_dependencies: flutter_test: