From d86028ba3e6c0db3c1f56077f481b3bebf883d86 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 25 May 2006 18:18:48 +0000 Subject: *** empty log message *** --- client/decoder.cc | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'client/decoder.cc') diff --git a/client/decoder.cc b/client/decoder.cc index c5b2876..d8bf430 100644 --- a/client/decoder.cc +++ b/client/decoder.cc @@ -81,12 +81,25 @@ void Decoder::run() if(MIaV::control.isRecording()) { if(newconnection) { NetworkSender *sender = new NetworkSender(MIaV::control.getCpr()); + + sendersmutex.lock(); senders.push_back(sender); + sendersmutex.unlock(); + sender->start(); newconnection = false; } - senders.back()->pushFrame(frame, false, false); + + sendersmutex.lock(); + if(senders.isEmpty() == false) + senders.back()->pushFrame(frame, + MIaV::control.isFrozen(), + false); + sendersmutex.unlock(); + } else { + + sendersmutex.lock(); // Remove idle senders QLinkedList::iterator i; for (i = senders.begin(); i != senders.end(); i++) { @@ -97,6 +110,8 @@ void Decoder::run() delete ns; } } + sendersmutex.unlock(); + free(frame); newconnection = true; @@ -107,7 +122,7 @@ void Decoder::run() char *Decoder::pframeAcquire() { - pmutex.lock(); + pmutex.lock();; return pframe; } @@ -145,11 +160,27 @@ Status Decoder::status() { Status s; + s.server_diskspace = 0xffffffff; + s.server_diskspace_max = 0xffffffff; + s.server_load = 0xffffffff; + s.server_load_max = 0xffffffff; + s.server_ping_ms = 0xffffffff; + s.server_fps = -1.0; + + sendersmutex.lock(); + // Get the server disk status etc. + if(senders.isEmpty() == false) senders.back()->getServerStatus(&s); + + fprintf(stderr, "Load: %d of %d - ", s.server_load, s.server_load_max); + fprintf(stderr, "Space: %d of %d\n", s.server_diskspace, s.server_diskspace_max); + + // Read out the queue sizes QLinkedList::iterator i; for(i = senders.begin(); i != senders.end(); i++) { NetworkSender *ns = *i; s.queue_sizes.push_back(ns->queueSize()); } + sendersmutex.unlock(); return s; } -- cgit v1.2.3