Some minor changes and fixes

This commit is contained in:
WolverinDEV 2020-11-22 16:11:00 +01:00
parent 0bde320faa
commit 0e030215db
5 changed files with 36 additions and 14 deletions

View file

@ -1,4 +1,9 @@
# Changelog: # 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** ** 14.11.20**
- Fixed bug where the microphone has been requested when muting it. - Fixed bug where the microphone has been requested when muting it.

View file

@ -182,8 +182,6 @@ export function initialize(event_registry: Registry<ClientGlobalControlEvents>)
spawnVideoSourceSelectModal(event.broadcastType, true).then(async source => { spawnVideoSourceSelectModal(event.broadcastType, true).then(async source => {
if(!source) { return; } if(!source) { return; }
const videoTrack = source.getStream().getVideoTracks()[0];
try { try {
event.connection.getServerConnection().getVideoConnection().startBroadcasting("camera", source) event.connection.getServerConnection().getVideoConnection().startBroadcasting("camera", source)
.catch(error => { .catch(error => {

View file

@ -131,15 +131,15 @@ function initializeController(events: Registry<ModalVideoSourceEvents>, currentS
if(typeof currentSource === "object") { if(typeof currentSource === "object") {
const videoTrack = currentSource.getStream().getVideoTracks()[0]; const videoTrack = currentSource.getStream().getVideoTracks()[0];
const settings = videoTrack.getSettings(); const settings = videoTrack.getSettings();
const capabilities = videoTrack.getCapabilities(); const capabilities = "getCapabilities" in videoTrack ? videoTrack.getCapabilities() : undefined;
events.fire_react("notify_setting_dimension", { events.fire_react("notify_setting_dimension", {
setting: { setting: {
minWidth: capabilities.width ? capabilities.width.min : settings.width, minWidth: capabilities?.width ? capabilities.width.min : 1,
maxWidth: capabilities.width ? capabilities.width.max : settings.width, maxWidth: capabilities?.width ? capabilities.width.max : settings.width,
minHeight: capabilities.height ? capabilities.height.min : settings.height, minHeight: capabilities?.height ? capabilities.height.min : 1,
maxHeight: capabilities.height ? capabilities.height.max : settings.height, maxHeight: capabilities?.height ? capabilities.height.max : settings.height,
originalWidth: settings.width, originalWidth: settings.width,
originalHeight: settings.height, originalHeight: settings.height,
@ -157,13 +157,13 @@ function initializeController(events: Registry<ModalVideoSourceEvents>, currentS
if(typeof currentSource === "object") { if(typeof currentSource === "object") {
const videoTrack = currentSource.getStream().getVideoTracks()[0]; const videoTrack = currentSource.getStream().getVideoTracks()[0];
const settings = videoTrack.getSettings(); 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; const round = (value: number) => Math.round(value * 100) / 100;
events.fire_react("notify_settings_framerate", { events.fire_react("notify_settings_framerate", {
frameRate: { frameRate: {
min: round(capabilities.frameRate ? capabilities.frameRate.min : settings.frameRate), min: round(capabilities?.frameRate ? capabilities.frameRate.min : 1),
max: round(capabilities.frameRate ? capabilities.frameRate.max : settings.frameRate), max: round(capabilities?.frameRate ? capabilities.frameRate.max : settings.frameRate),
original: round(settings.frameRate) original: round(settings.frameRate)
} }
}); });

View file

@ -583,6 +583,11 @@ const BpsInfo = () => {
} }
const Settings = () => { 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); const [ advanced, setAdvanced ] = useState(false);
return ( return (

View file

@ -53,9 +53,9 @@ export class SdpProcessor {
rtcpFb: [ "nack", "nack pli", "ccm fir", "transport-cc" ], rtcpFb: [ "nack", "nack pli", "ccm fir", "transport-cc" ],
//42001f | Original: 42e01f //42001f | Original: 42e01f
fmtp: { 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-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); const sdp = sdpTransform.parse(sdpString);
this.rtpRemoteChannelMapping = SdpProcessor.generateRtpSSrcMapping(sdp); this.rtpRemoteChannelMapping = SdpProcessor.generateRtpSSrcMapping(sdp);
/* FIXME! */ /* Fix for Firefox to acknowledge the max bandwidth */
SdpProcessor.patchLocalCodecs(sdp); 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); return sdpTransform.write(sdp);
} }