<commit_before>/*
 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
'use strict';

function Call(config) {
  this.pc1 = new RTCPeerConnection(config);
  this.pc2 = new RTCPeerConnection(config);

  this.pc1.addEventListener('icecandidate', this.onIceCandidate_.bind(this, this.pc2));
  this.pc2.addEventListener('icecandidate', this.onIceCandidate_.bind(this, this.pc1));

  this.iceCandidateFilter_ = Call.noFilter;
}

Call.prototype = {
  establishConnection: function () {
    this.pc1.createOffer(this.gotOffer_.bind(this));
  },

  close: function () {
    this.pc1.close();
    this.pc2.close();
  },

  setIceCandidateFilter: function (filter) {
    this.iceCandidateFilter_ = filter;
  },

  // Constraint max video bitrate by modifying the SDP when creating an answer.
  constrainVideoBitrate: function (maxVideoBitrateKbps) {
    this.constrainVideoBitrateKbps_ = maxVideoBitrateKbps;
  },

  // Remove video FEC if available on the offer.
  disableVideoFec: function () {
    this.constrainOfferToRemoveVideoFec_ = true;
  },

  // When the peerConnection is closed the callback is called once returning
  // with an array of gathered stats.
  gatherStats: function(peerConnection, callback, interval) {
    var stats = [];
    getStats_();

    function getStats_() {
      if (peerConnection.signalingState === 'closed') {
        callback(stats);
        return;
      }<commit_msg>Logging peer connection config for loopback calls.<commit_after>/*
 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
'use strict';

function Call(config) {
  this.traceEvent = report.traceEventAsync('call');
  this.traceEvent({ config : config });

  this.pc1 = new RTCPeerConnection(config);
  this.pc2 = new RTCPeerConnection(config);

  this.pc1.addEventListener('icecandidate', this.onIceCandidate_.bind(this, this.pc2));
  this.pc2.addEventListener('icecandidate', this.onIceCandidate_.bind(this, this.pc1));

  this.iceCandidateFilter_ = Call.noFilter;
}

Call.prototype = {
  establishConnection: function () {
    this.traceEvent({ state: 'start' });
    this.pc1.createOffer(this.gotOffer_.bind(this));
  },

  close: function () {
    this.traceEvent({ state: 'end' });
    this.pc1.close();
    this.pc2.close();
  },

  setIceCandidateFilter: function (filter) {
    this.iceCandidateFilter_ = filter;
  },

  // Constraint max video bitrate by modifying the SDP when creating an answer.
  constrainVideoBitrate: function (maxVideoBitrateKbps) {
    this.constrainVideoBitrateKbps_ = maxVideoBitrateKbps;
  },

  // Remove video FEC if available on the offer.
  disableVideoFec: function () {
    this.constrainOfferToRemoveVideoFec_ = true;
  },

  // When the peerConnection is closed the callback is called once returning
  // with an array of gathered stats.
  gatherStats: function(peerConnection, callback, interval) {
    var stats = [];
    getStats_();

    function getStats_() {
      if (peerConnection.signalingState === 'closed') {
        callback(stats);
        return;
      }
{'fraction_non_alphanumeric': 0.11131059245960502, 'fraction_numerical': 0.007779772591262717, 'mean_word_length': 3.6952247191011236, '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': '5272856', 'n_tokens_mistral': 1056, 'n_tokens_neox': 1007, 'n_words': 273}