<commit_before>var RTCPeerConnection = null;

function WebRTC() {

	this.webrtcDetectedBrowser = null;
	this.currentPeerConnectionsMap = {};
	this.signalService = null;
	this.localMediaStream = null;
	this.debug = true;

	this.pc_config = {
		"iceServers" : [ {
			"url" : "stun:stun.l.google.com:19302"
		} ]
	};// provisional, can we get a stun server?

	this.init = function(signalService) {
		// First of all we try to detect which navigator is trying to use the
		// videoconference from getUserMedia diferences
		if (navigator.getUserMedia) {
			this.webrtcDetectedBrowser = "webrtcenabled";
		}else if (navigator.mozGetUserMedia) {
			this.webrtcDetectedBrowser = "firefox";
			navigator.getUserMedia = navigator.mozGetUserMedia;
			RTCPeerConnection = mozRTCPeerConnection;
			RTCSessionDescription = mozRTCSessionDescription;
			RTCIceCandidate = mozRTCIceCandidate;
			
			MediaStream.prototype.getVideoTracks = function() {
				return [];
			};

			MediaStream.prototype.getAudioTracks = function() {
				return [];
			};
			
			
		} else if (navigator.webkitGetUserMedia) {
			this.webrtcDetectedBrowser = "chrome";
			navigator.getUserMedia = navigator.webkitGetUserMedia;
			RTCPeerConnection = webkitRTCPeerConnection;
			
		    if (!webkitRTCPeerConnection.prototype.getLocalStreams) {
		        webkitRTCPeerConnection.prototype.getLocalStreams = function() {
		            return this.localStreams;
		        };
		        webkitRTCPeerConnection.prototype.getRemoteStreams = function() {
		            return this.remoteStreams;
		        };
		    }
		} else {
			this.webrtcDetectedBrowser = "none";
		}

		this.signalService = signalService; // Use the signal service provided
		var webRTCClass = this;

		this.signalService.onReceive = function(userid, message, videoAgentType) {
			webRTCClass.onReceive(userid, message, videoAgentType); // Called
			// custom
			// method
			// when
		}
		jQuery
		.ajax({
			url : '/direct/portal-chat/' + portal.user.id + '/servers.json',
			dataType : "json",
			cache : false,
			success : function(data, status) {
				this.pc_config = data.data;
			}
		});
		
	}

	/* Call this process to start a video call */
	this.doCall = function(userid, videoAgentType, started, success, fail) {
		var callConnection = this.currentPeerConnectionsMap[userid];

		if (callConnection == null) {
			callConnection = this.setupPeerConnection(userid, videoAgentType,
					success, fail);
			callConnection.isCaller = true;
<commit_msg>Change this reference. SAK-23349<commit_after>var RTCPeerConnection = null;

function WebRTC() {

	this.webrtcDetectedBrowser = null;
	this.currentPeerConnectionsMap = {};
	this.signalService = null;
	this.localMediaStream = null;
	this.debug = true;

	this.pc_config = {
		"iceServers" : [ {
			"url" : "stun:stun.l.google.com:19302"
		} ]
	};// provisional, can we get a stun server?

	this.init = function(signalService) {
		// First of all we try to detect which navigator is trying to use the
		// videoconference from getUserMedia diferences
		if (navigator.getUserMedia) {
			this.webrtcDetectedBrowser = "webrtcenabled";
		}else if (navigator.mozGetUserMedia) {
			this.webrtcDetectedBrowser = "firefox";
			navigator.getUserMedia = navigator.mozGetUserMedia;
			RTCPeerConnection = mozRTCPeerConnection;
			RTCSessionDescription = mozRTCSessionDescription;
			RTCIceCandidate = mozRTCIceCandidate;
			
			MediaStream.prototype.getVideoTracks = function() {
				return [];
			};

			MediaStream.prototype.getAudioTracks = function() {
				return [];
			};
			
			
		} else if (navigator.webkitGetUserMedia) {
			this.webrtcDetectedBrowser = "chrome";
			navigator.getUserMedia = navigator.webkitGetUserMedia;
			RTCPeerConnection = webkitRTCPeerConnection;
			
		    if (!webkitRTCPeerConnection.prototype.getLocalStreams) {
		        webkitRTCPeerConnection.prototype.getLocalStreams = function() {
		            return this.localStreams;
		        };
		        webkitRTCPeerConnection.prototype.getRemoteStreams = function() {
		            return this.remoteStreams;
		        };
		    }
		} else {
			this.webrtcDetectedBrowser = "none";
		}

		this.signalService = signalService; // Use the signal service provided
		var webRTCClass = this;

		this.signalService.onReceive = function(userid, message, videoAgentType) {
			webRTCClass.onReceive(userid, message, videoAgentType); // Called
			// custom
			// method
			// when
		}
		jQuery
		.ajax({
			url : '/direct/portal-chat/' + portal.user.id + '/servers.json',
			dataType : "json",
			cache : false,
			success : function(data, status) {
				webRTCClass.pc_config = data.data;
			}
		});
		
	}

	/* Call this process to start a video call */
	this.doCall = function(userid, videoAgentType, started, success, fail) {
		var callConnection = this.currentPeerConnectionsMap[userid];

		if (callConnection == null) {
			callConnection = this.setupPeerConnection(userid, videoAgentType,
					success, fail);
			callConnection.isCaller = true;

{'fraction_non_alphanumeric': 0.1066987565182511, 'fraction_numerical': 0.0030084235860409147, 'mean_word_length': 3.4526785714285713, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '937174', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1544, 'n_words': 309}