From 2841fa01d147fcf1dc7f29334e99857b60ba09c0 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 4 Sep 2022 13:16:26 -0500 Subject: [PATCH] tuya: fix crlf in candidate, fix empty stream name in rebroadcast, webrtc logging --- plugins/prebuffer-mixin/package-lock.json | 3 +-- plugins/prebuffer-mixin/src/main.ts | 4 ++-- plugins/prebuffer-mixin/src/stream-settings.ts | 2 +- plugins/tuya/src/camera.ts | 2 +- plugins/webrtc/src/wrtc-to-rtsp.ts | 3 +++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index 684426998..2b936ad0f 100644 --- a/plugins/prebuffer-mixin/package-lock.json +++ b/plugins/prebuffer-mixin/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "@scrypted/prebuffer-mixin", "version": "0.9.34", - "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", @@ -35,7 +34,7 @@ }, "../../sdk": { "name": "@scrypted/sdk", - "version": "0.0.199", + "version": "0.0.206", "license": "ISC", "dependencies": { "@babel/preset-typescript": "^7.16.7", diff --git a/plugins/prebuffer-mixin/src/main.ts b/plugins/prebuffer-mixin/src/main.ts index ddbe07838..94dd63eab 100644 --- a/plugins/prebuffer-mixin/src/main.ts +++ b/plugins/prebuffer-mixin/src/main.ts @@ -194,7 +194,7 @@ class PrebufferSession { } get streamName() { - return this.advertisedMediaStreamOptions.name; + return this.advertisedMediaStreamOptions.name || `Stream ${this.streamId}`; } clearPrebuffers() { @@ -301,7 +301,7 @@ class PrebufferSession { const elapsed = Date.now() - start; const bitrate = Math.round(total / elapsed * 8); - const group = this.streamName ? `Stream: ${this.streamName}` : 'Stream'; + const group = `Stream: ${this.streamName}`; settings.push( { diff --git a/plugins/prebuffer-mixin/src/stream-settings.ts b/plugins/prebuffer-mixin/src/stream-settings.ts index 6a9d2965f..7e7010a32 100644 --- a/plugins/prebuffer-mixin/src/stream-settings.ts +++ b/plugins/prebuffer-mixin/src/stream-settings.ts @@ -204,7 +204,7 @@ export function createStreamSettings(device: MixinDeviceBase) { enabledStreams = { defaultValue: getDefaultPrebufferedStreams(msos)?.map(mso => mso.name), - choices: msos.map(mso => mso.name), + choices: msos.map((mso, index) => mso.name || `Stream ${index}`), hide: false, }; diff --git a/plugins/tuya/src/camera.ts b/plugins/tuya/src/camera.ts index b88752004..a1160aa5c 100644 --- a/plugins/tuya/src/camera.ts +++ b/plugins/tuya/src/camera.ts @@ -129,7 +129,7 @@ class TuyaRTCSignalingSesion implements RTCSignalingSession { } sendIceCandidate({ - candidate: candidate.candidate, + candidate: candidate.candidate.trim(), sdpMid: '0', sdpMLineIndex: 0 }); diff --git a/plugins/webrtc/src/wrtc-to-rtsp.ts b/plugins/webrtc/src/wrtc-to-rtsp.ts index 5fe173899..a59f9707b 100644 --- a/plugins/webrtc/src/wrtc-to-rtsp.ts +++ b/plugins/webrtc/src/wrtc-to-rtsp.ts @@ -80,6 +80,9 @@ export async function createRTCPeerConnectionSource(options: { pc.iceConnectionStateChange.subscribe(() => { console.log('iceConnectionState', pc.iceConnectionState); }); + pc.connectionStateChange.subscribe(() => { + console.log('connectionState', pc.connectionState); + }); audioTransceiver = pc.addTransceiver("audio", setup.audio as any); audioTransceiver.mid = '0'; audioTransceiver.onTrack.subscribe((track) => {