From 1297ed9bdfe7ba209eb5afce62c4ecc9ab0f9aec Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 18 Jan 2023 08:06:39 -0800 Subject: [PATCH] webrtc: fix firefox codec detection --- plugins/webrtc/package-lock.json | 4 ++-- plugins/webrtc/package.json | 2 +- plugins/webrtc/src/ffmpeg-to-wrtc.ts | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/webrtc/package-lock.json b/plugins/webrtc/package-lock.json index bcf86e3bd..1b07571f9 100644 --- a/plugins/webrtc/package-lock.json +++ b/plugins/webrtc/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/webrtc", - "version": "0.1.24", + "version": "0.1.25", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/webrtc", - "version": "0.1.24", + "version": "0.1.25", "dependencies": { "@scrypted/common": "file:../../common", "@scrypted/sdk": "file:../../sdk", diff --git a/plugins/webrtc/package.json b/plugins/webrtc/package.json index bb4219250..4bdcdd778 100644 --- a/plugins/webrtc/package.json +++ b/plugins/webrtc/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/webrtc", - "version": "0.1.24", + "version": "0.1.25", "scripts": { "scrypted-setup-project": "scrypted-setup-project", "prescrypted-setup-project": "scrypted-package-json", diff --git a/plugins/webrtc/src/ffmpeg-to-wrtc.ts b/plugins/webrtc/src/ffmpeg-to-wrtc.ts index 2b2de6563..fdba156d1 100644 --- a/plugins/webrtc/src/ffmpeg-to-wrtc.ts +++ b/plugins/webrtc/src/ffmpeg-to-wrtc.ts @@ -320,16 +320,18 @@ export function parseOptions(options: RTCSignalingOptions) { } return false; }); + + + // firefox is misleading. special case that to disable transcoding. + if (options?.userAgent?.includes('Firefox/')) + sessionSupportsH264High = true; + const transcodeWidth = Math.max(640, Math.min(options?.screen?.width || 960, 1280)); const width = options?.screen?.width; const height = options?.screen?.height; const max = Math.max(width, height) * options?.screen?.devicePixelRatio; const isMediumResolution = !sessionSupportsH264High || (max && max < 1920); - // firefox is misleading. special case that to disable transcoding. - if (options?.userAgent?.includes('Firefox/')) - sessionSupportsH264High = true; - return { sessionSupportsH264High, transcodeWidth,