summaryrefslogtreecommitdiff
path: root/client/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/decoder.cc')
-rw-r--r--client/decoder.cc35
1 files changed, 33 insertions, 2 deletions
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<NetworkSender*>::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<NetworkSender*>::iterator i;
for(i = senders.begin(); i != senders.end(); i++) {
NetworkSender *ns = *i;
s.queue_sizes.push_back(ns->queueSize());
}
+ sendersmutex.unlock();
return s;
}