aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-30 18:37:56 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-03-30 18:37:56 +0200
commit268b3c310d543f9129331a9b592099b42d814188 (patch)
treebb318feee35caaada48aa8c8b82fa08fc12d7918
parent35977fc2e90a7bf7aedd1c0be13f14289dd061df (diff)
downloadODR-AudioEnc-268b3c310d543f9129331a9b592099b42d814188.tar.gz
ODR-AudioEnc-268b3c310d543f9129331a9b592099b42d814188.tar.bz2
ODR-AudioEnc-268b3c310d543f9129331a9b592099b42d814188.zip
VLC: Add additional state check at startup
-rw-r--r--src/VLCInput.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp
index 7c782b0..687e144 100644
--- a/src/VLCInput.cpp
+++ b/src/VLCInput.cpp
@@ -114,7 +114,25 @@ int VLCInput::prepare()
libvlc_media_release(m);
// Start playing
- return libvlc_media_player_play(m_mp);
+ int ret = libvlc_media_player_play(m_mp);
+
+ if (ret == 0) {
+ libvlc_media_t *media = libvlc_media_player_get_media(m_mp);
+ libvlc_state_t st;
+
+ ret = -1;
+
+ for (int timeout = 0; timeout < 100; timeout++) {
+ st = libvlc_media_get_state(media);
+ boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ if (st != libvlc_NothingSpecial) {
+ ret = 0;
+ break;
+ }
+ }
+ }
+
+ return ret;
}
void VLCInput::preRender_cb(uint8_t** pp_pcm_buffer, size_t size)