[vlc-devel] Ticket #686: mozilla plugin and instances of libvlc

Justus-bulk at Piater.name Justus-bulk at Piater.name
Thu Sep 18 10:02:16 CEST 2008


Hi -

I've taken a first look at Ticket #686 (and fixed a few, apparently
inconsequential, bugs along the way; see forthcoming patches).  Before
moving on, there are a few issues I need to understand:

- http://wiki.videolan.org/Documentation:Hacker's_Guide/libvlc says:
  "Libvlc is a singleton. For each application wrapped around libvlc,
  only one libvlc instance should be running." I take this to mean
  that within an address space, only one libvlc instance is allowed.
  This raises the following questions:

  - The mozilla plugin (mozilla/vlcplugin.c:188) calls libvlc_new()
    for each plugin instance.  So this is a fundamental bug?

  - If a libvlc "instance" is a singleton, why does one need to call a
    function called "...new()" returning a pointer to an instance,
    instead of calling a function called "...init()" and not worrying
    about the (unique!?) instance pointer?

- http://wiki.videolan.org/Documentation:Hacker's_Guide/Core says:
  "Having several input and video_output threads reading multiple
  files at the same time is permitted, despite the fact that the
  current interface doesn't allow any way to do it [this is subject to
  change in the near future]. Anyway the client has been written from
  the ground up with this in mind."

  - Is this the way the mozilla plugin should be properly implemented
    to permit multiple plugin instances to coexist?

  - If not, what would be the right way then?

  - If so: Does "the current interface" (that doesn't give access to
    this feature) refer to the GUI or to the API? In the former case
    (limited GUI), could someone briefly outline or point me to
    documentation that explains how to run multiple input and output
    threads simultaneously and independently? In the latter case
    (limited API), there is no hope of fixing the mozilla plugin in
    the short term?

By the way, I've encountered two types of bugs when running multiple
instances of the VLC mozilla plugin:

- main libvlc error: input item 0xaa6f66c0 has not been deleted
  properly: refcount 1, name file:///whatever 
  firefox-bin: libvlc.c:1045: libvlc_InternalCleanup: Assertion
  `b_clean' failed.

- playlist_LastLoop() loops forever because
  p_playlist->p_input->b_die is true but p_playlist->p_input->b_dead
  remains false (perhaps because the thread supposed to set it has
  died?), causing a pthread_join() on this thread to hang
  indefinitely.

Maybe both are just different manifestations of the same problem. They
occur, one or the other, only about one out of ten times I leave a
page containing VLC mozilla plugin instances, making it difficult to
reproduce and even more difficult to demonstrate that the problem has
been fixed.

I have been unable to achieve any useful segfaults or memory errors
using gdb or valgrind, so, for the time being, it seems likely that
the problem is an abuse of the VLC library (as suggested above;
leading to concurrency problems?) rather than a low-level coding
error.

Any help is appreciated.
Thanks,
Justus



More information about the vlc-devel mailing list