mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 17:58:29 +00:00
FIXED: Thread issue when Player exits.
This commit is contained in:
parent
8f1ba8bf21
commit
e6a3c5ced3
@ -228,11 +228,13 @@ void Player::ThreadLoop(){
|
||||
}else{
|
||||
// Buffer send to output
|
||||
boost::mutex::scoped_lock lock(this->mutex);
|
||||
this->bufferQueue.pop_front();
|
||||
if(!this->bufferQueue.empty()){
|
||||
this->bufferQueue.pop_front();
|
||||
|
||||
// Set currentPosition
|
||||
if(this->lockedBuffers.size()==1){
|
||||
this->currentPosition = buffer->Position();
|
||||
// Set currentPosition
|
||||
if(this->lockedBuffers.size()==1){
|
||||
this->currentPosition = buffer->Position();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -307,6 +309,13 @@ bool Player::Exited(){
|
||||
|
||||
void Player::ReleaseBuffer(IBuffer *buffer){
|
||||
boost::mutex::scoped_lock lock(this->mutex);
|
||||
|
||||
if( this->state==Player::Quit ){
|
||||
// Just in case that the stream and outputs have already been reset and output-plugin is still releasing buffers.
|
||||
this->waitCondition.notify_all();
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the buffer from lockedBuffers
|
||||
for(BufferList::iterator foundBuffer=this->lockedBuffers.begin();foundBuffer!=this->lockedBuffers.end();++foundBuffer){
|
||||
if(foundBuffer->get()==buffer){
|
||||
|
Loading…
Reference in New Issue
Block a user