Skip to content

Commit 903169a

Browse files
author
Mikael Wills
committed
Removed unnecessary video/audio toggles
1 parent b895a53 commit 903169a

File tree

2 files changed

+55
-11
lines changed

2 files changed

+55
-11
lines changed

example/ios/Podfile.lock

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- flutter_webrtc (0.12.2):
4+
- Flutter
5+
- WebRTC-SDK (= 125.6422.06)
6+
- path_provider_foundation (0.0.1):
7+
- Flutter
8+
- FlutterMacOS
9+
- permission_handler_apple (9.3.0):
10+
- Flutter
11+
- shared_preferences_foundation (0.0.1):
12+
- Flutter
13+
- FlutterMacOS
14+
- WebRTC-SDK (125.6422.06)
15+
16+
DEPENDENCIES:
17+
- Flutter (from `Flutter`)
18+
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
19+
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
20+
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
21+
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
22+
23+
SPEC REPOS:
24+
trunk:
25+
- WebRTC-SDK
26+
27+
EXTERNAL SOURCES:
28+
Flutter:
29+
:path: Flutter
30+
flutter_webrtc:
31+
:path: ".symlinks/plugins/flutter_webrtc/ios"
32+
path_provider_foundation:
33+
:path: ".symlinks/plugins/path_provider_foundation/darwin"
34+
permission_handler_apple:
35+
:path: ".symlinks/plugins/permission_handler_apple/ios"
36+
shared_preferences_foundation:
37+
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
38+
39+
SPEC CHECKSUMS:
40+
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
41+
flutter_webrtc: 1a53bd24f97bcfeff512f13699e721897f261563
42+
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
43+
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
44+
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
45+
WebRTC-SDK: 79942c006ea64f6fb48d7da8a4786dfc820bc1db
46+
47+
PODFILE CHECKSUM: a5dd15803c05a42a9ae1068254e24631f03bf853
48+
49+
COCOAPODS: 1.15.2

lib/src/rtc_session.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,10 @@ class RTCSession extends EventManager implements Owner {
997997
if (!_audioMuted && audio) {
998998
_audioMuted = true;
999999
changed = true;
1000-
_toggleMuteAudio(true);
10011000
}
1002-
10031001
if (!_videoMuted && video) {
10041002
_videoMuted = true;
10051003
changed = true;
1006-
_toggleMuteVideo(true);
10071004
}
10081005

10091006
if (changed) {
@@ -1177,7 +1174,7 @@ class RTCSession extends EventManager implements Owner {
11771174
options['mediaConstraints']?['mandatory']?['video'] != null) &&
11781175
rtcOfferConstraints?['offerToReceiveVideo'] == null;
11791176
} catch (e) {
1180-
print('Failed to determine upgrade to video: $e');
1177+
logger.w('Failed to determine upgrade to video: $e');
11811178
}
11821179

11831180
if (!_isReadyToReOffer()) {
@@ -1197,7 +1194,6 @@ class RTCSession extends EventManager implements Owner {
11971194
'reason_phrase': 'Media Renegotiation Failed'
11981195
});
11991196
});
1200-
12011197
_setLocalMediaStatus();
12021198

12031199
if (options['useUpdate'] != null) {
@@ -1644,6 +1640,7 @@ class RTCSession extends EventManager implements Owner {
16441640
});
16451641
} else if (state ==
16461642
RTCIceConnectionState.RTCIceConnectionStateDisconnected) {
1643+
if (_state == RtcSessionState.terminated) return;
16471644
_iceRestart();
16481645
}
16491646
};
@@ -1921,7 +1918,8 @@ class RTCSession extends EventManager implements Owner {
19211918
if (status_code < 300 || status_code >= 700) {
19221919
throw Exceptions.TypeError('Invalid status_code: $status_code');
19231920
}
1924-
print('Rejecting with status code: $status_code, reason: $reason_phrase');
1921+
logger.i(
1922+
'Rejecting with status code: $status_code, reason: $reason_phrase');
19251923
request.reply(status_code, reason_phrase, extraHeaders);
19261924
return true;
19271925
}
@@ -3136,20 +3134,16 @@ class RTCSession extends EventManager implements Owner {
31363134

31373135
void _setLocalMediaStatus() {
31383136
bool enableAudio = true, enableVideo = true;
3139-
31403137
if (_localHold || _remoteHold) {
31413138
enableAudio = false;
31423139
enableVideo = false;
31433140
}
3144-
31453141
if (_audioMuted) {
31463142
enableAudio = false;
31473143
}
3148-
31493144
if (_videoMuted) {
31503145
enableVideo = false;
31513146
}
3152-
31533147
_toggleMuteAudio(!enableAudio);
31543148
_toggleMuteVideo(!enableVideo);
31553149
}
@@ -3266,7 +3260,8 @@ class RTCSession extends EventManager implements Owner {
32663260
void _toggleMuteVideo(bool mute) {
32673261
if (_localMediaStream != null) {
32683262
if (_localMediaStream!.getVideoTracks().isEmpty) {
3269-
logger.w('Went to mute video but local stream has no video tracks');
3263+
logger.w(
3264+
'Went to toggle mute video but local stream has no video tracks');
32703265
}
32713266
for (MediaStreamTrack track in _localMediaStream!.getVideoTracks()) {
32723267
track.enabled = !mute;

0 commit comments

Comments
 (0)