[vlc-devel] Deadlocked in stop if too close to play (sample code)
jboileau at gmail.com
Tue Oct 27 17:38:01 CET 2009
Here is some sample code that reproduces the problem. I have kept it
to its bare minimum and made it using code from the QT example from
the VLC site. Additional info: without the loop that waits for the
play to be started before issuing a stop it does not hang. This is
probably to be expected, its should be easier to stop a play that
hasn't even started yet. But with the code as is, the app freezes on
the first call to stop.
The code is here: http://pastebin.com/m2904881
And what I could get from the logger window is here:
I am using VLC 1.0.1 and Visual Studio 2003. I use LoadLibrary to load
the VLC DLLs, then GetProcAddress to get the functions addresses. That
is not shown in the code to keep the example short. Also no exceptions
are checked in the example for the same reason.
Thanks for looking into this, its appreciated,
On Tue, Oct 27, 2009 at 7:48 AM, Pierre d'Herbemont <pdherbemont at free.fr> wrote:
> On Mon, Oct 26, 2009 at 5:42 PM, jboileau <jboileau at gmail.com> wrote:
>> I am using LibVLC in an application of my own under Win32. One problem
>> I have never been able to fix is a deadlock in
>> libvlc_media_player_stop if it is called too close to a
>> libvlc_media_player_play. The application hangs and pausing the
>> application in the development environment reveals that it is
>> deadlocked in the stop.
> Can you share with us a sample code that exhibit this bug?
>> My application cycles through surveillance cameras using a timer, but
>> on an emergency signal I must switch to a particular camera. As you
>> may deduce: a play may have just been started when such a signal is
>> received. Thus a stop may be very close to a play.
>> I guess, to the limit, this code should work and not hang once in a while:
>> libvlc_media_player_play(aLibVLCMediaPlayer, &lLibVLCException);
>> libvlc_media_player_stop(aLibVLCMediaPlayer, &lLibVLCException);
>> but it does at least 10% of the time for me. I have pasted below what
>> little stack trace info I get from Visual Studio after the stop is
>> called. What baffles me is that it seems to show that the stop calls
>> libvlc_media_get_user_data. Looking at the VLC source code I could not
>> find this. libvlc_media_player_stop does not seem to call
> The stack is then What version of libvlc/vlc are you using?
> This could be three things:
> - a bug in your program
> - a bug in libvlc
> - a bug in libvlccore
> We have to clear this out. And the way to clear that is to show that
> it is not in your program (ie - doing stuff in the handler
> synchronously where libvlc doesn't support it well). For that the
> sample test code would be great.
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel