Skip to content

Commit 4508d22

Browse files
authored
Merge branch 'master' into desktop
2 parents 5c4b76a + 3d790db commit 4508d22

File tree

5 files changed

+62
-28
lines changed

5 files changed

+62
-28
lines changed

.github/workflows/flutter.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Flutter CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- master
8+
- action_test
9+
10+
jobs:
11+
test:
12+
name: Test on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
# os: [ubuntu-latest, windows-latest, macos-latest]
18+
steps:
19+
- uses: actions/checkout@v1
20+
- uses: actions/setup-java@v1
21+
with:
22+
java-version: '12.x'
23+
- uses: subosito/flutter-action@v1
24+
with:
25+
flutter-version: '1.7.8+hotfix.4'
26+
channel: 'stable'
27+
- run: flutter packages get
28+
- run: flutter test
29+
- run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
30+
31+
# - run: curl

ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ target 'Runner' do
5454
}
5555
end
5656

57+
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
58+
install! 'cocoapods', :disable_input_output_paths => true
59+
5760
post_install do |installer|
5861
installer.pods_project.targets.each do |target|
5962
target.build_configurations.each do |config|

lib/src/call_sample/signaling.dart

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ enum SignalingState {
2222
typedef void SignalingStateCallback(SignalingState state);
2323
typedef void StreamStateCallback(MediaStream stream);
2424
typedef void OtherEventCallback(dynamic event);
25-
typedef void DataChannelMessageCallback(RTCDataChannel dc, RTCDataChannelMessage data);
25+
typedef void DataChannelMessageCallback(
26+
RTCDataChannel dc, RTCDataChannelMessage data);
2627
typedef void DataChannelCallback(RTCDataChannel dc);
2728

2829
class Signaling {
@@ -34,6 +35,8 @@ class Signaling {
3435
var _displayName;
3536
var _peerConnections = new Map<String, RTCPeerConnection>();
3637
var _dataChannels = new Map<String, RTCDataChannel>();
38+
var _remoteCandidates = [];
39+
3740
MediaStream _localStream;
3841
List<MediaStream> _remoteStreams;
3942
SignalingStateCallback onStateChange;
@@ -152,12 +155,17 @@ class Signaling {
152155
this.onStateChange(SignalingState.CallStateNew);
153156
}
154157

155-
_createPeerConnection(id, media, false).then((pc) {
156-
_peerConnections[id] = pc;
157-
pc.setRemoteDescription(new RTCSessionDescription(
158-
description['sdp'], description['type']));
159-
_createAnswer(id, pc, media);
160-
});
158+
var pc = await _createPeerConnection(id, media, false);
159+
_peerConnections[id] = pc;
160+
await pc.setRemoteDescription(new RTCSessionDescription(
161+
description['sdp'], description['type']));
162+
await _createAnswer(id, pc, media);
163+
if (this._remoteCandidates.length > 0) {
164+
_remoteCandidates.forEach((candidate) async {
165+
await pc.addCandidate(candidate);
166+
});
167+
_remoteCandidates.clear();
168+
}
161169
}
162170
break;
163171
case 'answer':
@@ -167,7 +175,7 @@ class Signaling {
167175

168176
var pc = _peerConnections[id];
169177
if (pc != null) {
170-
pc.setRemoteDescription(new RTCSessionDescription(
178+
await pc.setRemoteDescription(new RTCSessionDescription(
171179
description['sdp'], description['type']));
172180
}
173181
}
@@ -177,13 +185,14 @@ class Signaling {
177185
var id = data['from'];
178186
var candidateMap = data['candidate'];
179187
var pc = _peerConnections[id];
180-
188+
RTCIceCandidate candidate = new RTCIceCandidate(
189+
candidateMap['candidate'],
190+
candidateMap['sdpMid'],
191+
candidateMap['sdpMLineIndex']);
181192
if (pc != null) {
182-
RTCIceCandidate candidate = new RTCIceCandidate(
183-
candidateMap['candidate'],
184-
candidateMap['sdpMid'],
185-
candidateMap['sdpMLineIndex']);
186-
pc.addCandidate(candidate);
193+
await pc.addCandidate(candidate);
194+
} else {
195+
_remoteCandidates.add(candidate);
187196
}
188197
}
189198
break;
@@ -278,7 +287,7 @@ class Signaling {
278287
);
279288

280289
return webSocket;
281-
}catch(e){
290+
} catch (e) {
282291
throw e;
283292
}
284293
}

pubspec.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ dependencies:
2020
# Use with the CupertinoIcons class for iOS style icons.
2121
cupertino_icons: ^0.1.2
2222
flutter_webrtc:
23-
path: ../flutter-webrtc
23+
git:
24+
url: https://github.com/cloudwebrtc/flutter-webrtc.git
25+
2426
# Plugins from flutter/plugins, with local desktop implementations.
2527
shared_preferences: 0.5.2
2628
shared_preferences_fde:
@@ -35,6 +37,7 @@ dependencies:
3537
url: https://github.com/google/flutter-desktop-embedding.git
3638
path: plugins/flutter_plugins/path_provider_fde
3739

40+
3841
dev_dependencies:
3942
flutter_test:
4043
sdk: flutter

test/widget_test.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,5 @@ void main() {
1313
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
1414
// Build our app and trigger a frame.
1515
await tester.pumpWidget(new MyApp());
16-
17-
// Verify that our counter starts at 0.
18-
expect(find.text('0'), findsOneWidget);
19-
expect(find.text('1'), findsNothing);
20-
21-
// Tap the '+' icon and trigger a frame.
22-
await tester.tap(find.byIcon(Icons.add));
23-
await tester.pump();
24-
25-
// Verify that our counter has incremented.
26-
expect(find.text('0'), findsNothing);
27-
expect(find.text('1'), findsOneWidget);
2816
});
2917
}

0 commit comments

Comments
 (0)