ring: adts headers, session cleanup

This commit is contained in:
Koushik Dutta
2022-01-18 09:34:30 -08:00
parent 8654fcba1d
commit ee76e76e53
5 changed files with 13 additions and 4 deletions

3
.gitmodules vendored
View File

@@ -25,3 +25,6 @@
[submodule "external/scrypted-private"]
path = external/private
url = ../../koush/scrypted-private
[submodule "external/ring-client-api"]
path = external/ring-client-api
url = https://github.com/dgreif/ring.git

1
external/ring-client-api vendored Submodule

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/ring",
"version": "0.0.5",
"version": "0.0.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/ring",
"version": "0.0.5",
"version": "0.0.7",
"dependencies": {
"@homebridge/camera-utils": "^2.0.4",
"@types/node": "^16.6.1",

View File

@@ -36,5 +36,5 @@
"devDependencies": {
"@scrypted/sdk": "file:../../sdk"
},
"version": "0.0.5"
"version": "0.0.7"
}

View File

@@ -42,6 +42,8 @@ class RingCameraDevice extends ScryptedDeviceBase implements Intercom, Camera, V
})
this.rtpDescription = await sip.start({
output: [
'-bsf:a', 'aac_adtstoasc',
'-flags', '+global_header',
'-f', 'mpegts',
`tcp://127.0.0.1:${port}`,
],
@@ -55,7 +57,10 @@ class RingCameraDevice extends ScryptedDeviceBase implements Intercom, Camera, V
// this is from the consumer
const passthrough = await listenZeroSingleClient();
passthrough.clientPromise.then(pt => client.pipe(pt));
passthrough.clientPromise.then(pt => {
client.on('close', () => sip.stop());
client.pipe(pt);
});
this.console.log(`sip output port: ${port}, consumer input port ${passthrough.port}`);