[Resolved]IO Thread about libVLC.
Posted: 25 Mar 2016 08:38
Hi:
I have some question about thread of libVLC.
I'm using video callback to display Video(xZune.Vlc).
I think libVLC works on multi-thread, decode thread, IO thread or other threads.
But the file IO is not seem in background thread.
It is like:
01.I create a Window running on Main UI thread(ID:1).
02.I create display control in this window, which runs on a new UI thread(ID:2).
03.I create VlcMediaPlayer and VlcMeida on thread(ID:2).
04.I set video callback of Player, it runs on a background thread(ID:3) which distribute by VLC.
05.When video display data updates(in video callback, lock, unlock and display) on thread(ID:3), it will update display control, the update happens on thread(ID:2).
06.User update the main UI which's in thread(ID:1).
07.But the UI updating costs too much time, thread(ID:1) is stuck.
08.The video then pause about 500 ms later.
09.After thread(ID:1) restores, the video may display many gray blocks.
Why I think it maybe file IO problem?
01.Gray block usually appears while playing a Internet stream when network connection is not stable.
02.While the video callback goes on(thread ID 3), but the video is not playing.
So, I want to know how libVLC works with threads. How many threads it works with? Why does VLC use the main thread(ID:1)? I create it on thread(ID:2).
--------------------
BTW, about another issue of libVLC. I am not sure it is a issue of libVLC.
Some people tell to me that some AccessViolationException is thrown when set a VlcMedia to VlcMediaPlayer(libvlc_media_player_set_media function).
I run the same code, same video, same libVLC on my PC, but it work fine.
I am using Windows 10, but he using Windows 7. I am not sure this is the reason.
Note:
When you attempted to read or write protected memory. AccessViolationException will be thrown. This is often an indication that other memory in corrupt.
Thanks for any advice.
I have some question about thread of libVLC.
I'm using video callback to display Video(xZune.Vlc).
I think libVLC works on multi-thread, decode thread, IO thread or other threads.
But the file IO is not seem in background thread.
It is like:
01.I create a Window running on Main UI thread(ID:1).
02.I create display control in this window, which runs on a new UI thread(ID:2).
03.I create VlcMediaPlayer and VlcMeida on thread(ID:2).
04.I set video callback of Player, it runs on a background thread(ID:3) which distribute by VLC.
05.When video display data updates(in video callback, lock, unlock and display) on thread(ID:3), it will update display control, the update happens on thread(ID:2).
06.User update the main UI which's in thread(ID:1).
07.But the UI updating costs too much time, thread(ID:1) is stuck.
08.The video then pause about 500 ms later.
09.After thread(ID:1) restores, the video may display many gray blocks.
Why I think it maybe file IO problem?
01.Gray block usually appears while playing a Internet stream when network connection is not stable.
02.While the video callback goes on(thread ID 3), but the video is not playing.
So, I want to know how libVLC works with threads. How many threads it works with? Why does VLC use the main thread(ID:1)? I create it on thread(ID:2).
--------------------
BTW, about another issue of libVLC. I am not sure it is a issue of libVLC.
Some people tell to me that some AccessViolationException is thrown when set a VlcMedia to VlcMediaPlayer(libvlc_media_player_set_media function).
I run the same code, same video, same libVLC on my PC, but it work fine.
I am using Windows 10, but he using Windows 7. I am not sure this is the reason.
Note:
When you attempted to read or write protected memory. AccessViolationException will be thrown. This is often an indication that other memory in corrupt.
Thanks for any advice.