 	###
 		@param data {Object}
 			from {String}
+			ts {Integer}
+			description {String}
 	###
 	onRemoteOffer: (data) ->
 		if @active isnt true then return


		peerConnection = @getPeerConnection data.from

		needsRefresh = false
		if peerConnection.iceConnectionState isnt 'new'
			needsAudio = data.media.audio is true and peerConnection.remoteMedia.audio isnt true
			needsVideo = data.media.video is true and peerConnection.remoteMedia.video isnt true
			needsRefresh = needsAudio or needsVideo or data.media.desktop isnt peerConnection.remoteMedia.desktop

		if peerConnection.signalingState is "have-local-offer" or needsRefresh
			@stopPeerConnection data.from
			peerConnection = @getPeerConnection data.from


		@log 'onRemoteDescription', arguments
		peerConnection = @getPeerConnection data.from

		if data.type is 'offer'
			peerConnection.remoteMedia = data.media
			@onRemoteOffer
				from: data.from
				ts: data.ts
				description: data.description
		else
			peerConnection.setRemoteDescription new RTCSessionDescription(data.description)


WebRTC = new class
