@flashphoner/websdk 2.0.222 → 2.0.223

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13508,9 +13508,9 @@ const stripCodecs = function(sdp, codecs) {
13508
13508
  const getCurrentCodecAndSampleRate = function(sdp, mediaType) {
13509
13509
  var rows = sdp.split("\n");
13510
13510
  var codecPt;
13511
+ var ret = {};
13511
13512
  for (var i = 0; i < rows.length ; i++) {
13512
13513
  if (codecPt && rows[i].indexOf("a=rtpmap:" + codecPt) != -1) {
13513
- var ret = {};
13514
13514
  ret.name = rows[i].split(" ")[1].split("/")[0];
13515
13515
  ret.sampleRate = rows[i].split(" ")[1].split("/")[1];
13516
13516
  return ret;
@@ -13520,6 +13520,10 @@ const getCurrentCodecAndSampleRate = function(sdp, mediaType) {
13520
13520
  codecPt = rows[i].split(" ")[3].trim();
13521
13521
  }
13522
13522
  }
13523
+ // A workaround for empty sdp passed #WCS-3583
13524
+ ret.name = "undefined";
13525
+ ret.sampleRate = "undefined";
13526
+ return ret;
13523
13527
  };
13524
13528
 
13525
13529
 
@@ -13994,7 +13998,14 @@ var createConnection = function (options) {
13994
13998
  obj[mediaType] = {};
13995
13999
  //WCS-1922, currentRemoteDescription - browser compatibilitySection: Chrome 70, FF 57, Safari 11
13996
14000
  var description = connection.currentRemoteDescription != undefined ? connection.currentRemoteDescription : connection.remoteDescription;
13997
- var codec = util.getCurrentCodecAndSampleRate(description.sdp, mediaType);
14001
+ // SDP may be null in Safari 12.1 and older, prevent TypeError here #WCS-3583
14002
+ var sdp = "";
14003
+ if (description && description.sdp) {
14004
+ sdp = description.sdp;
14005
+ } else {
14006
+ logger.debug(LOG_PREFIX, "Can't parse current SDP to detect codec and sampleRate");
14007
+ }
14008
+ var codec = util.getCurrentCodecAndSampleRate(sdp, mediaType);
13998
14009
  obj[mediaType]["codec"] = codec.name;
13999
14010
  obj[mediaType]["codecRate"] = codec.sampleRate;
14000
14011
  Object.keys(report).forEach(function (key) {