mirror of
https://github.com/koush/scrypted.git
synced 2026-03-06 11:21:58 +00:00
rebroadcast: add video detection
This commit is contained in:
4
plugins/prebuffer-mixin/package-lock.json
generated
4
plugins/prebuffer-mixin/package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user