Sometimes the call libvlc_media_player_stop()
function in GUI-thread leads to deadlocks. And it happens on an almost
empty application. There is only the main form with control (like a
panel), which carried the image output (assign through
libvlc_media_player_set_hwnd()). Timer periodically (every 5 seconds) is
called stop() and play(). No more functionality in that simple program.
If the mouse to click on the associated control, then hang appears
faster.
My solution is to call the stop() from the new thread and wait for its completion (via join ()). If the wait timeout set, before calling play(), you must ensure that the playing is done (check the return value of libvlc_media_player_get_state()). If you do call play() again, you will see a new window with video (as happens if you do not bind the output through libvlc_media_player_set_hwnd()).
Perhaps this message will be helpful.
My solution is to call the stop() from the new thread and wait for its completion (via join ()). If the wait timeout set, before calling play(), you must ensure that the playing is done (check the return value of libvlc_media_player_get_state()). If you do call play() again, you will see a new window with video (as happens if you do not bind the output through libvlc_media_player_set_hwnd()).
Perhaps this message will be helpful.
沒有留言:
張貼留言