|  |  | @ -91,7 +91,8 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * Fired whenever the local or remote video track become active or inactive. |  |  |  |      * Fired whenever the local or remote video track become active or inactive. | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     func didUpdateVideoTracks(localVideoTrack: RTCVideoTrack?, |  |  |  |     func didUpdateVideoTracks(call: SignalCall?, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                               localVideoTrack: RTCVideoTrack?, | 
			
		
	
		
		
			
				
					
					|  |  |  |                               remoteVideoTrack: RTCVideoTrack?) |  |  |  |                               remoteVideoTrack: RTCVideoTrack?) | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -896,13 +897,6 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |     func setIsMuted(isMuted: Bool) { |  |  |  |     func setIsMuted(isMuted: Bool) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         AssertIsOnMainThread() |  |  |  |         AssertIsOnMainThread() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         guard let peerConnectionClient = self.peerConnectionClient else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             // This should never happen; return to a known good state. |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             assertionFailure("\(TAG) peerConnectionClient was unexpectedly nil in \(#function)") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             handleFailedCurrentCall(error: .assertionError(description:"\(TAG) peerConnectionClient unexpectedly nil in \(#function)")) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             return |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         guard let call = self.call else { |  |  |  |         guard let call = self.call else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             // This should never happen; return to a known good state. |  |  |  |             // This should never happen; return to a known good state. | 
			
		
	
		
		
			
				
					
					|  |  |  |             assertionFailure("\(TAG) call was unexpectedly nil in \(#function)") |  |  |  |             assertionFailure("\(TAG) call was unexpectedly nil in \(#function)") | 
			
		
	
	
		
		
			
				
					|  |  | @ -911,6 +905,12 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         call.isMuted = isMuted |  |  |  |         call.isMuted = isMuted | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         guard let peerConnectionClient = self.peerConnectionClient else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // The peer connection might not be created yet. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         peerConnectionClient.setAudioEnabled(enabled: !isMuted) |  |  |  |         peerConnectionClient.setAudioEnabled(enabled: !isMuted) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -952,13 +952,6 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return |  |  |  |             return | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         guard let peerConnectionClient = self.peerConnectionClient else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             // This should never happen; return to a known good state. |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             assertionFailure("\(TAG) peerConnectionClient was unexpectedly nil in \(#function)") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             handleFailedCurrentCall(error: .assertionError(description:"\(TAG) peerConnectionClient unexpectedly nil in \(#function)")) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             return |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         guard let call = self.call else { |  |  |  |         guard let call = self.call else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             // This should never happen; return to a known good state. |  |  |  |             // This should never happen; return to a known good state. | 
			
		
	
		
		
			
				
					
					|  |  |  |             assertionFailure("\(TAG) call was unexpectedly nil in \(#function)") |  |  |  |             assertionFailure("\(TAG) call was unexpectedly nil in \(#function)") | 
			
		
	
	
		
		
			
				
					|  |  | @ -967,6 +960,12 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         call.hasLocalVideo = hasLocalVideo |  |  |  |         call.hasLocalVideo = hasLocalVideo | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         guard let peerConnectionClient = self.peerConnectionClient else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // The peer connection might not be created yet. | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         peerConnectionClient.setLocalVideoEnabled(enabled: shouldHaveLocalVideoTrack()) |  |  |  |         peerConnectionClient.setLocalVideoEnabled(enabled: shouldHaveLocalVideoTrack()) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -1288,9 +1287,11 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |         observers.append(Weak(value: observer)) |  |  |  |         observers.append(Weak(value: observer)) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Synchronize observer with current call state |  |  |  |         // Synchronize observer with current call state | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let call = self.call | 
			
		
	
		
		
			
				
					
					|  |  |  |         let localVideoTrack = self.localVideoTrack |  |  |  |         let localVideoTrack = self.localVideoTrack | 
			
		
	
		
		
			
				
					
					|  |  |  |         let remoteVideoTrack = self.isRemoteVideoEnabled ? self.remoteVideoTrack : nil |  |  |  |         let remoteVideoTrack = self.isRemoteVideoEnabled ? self.remoteVideoTrack : nil | 
			
		
	
		
		
			
				
					
					|  |  |  |         observer.didUpdateVideoTracks(localVideoTrack:localVideoTrack, |  |  |  |         observer.didUpdateVideoTracks(call:call, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                       localVideoTrack:localVideoTrack, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                       remoteVideoTrack:remoteVideoTrack) |  |  |  |                                       remoteVideoTrack:remoteVideoTrack) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -1313,11 +1314,13 @@ protocol CallServiceObserver: class { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private func fireDidUpdateVideoTracks() { |  |  |  |     private func fireDidUpdateVideoTracks() { | 
			
		
	
		
		
			
				
					
					|  |  |  |         AssertIsOnMainThread() |  |  |  |         AssertIsOnMainThread() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let call = self.call | 
			
		
	
		
		
			
				
					
					|  |  |  |         let localVideoTrack = self.localVideoTrack |  |  |  |         let localVideoTrack = self.localVideoTrack | 
			
		
	
		
		
			
				
					
					|  |  |  |         let remoteVideoTrack = self.isRemoteVideoEnabled ? self.remoteVideoTrack : nil |  |  |  |         let remoteVideoTrack = self.isRemoteVideoEnabled ? self.remoteVideoTrack : nil | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         for observer in observers { |  |  |  |         for observer in observers { | 
			
		
	
		
		
			
				
					
					|  |  |  |             observer.value?.didUpdateVideoTracks(localVideoTrack:localVideoTrack, |  |  |  |             observer.value?.didUpdateVideoTracks(call:call, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                                  localVideoTrack:localVideoTrack, | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                  remoteVideoTrack:remoteVideoTrack) |  |  |  |                                                  remoteVideoTrack:remoteVideoTrack) | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |