您需要强制QtWebEngine使用 ALSA。在嵌入式系统中,默认情况下它是禁用的。
在qt5.7/qtwebengine/src/3rdparty/chromium/media/media.gyp中,有一个测试来检查我们是否在嵌入式系统上:
# Enable ALSA and Pulse for runtime selection.
['(OS=="linux" or OS=="freebsd" or OS=="solaris") and ((embedded!=1 and chromecast==0) or is_cast_desktop_build==1)', {
# ALSA is always needed for Web MIDI even if the cras is enabled.
'use_alsa%': 1,
'conditions': [
['use_cras==1', {
'use_pulseaudio%': 0,
}, {
'use_pulseaudio%': 1,
}],
],
}, {
'use_alsa%': 0,
'use_pulseaudio%': 0,
}],
我最后更改use_alsa%为1和 in qt5.7/qtwebengine/src/core/config/embedded_linux.pri,我添加了一个新标志:
use_alsa=1
使用此设置,我的嵌入式 ARM Linux 上有音频并带有标志:
enable_webrtc=1
我能够开始一个带有视频和音频的 WebRTC 会话。