teleportxr 1.0.86 → 1.0.87

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.
@@ -539,12 +539,34 @@ class WebRtcConnection extends EventEmitter
539
539
  return;
540
540
  }
541
541
  if (this._sceneAudioInterval) {
542
- this.options.clearTimeout(this._sceneAudioInterval); // not a timeout, but in case
542
+ clearInterval(this._sceneAudioInterval);
543
+ this._sceneAudioInterval = null;
543
544
  }
544
545
  // Drive a 10 ms tick. setInterval is sufficient: RTCAudioSource buffers
545
546
  // internally, and a few ms of jitter is absorbed by the WebRTC jitter buffer.
547
+ this._sceneAudioTickCount = 0;
546
548
  this._sceneAudioInterval = setInterval(() => {
547
- if (this._sceneAudioStreamer) this._sceneAudioStreamer.tick();
549
+ if (!this._sceneAudioStreamer) return;
550
+ this._sceneAudioStreamer.tick();
551
+ this._sceneAudioTickCount++;
552
+ // Every ~5 s, log tick count + outbound RTP stats so we can confirm
553
+ // libwebrtc is actually transmitting audio packets.
554
+ if ((this._sceneAudioTickCount % 500) === 0) {
555
+ const n = this._sceneAudioTickCount;
556
+ if (typeof this.peerConnection.getStats === 'function') {
557
+ Promise.resolve(this.peerConnection.getStats()).then((report) => {
558
+ let summary = 'no outbound-rtp/audio stats';
559
+ try {
560
+ const entries = (typeof report.values === 'function') ? Array.from(report.values()) : Object.values(report);
561
+ const outRtp = entries.find((s) => s && s.type === 'outbound-rtp' && (s.kind === 'audio' || s.mediaType === 'audio'));
562
+ if (outRtp) summary = 'packetsSent='+outRtp.packetsSent+' bytesSent='+outRtp.bytesSent;
563
+ } catch (e) { summary = 'stats parse error: '+e.message; }
564
+ console.log('SceneAudioStreamer tick #'+n+' — '+summary);
565
+ }).catch((e) => { console.log('SceneAudioStreamer tick #'+n+' — getStats failed: '+e.message); });
566
+ } else {
567
+ console.log('SceneAudioStreamer tick #'+n+' — getStats unavailable');
568
+ }
569
+ }
548
570
  }, sound.FRAME_MS);
549
571
  console.log('startSceneAudio: streaming '+loaded+' source(s) at '+sound.SAMPLE_RATE+' Hz mono');
550
572
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "name": "teleportxr",
18
18
  "description": "Teleport Spatial Server on node.js",
19
- "version": "1.0.86",
19
+ "version": "1.0.87",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/simul/teleport-nodejs.git"