mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to ALSA?

*nix specific usage questions
user-08-15
New Cone
New Cone
Posts: 5
Joined: 04 Aug 2010 21:34

mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to ALSA?

Postby user-08-15 » 25 Oct 2010 19:58

Hi!
When using the mozilla-plugin-vlc in Ubuntu 10.10, then audio will not restart on resume after pause. Furthermore, after some minutes watching, audio output suddenly stops (while video playback continues). I had no such problems under Ubuntu 10.04, where I don't know if it is an Ubuntu-related or VLC-related problem.

A very similar problem is described in viewtopic.php?f=13&t=83295 when using ALSA-output for the standalone-vlc. And really, I get the same trouble when starting the standalone-vlc by "vlc --aout=alsa": Just playback a video and press pause/resume => audio disappears. In contrast, all works fine with "vlc --aout=pulse" (where the package "vlc-plugin-pulse" is installed of course, even by default).

So is mozilla-plugin-vlc compiled with ALSA-output forced? Is there a possibility to choose another audio output for it, e.g., by using some HTML-attribute or Javascript?

For the moment, no Ubuntu 10.10 user seems to be able to use the mozilla-plugin-vlc without this problem! Does anybody know a workaround - without having to compile vlc completely on my own from its sources?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to A

Postby Rémi Denis-Courmont » 25 Oct 2010 21:42

PulseAudio is disabled in the Mozilla plugin. The way the browser uses Xlib, it is not safe for plugins to use Xlib. But the PulseAudio client library uses Xlib...
This has been causing a lot of crashes in earlier VLC versions.

Unfortunately, depending on your point of view, this is either a bug in the browser, in libpulse, or both. So VLC can't fix it. Future libpulse versions will probably fix the problem by removing the use of Xlib altogether.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

user-08-15
New Cone
New Cone
Posts: 5
Joined: 04 Aug 2010 21:34

Re: mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to A

Postby user-08-15 » 26 Oct 2010 12:54

Thanks for your answer! Do you have deeper insights into this Xlib-problem and can you give some precise information on it?

It sounds as if the basic problem lays in Mozilla, which 'uses Xlib in some exclusive or incorrect fashion'. How?
A workaround to avoid the symptoms might be to remove any Xlib-usage from libpulse. Where do they need Xlib for? Isn't it just for window handling and drawing?
Do all plugins that play sound run into the same problem when using PulseAudio? Or is there some specific usage of PulseAudio by VLC?

This approach focuses on solving the problem by using PulseAudio as output in the mozilla-plugin. However, this isn't a must.
The described problem of the mozilla-plugin seems to be related to the problem that one cannot pause/resume playback, even in the standalone VLC, when using ALSA output, since it 'looses some token, callback or buffer' or so (?). The most straightforward solution would be to configure ALSA, or change its usage in VLC or its interaction to PulseAudio, in a way that enables conflict-free ALSA-output. Do you have some helpful thoughts on this?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to A

Postby Rémi Denis-Courmont » 26 Oct 2010 17:06

The process needs to invoke XInitThreads() before any thread tries to use Xlib otherwise, that is to say call XOpenDisplay(). Unfortunately, the browser does not call XInitThreads(), and it's too late for the VLC plugin or libpulse to have the chance.

libpulse uses Xlib to find the PulseAudio session through root window properties. Most bleeding edge versions use XCB instead of Xlib though (but VLC does not take this into account yet).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

user-08-15
New Cone
New Cone
Posts: 5
Joined: 04 Aug 2010 21:34

Re: mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to A

Postby user-08-15 » 28 Oct 2010 03:48

Thanks for this clear information! I just posted something on this topic in Bugzilla. And as you said, according to http://www.mail-archive.com/pulseaudio- ... 04017.html, libpulse makes no longer use of Xlib in the relevant parts since the latest version, 0.9.22. Ubuntu 10.10 has already 0.9.22 in its repositories. So, another solution could be to compile the mozilla-plugin with ALSA disabled, but PulseAudio enabled. Unfortunately I run into trouble when trying to do so. Here is what I did:

1.) On my test-system, I already have vlc and mozilla-plugin-vlc installed.
2.) I downloaded the VLC source-code and prepared needed packages with build-dep vlc
3.) ./configure --enable-mozilla --enable-pulse --disable-alsa
4.) make, make install
5.) The newly created file in /usr/local/lib/mozilla/plugins/libvlcplugin.so moved to /usr/lib/mozilla/plugins/libvlcplugin.so where I overwrite the existing so-file (from the repositorie's mozilla-plugin-vlc package).
6.) Restarted firefox with some simple test-page:

Code: Select all

<html><head></head><body> <embed id="vlc" type="application/x-vlc-plugin" width="1024px" height="768px" target="TestFilm.mpg"> <div onclick="document.getElementById('vlc').playlist.togglePause()">Pause</div> </body></html>
However, when I click on pause and then again to resume, video playback restarts without audio, just as before. Further, when calling

Code: Select all

pkill pulseaudio; sleep 2; pulseaudio -vv
to retrieve lots of internal information, I can see that still ALSA is used instead of PulseAudio.
The alternative ./configure --enable-mozilla --enable-pulse --disable-alsa --disable-sdl --disable-oss [...and all others]
makes also no difference. What am I doing wrong? Am I setting up the plugin in a wrong way, or is the --enable-mozilla flag already forcing ALSA output?

