Skip to content

Commit

Permalink
fix iOS cannot publish audio track correctly (#336)
Browse files Browse the repository at this point in the history
* experimental fix.

* update.
  • Loading branch information
cloudwebrtc authored Aug 14, 2023
1 parent d0005e0 commit 64234d9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 51 deletions.
11 changes: 6 additions & 5 deletions lib/src/core/engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
if (_subscriberPrimary) {
// make sure publisher transport is connected

if (publisher?.pc.connectionState?.isConnected() != true) {
if ((await publisher?.pc.getConnectionState())?.isConnected() != true) {
logger.fine('Publisher is not connected...');

// start negotiation
if (publisher?.pc.connectionState !=
if (await publisher?.pc.getConnectionState() !=
rtc.RTCPeerConnectionState.RTCPeerConnectionStateConnecting) {
await negotiate();
}
Expand Down Expand Up @@ -628,7 +628,8 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
));
}

final iceConnected = primary?.pc.connectionState?.isConnected() ?? false;
final iceConnected =
(await primary?.pc.getConnectionState())?.isConnected() ?? false;

logger.fine('resumeConnection: iceConnected: $iceConnected');

Expand Down Expand Up @@ -796,9 +797,9 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
logger.warning('[$objectId] subscriber is null');
return;
}

var signalingState = await subscriber!.pc.getSignalingState();
logger.fine('[$objectId] Received server offer(type: ${event.sd.type}, '
'${subscriber!.pc.signalingState})');
'$signalingState)');
logger.finer('sdp: ${event.sd.sdp}');

await subscriber!.setRemoteDescription(event.sd);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/core/transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Transport extends Disposable {
restartingIce = true;
}

if (pc.signalingState ==
if (await pc.getSignalingState() ==
rtc.RTCSignalingState.RTCSignalingStateHaveLocalOffer) {
// we're waiting for the peer to accept our offer, so we'll just wait
// the only exception to this is when ICE restart is needed
Expand Down
76 changes: 34 additions & 42 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ packages:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "8599ae9edca5ff96163fca3e36f8e481ea917d1e71cdad912c084b5579913f34"
sha256: "77a180d6938f78ca7d2382d2240eb626c0f6a735d0bfdce227d8ffb80f95c48b"
url: "https://pub.dev"
source: hosted
version: "4.0.1"
version: "4.0.2"
connectivity_plus_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -146,13 +146,13 @@ packages:
source: hosted
version: "2.3.2"
dart_webrtc:
dependency: "direct main"
dependency: transitive
description:
name: dart_webrtc
sha256: "3f581ea799829fabd6e0b99bd2210146e4d107c7b3ac8495af3510737a5c5c1a"
sha256: dfe42714abe3eb83eefec407c9da7f8e341a899aa1b8ac2484af298cdfeb74a3
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.1.2"
dbus:
dependency: transitive
description:
Expand All @@ -165,10 +165,10 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b"
sha256: "86add5ef97215562d2e090535b0a16f197902b10c369c558a100e74ea06e8659"
url: "https://pub.dev"
source: hosted
version: "9.0.2"
version: "9.0.3"
device_info_plus_platform_interface:
dependency: transitive
description:
Expand All @@ -189,18 +189,18 @@ packages:
dependency: transitive
description:
name: ffi
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
url: "https://pub.dev"
source: hosted
version: "2.0.2"
version: "2.1.0"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "7.0.0"
fixnum:
dependency: "direct main"
description:
Expand Down Expand Up @@ -236,10 +236,10 @@ packages:
dependency: "direct main"
description:
name: flutter_webrtc
sha256: f7e3ee080638db1793109a2ca4f1391413907057cbee46a7f9bd1dc2a636d1cd
sha256: b795e79c2c053b0559756450427c4ad4679707e50b8540b5d7921c92a3989bc9
url: "https://pub.dev"
source: hosted
version: "0.9.36"
version: "0.9.39"
flutter_window_close:
dependency: "direct main"
description:
Expand Down Expand Up @@ -372,50 +372,50 @@ packages:
dependency: transitive
description:
name: path_provider
sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2"
sha256: "909b84830485dbcd0308edf6f7368bc8fd76afa26a270420f34cabea2a6467a0"
url: "https://pub.dev"
source: hosted
version: "2.0.15"
version: "2.1.0"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8"
url: "https://pub.dev"
source: hosted
version: "2.0.27"
version: "2.1.0"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3"
sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5"
url: "https://pub.dev"
source: hosted
version: "2.2.3"
version: "2.3.0"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57
sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3
url: "https://pub.dev"
source: hosted
version: "2.1.11"
version: "2.2.0"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec"
sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84
url: "https://pub.dev"
source: hosted
version: "2.0.6"
version: "2.1.0"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96"
sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da
url: "https://pub.dev"
source: hosted
version: "2.1.7"
version: "2.2.0"
petitparser:
dependency: transitive
description:
Expand Down Expand Up @@ -444,18 +444,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc"
sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
version: "2.1.5"
protobuf:
dependency: "direct main"
description:
Expand Down Expand Up @@ -582,21 +574,21 @@ packages:
source: hosted
version: "1.1.0"
webrtc_interface:
dependency: "direct main"
dependency: transitive
description:
name: webrtc_interface
sha256: "0dd96f4d7fb6ba9895930644cebd3f1adb5179caa83cb1760061b2fe9cba5aad"
sha256: faec2b578f7cd588766843a8c59d4a0137c44de10b83341ce7bec05e104614d7
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
win32:
dependency: transitive
description:
name: win32
sha256: dfdf0136e0aa7a1b474ea133e67cb0154a0acd2599c4f3ada3b49d38d38793ee
sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0
url: "https://pub.dev"
source: hosted
version: "5.0.5"
version: "5.0.6"
win32_registry:
dependency: transitive
description:
Expand All @@ -609,10 +601,10 @@ packages:
dependency: transitive
description:
name: xdg_directories
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
sha256: f0c26453a2d47aa4c2570c6a033246a3fc62da2fe23c7ffdd0a7495086dc0247
url: "https://pub.dev"
source: hosted
version: "1.0.0"
version: "1.0.2"
xml:
dependency: transitive
description:
Expand Down
4 changes: 1 addition & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ dependencies:
uuid: ^3.0.6
synchronized: ^3.0.0+3
protobuf: ^3.0.0
flutter_webrtc: 0.9.37
flutter_webrtc: 0.9.39
flutter_window_close: ^0.2.2
device_info_plus: ^9.0.0
webrtc_interface: 1.1.0
dart_webrtc: 1.1.1
js: ^0.6.4
platform_detect: ^2.0.7
js_bindings: ^0.1.2+1
Expand Down

0 comments on commit 64234d9

Please sign in to comment.