diff options
author | deva <deva> | 2005-04-28 18:11:58 +0000 |
---|---|---|
committer | deva <deva> | 2005-04-28 18:11:58 +0000 |
commit | a420994fe53199747e6d0ba0af473ecc4f940258 (patch) | |
tree | e00c5233f66e6dfc2964e203bc6529fea9374626 /src/encoder.cc | |
parent | 5c756301afdcad05d3b880544b3ea88e50986e21 (diff) |
Moved mutex into queue (made it thread safe), to avoid mutex locking in player, encoder and decoder.
Diffstat (limited to 'src/encoder.cc')
-rw-r--r-- | src/encoder.cc | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/encoder.cc b/src/encoder.cc index 878c97d..52a7f93 100644 --- a/src/encoder.cc +++ b/src/encoder.cc @@ -73,12 +73,9 @@ void Encoder::encode() while(*running) { sem_wait(sem); - pthread_mutex_lock(mutex); frame = queue->pop(); - // queue->plength(); - // pthread_mutex_unlock(mutex); - while(frame) { + if(frame) { if(record || (freeze_request != freeze_value) || (shoot_request != shoot_value)) { @@ -97,12 +94,7 @@ void Encoder::encode() n->sendPackage(&h, frame->data, frame->size); } if(frame) delete frame; - - // pthread_mutex_lock(mutex); - frame = queue->pop(); - // queue->plength(); } - pthread_mutex_unlock(mutex); } } |