Skip to content

Commit

Permalink
0.0.11 - kick off audio and video streams sooner without waiting for …
Browse files Browse the repository at this point in the history
…the SIP call to be established
  • Loading branch information
Marc Vanbrabant committed Aug 25, 2023
1 parent a24d986 commit bfc6298
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions plugins/bticino/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/bticino/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/bticino",
"version": "0.0.10",
"version": "0.0.11",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",
"prescrypted-setup-project": "scrypted-package-json",
Expand Down
14 changes: 10 additions & 4 deletions plugins/bticino/src/bticino-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const { mediaManager } = sdk;
export class BticinoSipCamera extends ScryptedDeviceBase implements DeviceProvider, Intercom, Camera, VideoCamera, Settings, BinarySensor, HttpRequestHandler, VideoClips, Reboot {

private session: SipCallSession
private remoteRtpDescription: RtpDescription
private remoteRtpDescription: Promise<RtpDescription>
private audioOutForwarder: dgram.Socket
private audioOutProcess: ChildProcess
private currentMedia: FFmpegInput | MediaStreamUrl
Expand Down Expand Up @@ -158,9 +158,10 @@ export class BticinoSipCamera extends ScryptedDeviceBase implements DeviceProvid

const audioOutForwarder = await createBindZero()
this.audioOutForwarder = audioOutForwarder.server
let address = (await this.remoteRtpDescription).address
audioOutForwarder.server.on('message', message => {
if( this.session )
this.session.audioSplitter.send(message, 40004, this.remoteRtpDescription.address)
this.session.audioSplitter.send(message, 40004, address)
return null
});

Expand Down Expand Up @@ -244,7 +245,12 @@ export class BticinoSipCamera extends ScryptedDeviceBase implements DeviceProvid
client.setKeepAlive(true, 10000)
let sip: SipCallSession
try {
await this.controllerApi.updateStreamEndpoint()
if( !this.incomingCallRequest ) {
// If this is a "view" call, update the stream endpoint to send it only to "us"
// In case of an incoming doorbell event, the C300X is already streaming video to all registered endpoints
await this.controllerApi.updateStreamEndpoint()
}

let rtsp: RtspServer;
const cleanup = () => {
client.destroy();
Expand All @@ -271,7 +277,7 @@ export class BticinoSipCamera extends ScryptedDeviceBase implements DeviceProvid
sip.onCallEnded.subscribe(cleanup)

// Call the C300X
this.remoteRtpDescription = await sip.callOrAcceptInvite(
this.remoteRtpDescription = sip.callOrAcceptInvite(
( audio ) => {
return [
//TODO: Payload types are hardcoded
Expand Down

0 comments on commit bfc6298

Please sign in to comment.