comparison liboggplayer-src/src/oggplayer.cpp @ 59:3eacedd172ab

Fence some lingering audio code, based on fixes from visy.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Aug 2013 23:27:37 +0300
parents 105513a2e3c9
children 9c63b355c82b
comparison
equal deleted inserted replaced
58:1099b8eb152a 59:3eacedd172ab
59 bool OggPlayer::playing() { 59 bool OggPlayer::playing() {
60 return imp->playing; 60 return imp->playing;
61 } 61 }
62 62
63 63
64 #ifdef VORBIS_SUPPORT
64 int OggPlayer::audio_read(char* buf, unsigned int size) { 65 int OggPlayer::audio_read(char* buf, unsigned int size) {
65 if(NULL==buf || !imp->vorbis_p || !playing() || !imp->ready()) return 0; 66 if(NULL==buf || !imp->vorbis_p || !playing() || !imp->ready()) return 0;
66 boost::unique_lock<boost::mutex> lock(imp->audio_mut); 67 boost::unique_lock<boost::mutex> lock(imp->audio_mut);
67 68
68 while ((imp->cirbuf.size() < size) && playing()) { 69 while ((imp->cirbuf.size() < size) && playing()) {
80 } 81 }
81 imp->audio_bytes_played+=k; 82 imp->audio_bytes_played+=k;
82 83
83 return k; 84 return k;
84 } 85 }
86 #endif
85 87
86 bool OggPlayer::yuv_buffer_try_lock(YUVBuffer *buffer) { 88 bool OggPlayer::yuv_buffer_try_lock(YUVBuffer *buffer) {
87 if (!playing() || !imp->theora_p || !imp->ready()) 89 if (!playing() || !imp->theora_p || !imp->ready())
88 return false; 90 return false;
89 // no new data, no reason to lock 91 // no new data, no reason to lock