diff --git a/plugins/prebuffer-mixin/package-lock.json b/plugins/prebuffer-mixin/package-lock.json index bb37fad56..d4c153f03 100644 --- a/plugins/prebuffer-mixin/package-lock.json +++ b/plugins/prebuffer-mixin/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.212", + "version": "0.1.213", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.212", + "version": "0.1.213", "license": "Apache-2.0", "dependencies": { "@scrypted/common": "file:../../common", diff --git a/plugins/prebuffer-mixin/package.json b/plugins/prebuffer-mixin/package.json index 701dc89d5..44932c5c3 100644 --- a/plugins/prebuffer-mixin/package.json +++ b/plugins/prebuffer-mixin/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/prebuffer-mixin", - "version": "0.1.212", + "version": "0.1.213", "description": "Rebroadcast and Prebuffer for VideoCameras.", "author": "Scrypted", "license": "Apache-2.0", diff --git a/plugins/prebuffer-mixin/src/main.ts b/plugins/prebuffer-mixin/src/main.ts index 1c7722c15..de492f2c4 100644 --- a/plugins/prebuffer-mixin/src/main.ts +++ b/plugins/prebuffer-mixin/src/main.ts @@ -427,13 +427,6 @@ class PrebufferSession { probingAudioCodec = true; } - // complain to the user about the codec if necessary. upstream may send a audio - // stream but report none exists (to request muting). - if (!audioSoftMuted && advertisedAudioCodec && detectedAudioCodec !== undefined - && detectedAudioCodec !== advertisedAudioCodec) { - this.console.warn('Audio codec plugin reported vs detected mismatch', advertisedAudioCodec, detectedAudioCodec); - } - // the assumed audio codec is the detected codec first and the reported codec otherwise. const assumedAudioCodec = detectedAudioCodec === undefined ? advertisedAudioCodec?.toLowerCase() @@ -689,6 +682,19 @@ class PrebufferSession { .catch(() => { }); } + // complain to the user about the codec if necessary. upstream may send a audio + // stream but report none exists (to request muting). + if (!audioSoftMuted && advertisedAudioCodec && session.inputAudioCodec !== undefined + && session.inputAudioCodec !== advertisedAudioCodec) { + this.console.warn('Audio codec plugin reported vs detected mismatch', advertisedAudioCodec, detectedAudioCodec); + } + + const advertisedVideoCodec = mso?.video?.codec; + if (advertisedVideoCodec && session.inputVideoCodec !== undefined + && session.inputVideoCodec !== advertisedVideoCodec) { + this.console.warn('Video codec plugin reported vs detected mismatch', advertisedVideoCodec, session.inputVideoCodec); + } + if (!session.inputAudioCodec) { this.console.log('No audio stream detected.'); } @@ -1001,11 +1007,16 @@ class PrebufferSession { } } - if (mediaStreamOptions.video && session.inputVideoResolution?.[2] && session.inputVideoResolution?.[3]) { + if (!mediaStreamOptions.video) + mediaStreamOptions.video = {}; + + mediaStreamOptions.video.codec = session.inputVideoCodec; + + if (session.inputVideoResolution?.[2] && session.inputVideoResolution?.[3]) { Object.assign(mediaStreamOptions.video, { width: parseInt(session.inputVideoResolution[2]), height: parseInt(session.inputVideoResolution[3]), - }) + }); } const now = Date.now();