mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 14:13:28 +00:00
Fixed an issue for some devices. They send screen width as not even value. (#1797)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/webrtc",
|
||||
"version": "0.2.77",
|
||||
"version": "0.2.78",
|
||||
"scripts": {
|
||||
"scrypted-setup-project": "scrypted-setup-project",
|
||||
"prescrypted-setup-project": "scrypted-package-json",
|
||||
|
||||
@@ -458,7 +458,13 @@ export function parseOptions(options: RTCSignalingOptions) {
|
||||
if (options?.userAgent?.includes('Firefox/'))
|
||||
sessionSupportsH264High = true;
|
||||
|
||||
const transcodeWidth = Math.max(640, Math.min(options?.screen?.width || 960, 1280));
|
||||
// Some devices return a `screen width` value that is not a multiple of 2, which is not allowed for the h264 codec.
|
||||
// Convert to a smaller even value.
|
||||
const screenWidthForTranscodeH264 = !options?.screen?.width
|
||||
? 960
|
||||
: Math.trunc(options?.screen?.width / 2) * 2;
|
||||
|
||||
const transcodeWidth = Math.max(640, Math.min(screenWidthForTranscodeH264, 1280));
|
||||
const devicePixelRatio = options?.screen?.devicePixelRatio || 1;
|
||||
const width = (options?.screen?.width * devicePixelRatio) || undefined;
|
||||
const height = (options?.screen?.height * devicePixelRatio) || undefined;
|
||||
|
||||
Reference in New Issue
Block a user