为什么WebRTC丢弃音频 [英] Why Is WebRTC Dropping Audio
问题描述
我正在制作一个视频会议应用程序,其中音频非常重要.我刚刚克服了一个主要的障碍(花了我2个半星期的时间,大约花了2个星期),切换了音频设备,但是现在当我要在2台计算机上对其进行测试并打开我的麦克风时,音频变得安静.然后,我打开了麦克风输入,在音量下降之前,该麦克风输入工作了大约相同的时间.我什至尝试将autoGainControl
设置为false
,但这似乎无济于事.有没有简单的方法可以做到这一点?
I am making a video conferencing app where audio is very important. I just overcame a major hurdle (took me about 2 weeks out of a 2 and a half weeks of working on it), switching audio devices, but now when I go to test it on 2 computers and turn up my microphone the audio goes quiet. I then turned up the mic input, which worked for about the same amount of time before the volume dropped. I even tried setting autoGainControl
to false
, but that didn't seem to do anything. Is there an easy way to do this?
我尝试过:noiseSuppression: false
,(显然是autoGainControl
),echoCancellation: false
,channelCount: 2
,latency: 0
,但所有这些均无效.这是getUserMedia
的当前代码:
I have tried: noiseSuppression: false
, (obviously autoGainControl
), echoCancellation: false
, channelCount: 2
, latency: 0
, all of which did not work. Here is the current code for getUserMedia
:
audio: {
echoCancellation: echoCancellationMASTER,
noiseSuppression: noiseSuppressionMASTER,
latency: 0,
sampleRate: 48000,
sampleSize: 24,
autoGainControl: false
/*autoGainControl: false,
channelCount: 2,
latency: 0,
volume: 3.0*/
}
请注意,注释掉的代码是我也尝试过的代码,但当前未使用.
感谢任何想法,谢谢!!
Any ideas are appreciated, thanks!!
推荐答案
首先,转到chrome://webrtc-internals
以确保按照期望的方式正确应用了约束.
Firstly, go to chrome://webrtc-internals
to ensure your constraints are getting applied correctly, in the way that you expect them to be.
接下来,在每个耳机上使用一组耳机以消除反馈的可能性.这将有助于确认问题,我怀疑这是某处的某些回声消除算法.一旦确认是这种情况...
Next, use a set of headphones on each to eliminate the possibility of feedback. This will help confirm the problem, which I suspect is some echo cancellation algorithm somewhere. Once you've confirmed that's the case...
即使将echoCancellation
设置为false
,并且将noiseSuppression
设置为false
,许多设备仍然具有其自己的增强"功能.用于减少反馈.我怀疑这就是您所听到的.
Even though you set echoCancellation
to false
, and noiseSuppression
to false
, many devices still have their own "enhancements" for feedback reduction. I suspect this is what you're hearing.
如果是这种情况,那么作为一名Web开发人员,您实际上无能为力.它位于与浏览器完全不同的一层.在将麦克风用作通讯"功能时,我经常会看到联想的Realtek驱动程序出现此问题.设备,但在其他计算机上也有相同的问题.
If this is the case, then there really isn't anything you can do about it as a web developer. It's at a whole different layer apart from the browser. I often see this problem with Lenovo's Realtek drivers when using the microphone as a "communications" device, but have had the same issue on other computers.
这篇关于为什么WebRTC丢弃音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!