Fixed the TeaWeb client for safari
This commit is contained in:
parent
64a28ffa4c
commit
fbcfceb32b
5 changed files with 35 additions and 12 deletions
|
@ -541,6 +541,8 @@ export class RTCConnection {
|
||||||
this.reset(true);
|
this.reset(true);
|
||||||
|
|
||||||
this.connection.events.on("notify_connection_state_changed", event => this.handleConnectionStateChanged(event));
|
this.connection.events.on("notify_connection_state_changed", event => this.handleConnectionStateChanged(event));
|
||||||
|
|
||||||
|
(window as any).rtp = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
|
|
@ -248,9 +248,9 @@ export class WebVideoSource implements VideoSource {
|
||||||
private readonly deviceId: string;
|
private readonly deviceId: string;
|
||||||
private readonly displayName: string;
|
private readonly displayName: string;
|
||||||
private readonly stream: MediaStream;
|
private readonly stream: MediaStream;
|
||||||
|
private readonly initialSettings: VideoSourceInitialSettings;
|
||||||
private referenceCount = 1;
|
private referenceCount = 1;
|
||||||
|
|
||||||
private initialSettings: VideoSourceInitialSettings;
|
|
||||||
|
|
||||||
constructor(deviceId: string, displayName: string, stream: MediaStream) {
|
constructor(deviceId: string, displayName: string, stream: MediaStream) {
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
|
@ -291,13 +291,13 @@ export class WebVideoSource implements VideoSource {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minWidth: capabilities?.width?.min || 1,
|
minWidth: capabilities?.width?.min || 1,
|
||||||
maxWidth: capabilities?.width?.max || this.initialSettings.width,
|
maxWidth: capabilities?.width?.max || this.initialSettings.width || undefined,
|
||||||
|
|
||||||
minHeight: capabilities?.height?.min || 1,
|
minHeight: capabilities?.height?.min || 1,
|
||||||
maxHeight: capabilities?.height?.max || this.initialSettings.height,
|
maxHeight: capabilities?.height?.max || this.initialSettings.height || undefined,
|
||||||
|
|
||||||
minFrameRate: capabilities?.frameRate?.min || 1,
|
minFrameRate: capabilities?.frameRate?.min || 1,
|
||||||
maxFrameRate: capabilities?.frameRate?.max || this.initialSettings.frameRate
|
maxFrameRate: capabilities?.frameRate?.max || this.initialSettings.frameRate || undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -644,6 +644,20 @@ export class Settings {
|
||||||
valueType: "number",
|
valueType: "number",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static readonly KEY_VIDEO_DEFAULT_MAX_BANDWIDTH: ValuedRegistryKey<number> = {
|
||||||
|
key: "video_default_max_bandwidth",
|
||||||
|
defaultValue: 1_600_000,
|
||||||
|
description: "The default video bandwidth to use in bits/seconds.\nA too high value might not be allowed by all server permissions.",
|
||||||
|
valueType: "number",
|
||||||
|
};
|
||||||
|
|
||||||
|
static readonly KEY_VIDEO_DEFAULT_KEYFRAME_INTERVAL: ValuedRegistryKey<number> = {
|
||||||
|
key: "video_default_keyframe_interval",
|
||||||
|
defaultValue: 0,
|
||||||
|
description: "The default interval to forcibly request a keyframe from ourself in seconds. A value of zero means no such interval.",
|
||||||
|
valueType: "number",
|
||||||
|
};
|
||||||
|
|
||||||
static readonly KEY_VIDEO_DYNAMIC_QUALITY: ValuedRegistryKey<boolean> = {
|
static readonly KEY_VIDEO_DYNAMIC_QUALITY: ValuedRegistryKey<boolean> = {
|
||||||
key: "video_dynamic_quality",
|
key: "video_dynamic_quality",
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
|
|
|
@ -128,13 +128,20 @@ async function generateAndApplyDefaultConfig(source: VideoSource) : Promise<Vide
|
||||||
const trackSettings = videoTrack.getSettings();
|
const trackSettings = videoTrack.getSettings();
|
||||||
const capabilities = source.getCapabilities();
|
const capabilities = source.getCapabilities();
|
||||||
|
|
||||||
maxHeight = Math.min(maxHeight, capabilities.maxHeight);
|
/* Safari */
|
||||||
maxWidth = Math.min(maxWidth, capabilities.maxWidth);
|
if(trackSettings.height === 0) {
|
||||||
|
trackSettings.height = capabilities.maxHeight;
|
||||||
|
}
|
||||||
|
if(trackSettings.width === 0) {
|
||||||
|
trackSettings.width = capabilities.maxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
maxHeight = maxHeight ? Math.min(maxHeight, capabilities.maxHeight) : capabilities.maxHeight;
|
||||||
|
maxWidth = maxWidth ? Math.min(maxWidth, capabilities.maxWidth) : capabilities.maxWidth;
|
||||||
|
|
||||||
/* FIXME: Get these values somewhere else! */
|
|
||||||
const broadcastConstraints: VideoBroadcastConfig = {
|
const broadcastConstraints: VideoBroadcastConfig = {
|
||||||
maxBandwidth: 1_600_000,
|
maxBandwidth: settings.getValue(Settings.KEY_VIDEO_DEFAULT_MAX_BANDWIDTH),
|
||||||
keyframeInterval: 0
|
keyframeInterval: settings.getValue(Settings.KEY_VIDEO_DEFAULT_KEYFRAME_INTERVAL)
|
||||||
} as VideoBroadcastConfig;
|
} as VideoBroadcastConfig;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -163,7 +170,7 @@ async function generateAndApplyDefaultConfig(source: VideoSource) : Promise<Vide
|
||||||
try {
|
try {
|
||||||
await applyBroadcastConfig(source, broadcastConstraints);
|
await applyBroadcastConfig(source, broadcastConstraints);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logWarn(LogCategory.VIDEO, tr("Failed to apply initial default broadcast config: %o"), error);
|
logWarn(LogCategory.VIDEO, tr("Failed to apply initial default broadcast config (%o): %o"), broadcastConstraints, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBroadcastConfigFromSource(source, broadcastConstraints);
|
updateBroadcastConfigFromSource(source, broadcastConstraints);
|
||||||
|
|
|
@ -13,8 +13,8 @@ export interface VideoSourceCapabilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VideoSourceInitialSettings {
|
export interface VideoSourceInitialSettings {
|
||||||
width: number,
|
width: number | 0,
|
||||||
height: number,
|
height: number | 0,
|
||||||
frameRate: number
|
frameRate: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue