MediaListPlayer thread deadlock and browser plugin playlists

This forum is about all development around libVLC.
nib
New Cone
New Cone
Posts: 2
Joined: 17 Aug 2009 18:58

MediaListPlayer thread deadlock and browser plugin playlists

Postby nib » 17 Aug 2009 20:11

I've been working to resolve an issue with the Mozilla plugin related to playback of the playlist not continuing on to the next playlist item and some audio distortion issues related to manually changing the current playlist item. I've looked into the code for the plugin to find that, in fact, the playback no longer supports any automatic transitioning to the next playlist item upon reaching the end of the current item. I've also noticed this same issue exists for the ActiveX plugin.

I decided to tackle this issue myself and after looking into the code base I came across a MediaListPlayer that I figured would solve this issue nicely. Unfortunately, after converting the code to use the MediaListPlayer, I encountered a threading deadlock whenever the MediaListPlayer tried to transition to the next media item. I traced this down to the fact that whenever the MediaPlayer finishes playing an item it triggered the "libvlc_MediaPlayerEndReached" event which in turn triggered the callback function registered to the MediaListPlayer to trigger the transition to the next playlist item. Unfortunately, this transition to the next playlist item causes the deletion of the previous item and its callback functions (one of which was currently in the process of executing). Therefore, the deletion process ends up waiting for the callback to finish which never happens because its waiting for the deletion to finish. I could get into more details if need be, but that is the gist of it.

After thinking about the issue for a while, I decided to look at the main playlist for VLC to see how this issue was dealt with there. This, as it turns out, is a much more robust playlist system than the media list. After looking through the code, it seemed that fixing the MediaListPlayer would be a rather involved process so I set out to make the plugin work with the existing VLC playlist. This worked like a charm, it resolved all the issues I had been having. However, the way I managed to get it to work seems very hacky and involved using a deprecated function "libvlc_playlist_get_media_player" as well as including two "private" internal files (libvlc.h and control/libvlc_internal.h) from the /src directory in order to get access to the actual playlist.

At this point I'm willing to put in some time to patch the plugins, but I have a few questions about how to proceed:
Is there any reason the browser plugin playlists should be using media lists instead of the VLC playlist?
Is their someone actively working on the Media List Player?
Since it's deprecated, what is the proper way to achieve what "libvlc_playlist_get_media_player" offers?
Is there a way to obtain the VLC playlist_t* from the VLC instance without accessing the internal files from the /src folder?
Is there anyone I should specifically be looking to direct these questions to? or speak with before submitting any changes?

I'm basically looking for the proper way to proceed since the changes I made will resolve the current issues, but seem to be at odds with the overall design.

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

Re: MediaListPlayer thread deadlock and browser plugin playlists

Postby Rémi Denis-Courmont » 17 Aug 2009 20:45

Don't use media list player. As you noted it can deadlock. I'm planning to remove it anyway, but this is best discussed on the vlc-devel mailing list.

It's probably a lot simpler to implement your own list and change the item whenever you get the end of item event.

Using the playlist is problematic as well, as there is only one per instance :? .
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 54 guests