diff --git a/Frontend/library/src/Config/Config.ts b/Frontend/library/src/Config/Config.ts index 78ea0efb..200c3d77 100644 --- a/Frontend/library/src/Config/Config.ts +++ b/Frontend/library/src/Config/Config.ts @@ -461,7 +461,7 @@ export class Config { 'Min Bitrate (kbps)', 'The minimum bitrate that WebRTC should use.', 0 /*min*/, - 100000 /*max*/, + 500000 /*max*/, 0 /*value*/, useUrlParams ) @@ -474,7 +474,7 @@ export class Config { 'Max Bitrate (kbps)', 'The maximum bitrate that WebRTC should use.', 0 /*min*/, - 100000 /*max*/, + 500000 /*max*/, 0 /*value*/, useUrlParams ) diff --git a/Frontend/library/src/PixelStreaming/PixelStreaming.ts b/Frontend/library/src/PixelStreaming/PixelStreaming.ts index fc7f909c..e09579f0 100644 --- a/Frontend/library/src/PixelStreaming/PixelStreaming.ts +++ b/Frontend/library/src/PixelStreaming/PixelStreaming.ts @@ -216,17 +216,7 @@ export class PixelStreaming { '-------- Sending web rtc settings --------', 7 ); - const webRtcSettings: WebRTCSettings = { - FPS: this.config.getNumericSettingValue( - NumericParameters.WebRTCFPS - ), - MinBitrate: newValue * 1000, - MaxBitrate: - this.config.getNumericSettingValue( - NumericParameters.WebRTCMaxBitrate - ) * 1000 - }; - this.webRtcController.sendWebRtcSettings(webRtcSettings); + this.webRtcController.sendWebRTCMinBitrate(newValue * 1000 /* kbps to bps */); Logger.Log( Logger.GetStackTrace(), '-------------------------------------------', @@ -243,17 +233,7 @@ export class PixelStreaming { '-------- Sending web rtc settings --------', 7 ); - const webRtcSettings: WebRTCSettings = { - FPS: this.config.getNumericSettingValue( - NumericParameters.WebRTCFPS - ), - MinBitrate: - this.config.getNumericSettingValue( - NumericParameters.WebRTCMinBitrate - ) * 1000, - MaxBitrate: newValue * 1000 - }; - this.webRtcController.sendWebRtcSettings(webRtcSettings); + this.webRtcController.sendWebRTCMaxBitrate(newValue * 1000 /* kbps to bps */); Logger.Log( Logger.GetStackTrace(), '-------------------------------------------', @@ -270,18 +250,7 @@ export class PixelStreaming { '-------- Sending web rtc settings --------', 7 ); - const webRtcSettings: WebRTCSettings = { - FPS: newValue, - MinBitrate: - this.config.getNumericSettingValue( - NumericParameters.WebRTCMinBitrate - ) * 1000, - MaxBitrate: - this.config.getNumericSettingValue( - NumericParameters.WebRTCMaxBitrate - ) * 1000 - }; - this.webRtcController.sendWebRtcSettings(webRtcSettings); + this.webRtcController.sendWebRTCFps(newValue); Logger.Log( Logger.GetStackTrace(), '-------------------------------------------', @@ -531,11 +500,11 @@ export class PixelStreaming { if (settings.WebRTCSettings) { this.config.setNumericSetting( NumericParameters.WebRTCMinBitrate, - settings.WebRTCSettings.MinBitrate + settings.WebRTCSettings.MinBitrate / 1000 /* bps to kbps */ ); this.config.setNumericSetting( - NumericParameters.WebRTCMinBitrate, - settings.WebRTCSettings.MaxBitrate + NumericParameters.WebRTCMaxBitrate, + settings.WebRTCSettings.MaxBitrate / 1000 /* bps to kbps */ ); this.config.setNumericSetting( NumericParameters.WebRTCFPS, diff --git a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts index b13a4e25..a288e54e 100644 --- a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts +++ b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts @@ -1572,36 +1572,46 @@ export class WebRtcPlayerController { } /** - * Send the WebRTC Settings to the UE Instance as a UE UI Descriptor. - * @param webRTC - Web RTC Settings + * Send the { WebRTC.MinBitrate: SomeNumber }} command to UE to set + * the minimum bitrate that we allow WebRTC to use + * (note setting this too high in poor networks can be problematic). + * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below. */ - sendWebRtcSettings(webRTC: WebRTCSettings) { - Logger.Log( - Logger.GetStackTrace(), - '---- WebRTC Settings ----\n' + - JSON.stringify(webRTC, undefined, 4) + - '\n-------------------------------', - 6 - ); - - // 4.27 and 5 compatibility - if (webRTC.FPS != null) { - this.sendDescriptorController.emitCommand({ - 'WebRTC.Fps': webRTC.FPS - }); + sendWebRTCMinBitrate(minBitrate: number) { + Logger.Log(Logger.GetStackTrace(), `WebRTC Min Bitrate=${minBitrate}`, 6); + if (minBitrate != null) { this.sendDescriptorController.emitCommand({ - 'WebRTC.MaxFps': webRTC.FPS + 'WebRTC.MinBitrate': minBitrate }); } - if (webRTC.MinBitrate != null) { + } + + /** + * Send the { WebRTC.MaxBitrate: SomeNumber }} command to UE to set + * the minimum bitrate that we allow WebRTC to use + * (note setting this too low could result in blocky video). + * @param minBitrate - The minimum bitrate we would like WebRTC to not fall below. + */ + sendWebRTCMaxBitrate(maxBitrate: number) { + Logger.Log(Logger.GetStackTrace(), `WebRTC Max Bitrate=${maxBitrate}`, 6); + if (maxBitrate != null) { this.sendDescriptorController.emitCommand({ - 'PixelStreaming.WebRTC.MinBitrate': webRTC.MinBitrate + 'WebRTC.MaxBitrate': maxBitrate }); } - if (webRTC.MaxBitrate != null) { - this.sendDescriptorController.emitCommand({ - 'PixelStreaming.WebRTC.MaxBitrate ': webRTC.MaxBitrate - }); + } + + /** + * Send the { WebRTC.Fps: SomeNumber }} UE 5.0+ + * and { WebRTC.MaxFps } UE 4.27 command to set + * the maximum fps we would like WebRTC to stream at. + * @param fps - The maximum stream fps. + */ + sendWebRTCFps(fps: number) { + Logger.Log(Logger.GetStackTrace(), `WebRTC FPS=${fps}`, 6); + if (fps != null) { + this.sendDescriptorController.emitCommand({'WebRTC.Fps': fps}); + this.sendDescriptorController.emitCommand({'WebRTC.MaxFps': fps}); /* TODO: Remove when UE 4.27 unsupported. */ } }