mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Control preprocessing and high-quality audio.
This commit is contained in:
parent
aa30c34863
commit
3c98e15229
2 changed files with 54 additions and 3 deletions
|
@ -183,6 +183,16 @@
|
||||||
<label for="blackboardbox">Blackboard mode</label>
|
<label for="blackboardbox">Blackboard mode</label>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<input id="preprocessingbox" type="checkbox"/ checked>
|
||||||
|
<label for="preprocessingbox">Noise suppression</label>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<input id="hqaudiobox" type="checkbox"/>
|
||||||
|
<label for="hqaudiobox">High-quality audio</label>
|
||||||
|
</form>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@ let token = null;
|
||||||
* @property {boolean} [mirrorView]
|
* @property {boolean} [mirrorView]
|
||||||
* @property {boolean} [blackboardMode]
|
* @property {boolean} [blackboardMode]
|
||||||
* @property {string} [filter]
|
* @property {string} [filter]
|
||||||
|
* @property {boolean} [preprocessing]
|
||||||
|
* @property {boolean} [hqaudio]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @type{settings} */
|
/** @type{settings} */
|
||||||
|
@ -216,6 +218,20 @@ function reflectSettings() {
|
||||||
store = true;
|
store = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(settings.hasOwnProperty('preprocessing')) {
|
||||||
|
getInputElement('preprocessingbox').checked = settings.preprocessing;
|
||||||
|
} else {
|
||||||
|
settings.preprocessing = getInputElement('preprocessingbox').checked;
|
||||||
|
store = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.hasOwnProperty('hqaudio')) {
|
||||||
|
getInputElement('hqaudiobox').checked = settings.hqaudio;
|
||||||
|
} else {
|
||||||
|
settings.hqaudio = getInputElement('hqaudiobox').checked;
|
||||||
|
store = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(store)
|
if(store)
|
||||||
storeSettings(settings);
|
storeSettings(settings);
|
||||||
}
|
}
|
||||||
|
@ -479,6 +495,22 @@ getInputElement('blackboardbox').onchange = function(e) {
|
||||||
replaceCameraStream();
|
replaceCameraStream();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getInputElement('preprocessingbox').onchange = function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if(!(this instanceof HTMLInputElement))
|
||||||
|
throw new Error('Unexpected type for this');
|
||||||
|
updateSettings({preprocessing: this.checked});
|
||||||
|
replaceCameraStream();
|
||||||
|
};
|
||||||
|
|
||||||
|
getInputElement('hqaudiobox').onchange = function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
if(!(this instanceof HTMLInputElement))
|
||||||
|
throw new Error('Unexpected type for this');
|
||||||
|
updateSettings({hqaudio: this.checked});
|
||||||
|
replaceCameraStream();
|
||||||
|
};
|
||||||
|
|
||||||
document.getElementById('mutebutton').onclick = function(e) {
|
document.getElementById('mutebutton').onclick = function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let localMute = getSettings().localMute;
|
let localMute = getSettings().localMute;
|
||||||
|
@ -1075,6 +1107,7 @@ function isSafari() {
|
||||||
|
|
||||||
const unlimitedRate = 1000000000;
|
const unlimitedRate = 1000000000;
|
||||||
const simulcastRate = 100000;
|
const simulcastRate = 100000;
|
||||||
|
const hqAudioRate = 128000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decide whether we want to send simulcast.
|
* Decide whether we want to send simulcast.
|
||||||
|
@ -1137,8 +1170,8 @@ function setUpStream(c, stream) {
|
||||||
* @param {MediaStreamTrack} t
|
* @param {MediaStreamTrack} t
|
||||||
*/
|
*/
|
||||||
function addUpTrack(t) {
|
function addUpTrack(t) {
|
||||||
|
let settings = getSettings();
|
||||||
if(c.label === 'camera') {
|
if(c.label === 'camera') {
|
||||||
let settings = getSettings();
|
|
||||||
if(t.kind == 'audio') {
|
if(t.kind == 'audio') {
|
||||||
if(settings.localMute)
|
if(settings.localMute)
|
||||||
t.enabled = false;
|
t.enabled = false;
|
||||||
|
@ -1169,9 +1202,9 @@ function setUpStream(c, stream) {
|
||||||
maxBitrate: simulcastRate,
|
maxBitrate: simulcastRate,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(c.label === 'video') {
|
if(c.label !== 'camera' || settings.hqaudio) {
|
||||||
encodings.push({
|
encodings.push({
|
||||||
maxBitrate: 192000,
|
maxBitrate: hqAudioRate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1300,6 +1333,14 @@ async function addLocalMedia(localId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(audio) {
|
||||||
|
if(!settings.preprocessing) {
|
||||||
|
audio.echoCancellation = false;
|
||||||
|
audio.noiseSuppression = false;
|
||||||
|
audio.autoGainControl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let old = serverConnection.findByLocalId(localId);
|
let old = serverConnection.findByLocalId(localId);
|
||||||
if(old) {
|
if(old) {
|
||||||
// make sure that the camera is released before we try to reopen it
|
// make sure that the camera is released before we try to reopen it
|
||||||
|
|
Loading…
Reference in a new issue