diff --git a/ChangeLog.md b/ChangeLog.md index 68ea38cc..5de5a4aa 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,9 @@ # Changelog: +** 22.11.20** + - Added a ton of video settings + - Added screen sharing (Currently via the camera channel) + - Using codec H264 instead of VP8 + ** 14.11.20** - Fixed bug where the microphone has been requested when muting it. diff --git a/shared/js/events/ClientGlobalControlHandler.ts b/shared/js/events/ClientGlobalControlHandler.ts index 0edb27d9..ca9b6d9c 100644 --- a/shared/js/events/ClientGlobalControlHandler.ts +++ b/shared/js/events/ClientGlobalControlHandler.ts @@ -182,8 +182,6 @@ export function initialize(event_registry: Registry) spawnVideoSourceSelectModal(event.broadcastType, true).then(async source => { if(!source) { return; } - const videoTrack = source.getStream().getVideoTracks()[0]; - try { event.connection.getServerConnection().getVideoConnection().startBroadcasting("camera", source) .catch(error => { diff --git a/shared/js/ui/modal/video-source/Controller.tsx b/shared/js/ui/modal/video-source/Controller.tsx index 2cb34aa1..935b73a5 100644 --- a/shared/js/ui/modal/video-source/Controller.tsx +++ b/shared/js/ui/modal/video-source/Controller.tsx @@ -131,15 +131,15 @@ function initializeController(events: Registry, currentS if(typeof currentSource === "object") { const videoTrack = currentSource.getStream().getVideoTracks()[0]; const settings = videoTrack.getSettings(); - const capabilities = videoTrack.getCapabilities(); + const capabilities = "getCapabilities" in videoTrack ? videoTrack.getCapabilities() : undefined; events.fire_react("notify_setting_dimension", { setting: { - minWidth: capabilities.width ? capabilities.width.min : settings.width, - maxWidth: capabilities.width ? capabilities.width.max : settings.width, + minWidth: capabilities?.width ? capabilities.width.min : 1, + maxWidth: capabilities?.width ? capabilities.width.max : settings.width, - minHeight: capabilities.height ? capabilities.height.min : settings.height, - maxHeight: capabilities.height ? capabilities.height.max : settings.height, + minHeight: capabilities?.height ? capabilities.height.min : 1, + maxHeight: capabilities?.height ? capabilities.height.max : settings.height, originalWidth: settings.width, originalHeight: settings.height, @@ -157,13 +157,13 @@ function initializeController(events: Registry, currentS if(typeof currentSource === "object") { const videoTrack = currentSource.getStream().getVideoTracks()[0]; const settings = videoTrack.getSettings(); - const capabilities = videoTrack.getCapabilities(); + const capabilities = "getCapabilities" in videoTrack ? videoTrack.getCapabilities() : undefined; const round = (value: number) => Math.round(value * 100) / 100; events.fire_react("notify_settings_framerate", { frameRate: { - min: round(capabilities.frameRate ? capabilities.frameRate.min : settings.frameRate), - max: round(capabilities.frameRate ? capabilities.frameRate.max : settings.frameRate), + min: round(capabilities?.frameRate ? capabilities.frameRate.min : 1), + max: round(capabilities?.frameRate ? capabilities.frameRate.max : settings.frameRate), original: round(settings.frameRate) } }); diff --git a/shared/js/ui/modal/video-source/Renderer.tsx b/shared/js/ui/modal/video-source/Renderer.tsx index 617441da..6275ac68 100644 --- a/shared/js/ui/modal/video-source/Renderer.tsx +++ b/shared/js/ui/modal/video-source/Renderer.tsx @@ -583,6 +583,11 @@ const BpsInfo = () => { } const Settings = () => { + if(window.detectedBrowser.name === "firefox") { + /* Firefox does not seem to give a fuck about any of our settings */ + return null; + } + const [ advanced, setAdvanced ] = useState(false); return ( diff --git a/web/app/rtc/SdpUtils.ts b/web/app/rtc/SdpUtils.ts index af32e733..93a81d08 100644 --- a/web/app/rtc/SdpUtils.ts +++ b/web/app/rtc/SdpUtils.ts @@ -53,9 +53,9 @@ export class SdpProcessor { rtcpFb: [ "nack", "nack pli", "ccm fir", "transport-cc" ], //42001f | Original: 42e01f fmtp: { - "level-asymmetry-allowed": 1, "packetization-mode": 1, "profile-level-id": "42e01f", "max-br": 25000, "max-fr": 60, + "level-asymmetry-allowed": 1, "packetization-mode": 1, "profile-level-id": "42e01f", "max-br": 25000, "max-fr": 30, "x-google-max-bitrate": 22 * 1000, - "x-google-start-bitrate": 22 * 1000, /* Fun fact: This actually controls the max bitrate for google chrome */ + "x-google-start-bitrate": 22 * 1000, } } ]; @@ -87,8 +87,22 @@ export class SdpProcessor { const sdp = sdpTransform.parse(sdpString); this.rtpRemoteChannelMapping = SdpProcessor.generateRtpSSrcMapping(sdp); - /* FIXME! */ - SdpProcessor.patchLocalCodecs(sdp); + /* Fix for Firefox to acknowledge the max bandwidth */ + for(const media of sdp.media) { + if(media.type !== "video") { continue; } + if(media.bandwidth?.length > 0) { continue; } + + const config = media.fmtp.find(e => e.config.indexOf("x-google-start-bitrate") !== -1); + if(!config) { continue; } + + const bitrate = config.config.split(";").find(e => e.startsWith("x-google-start-bitrate="))?.substr(23); + if(!bitrate) { continue; } + + media.bandwidth = [{ + type: "AS", + limit: bitrate + }]; + } return sdpTransform.write(sdp); }