本文介绍了QtWebEngine Quicknano在嵌入式Linux中没有声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将QtWebEngine编译到我的i.MX6嵌入式设备中。当我尝试使用quicknanobrowser播放youtube视频时,视频播放但没有声音。事实上,当我尝试在 hpr.dogphilosophy.net/test即使该网站说支持浏览器编解码器。

I have compiled QtWebEngine into my i.MX6 embedded device. When I tried to play youtube Video with quicknanobrowser, the video plays but there would be no sound. In fact, there is no sound when I try to test play the audio files in hpr.dogphilosophy.net/test even though the website said that the browser codec is supported.

我启用了pulseaudio,gstreamer,ffmpeg,opus,vpx,libwebp,但仍然没有声音。

I have enabled pulseaudio, gstreamer, ffmpeg, opus, vpx, libwebp and yet still no sound.

然而,我可以用gst-launch播放视频并且会有声音。

However, I could play video with gst-launch and there would be sound.

它是否有问题quicknanobrowser,不启用声音?或者我需要添加到嵌入式系统的组件?

Is it something wrong with quicknanobrowser that does not enable sound? Or is there components that I need to add to the embedded system?

编辑:Alsa和pulseaudio,GStreamer都能正常工作。

Alsa and pulseaudio, GStreamer are all working fine with sound.

推荐答案

您需要强制 QtWebEngine 才能使用ALSA。在嵌入式系统中,默认情况下禁用它。

You need to force QtWebEngine to use ALSA. In embedded systems, it is disabled by default.

qt5.7 / qtwebengine / src / 3rdparty / chromium / media / media.gyp ,有一个测试来检查我们是否在嵌入式系统上:

In qt5.7/qtwebengine/src/3rdparty/chromium/media/media.gyp, there is a test to check if we are on an embedded system:

  # 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 qt5.7 / qtwebengine / src / core / config / embedded_linux.pri ,我添加了一个新标志:

I changed last use_alsa% to 1 and in qt5.7/qtwebengine/src/core/config/embedded_linux.pri, I added a new flag:

use_alsa=1

通过这些设置,我的嵌入式ARM Linux上有音频并带有标志:

With this settings I have audio on my embedded ARM Linux and with flag:

enable_webrtc=1

我可以使用视频和音频开始WebRTC会话。

I am able to start a WebRTC session with video and audio.

这篇关于QtWebEngine Quicknano在嵌入式Linux中没有声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!