Here is the output I get:

Code: Select all

########## lots of initial information, then opened page with autoplay: I: sink-input.c: Created input 0 "ALSA Playback" on alsa_output.pci-0000_00_08.0.analog-stereo with sample spec float32le 2ch 48000Hz and channel map front-left,front-right I: sink-input.c: media.name = "ALSA Playback" I: sink-input.c: application.name = "ALSA plug-in [firefox-bin]" I: sink-input.c: native-protocol.peer = "UNIX socket client" I: sink-input.c: native-protocol.version = "16" I: sink-input.c: application.process.id = "1679" I: sink-input.c: application.process.user = "******" I: sink-input.c: application.process.host = "******" I: sink-input.c: application.process.binary = "firefox-bin" I: sink-input.c: window.x11.display = ":0.0" I: sink-input.c: application.language = "de_DE.UTF-8" I: sink-input.c: application.process.machine_id = "************************************************" I: sink-input.c: application.process.session_id = "************************************************" I: sink-input.c: module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [firefox-bin]" I: protocol-native.c: Requested tlength=5461,33 ms, minreq=21,33 ms D: protocol-native.c: Early requests mode enabled, configuring sink latency to minreq. D: alsa-sink.c: Cutting sleep time for the initial iterations by half. D: alsa-sink.c: Cutting sleep time for the initial iterations by half. D: memblockq.c: memblockq requested: maxlength=4194304, tlength=2097152, base=8, prebuf=2088960, minreq=8192 maxrewind=0 D: memblockq.c: memblockq sanitized: maxlength=4194304, tlength=2097152, base=8, prebuf=2088960, minreq=8192 maxrewind=0 I: protocol-native.c: Final latency 5482,67 ms = 5418,67 ms + 2*21,33 ms + 21,33 ms D: alsa-sink.c: Cutting sleep time for the initial iterations by half. D: alsa-sink.c: Latency set to 21,33ms D: alsa-sink.c: hwbuf_unused=349008 D: alsa-sink.c: setting avail_min=87694 D: alsa-sink.c: Requesting rewind due to latency change. D: alsa-sink.c: Requested to rewind 352768 bytes. D: alsa-sink.c: Limited to 352128 bytes. D: alsa-sink.c: before: 88032 D: alsa-sink.c: after: 88032 D: alsa-sink.c: Rewound 352128 bytes. D: sink.c: Processing rewind... D: sink-input.c: Have to rewind 352128 bytes on render memblockq. D: source.c: Processing rewind... D: core-subscribe.c: Dropped redundant event due to change event. D: reserve-wrap.c: Device lock status of reserve-monitor-wrapper@Audio0 changed: not busy D: protocol-native.c: Requesting rewind due to end of underrun. D: alsa-sink.c: Requested to rewind 352768 bytes. D: alsa-sink.c: Limited to 2668 bytes. D: alsa-sink.c: before: 667 D: alsa-sink.c: after: 667 D: alsa-sink.c: Rewound 2668 bytes. D: sink.c: Processing rewind... D: sink-input.c: Have to rewind 2668 bytes on render memblockq. D: source.c: Processing rewind... D: alsa-sink.c: Wakeup from ALSA! ########## Now playback runs. When I press pause: D: protocol-native.c: Underrun on 'ALSA Playback', 0 bytes in queue. ########## No I press resume, but nothing happens, so I close the window: D: sink-input.c: Requesting rewind due to corking D: module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_08.0.analog-stereo becomes idle, timeout in 5 seconds. D: alsa-sink.c: hwbuf_unused=0 D: alsa-sink.c: setting avail_min=87693 D: alsa-sink.c: Requested to rewind 352768 bytes. D: alsa-sink.c: Limited to 2716 bytes. D: alsa-sink.c: before: 679 D: alsa-sink.c: after: 679 D: alsa-sink.c: Rewound 2716 bytes. D: sink.c: Processing rewind... D: source.c: Processing rewind... D: module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_08.0.analog-stereo becomes idle, timeout in 5 seconds. D: core.c: Hmm, no streams around, trying to vacuum. I: sink-input.c: Freeing input 0 "ALSA Playback" I: client.c: Freed 3 "ALSA plug-in [firefox-bin]" I: protocol-native.c: Connection died. I: module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_08.0.analog-stereo idle for too long, suspending ... D: sink.c: Suspend cause of sink alsa_output.pci-0000_00_08.0.analog-stereo is 0x0004, suspending I: alsa-sink.c: Device suspended... D: reserve-wrap.c: Device lock status of reserve-monitor-wrapper@Audio0 changed: not busy D: module-udev-detect.c: /dev/snd/controlC0 is accessible: yes
So, as a single question: How can I compile and install the mozilla-plugin with PulseAudio output forced?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: mozilla-plugin-vlc looses audio on Ubuntu 10.10 due to A

Postby Rémi Denis-Courmont » 28 Oct 2010 17:24

Without modifying the source code, it's not going to work currently. VLC versions were written before the PulseAudio bug was fixed. In fact, there has not been any release with the fix to this day.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 36 guests