X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fserver.cc;h=5598ef69f8388aae66098669ad9361e369691ab9;hb=0dc52cd6e69890cd8a2c539e80389ea8bac5cc3c;hp=66ee2b0e3cf2ca93eeb7512a03763c2598836dcc;hpb=f1d30fb114b3b2c6ccd8fdf5823e7cd6b26c1eef;p=dcpomatic.git diff --git a/src/lib/server.cc b/src/lib/server.cc index 66ee2b0e3..5598ef69f 100644 --- a/src/lib/server.cc +++ b/src/lib/server.cc @@ -34,10 +34,11 @@ #include "util.h" #include "scaler.h" #include "image.h" -#include "dcp_video_frame.h" +#include "dcp_video.h" #include "config.h" #include "cross.h" -#include "player_video_frame.h" +#include "player_video.h" +#include "encoded_data.h" #include "i18n.h" @@ -79,7 +80,7 @@ Server::~Server () { boost::mutex::scoped_lock lm (_worker_mutex); _terminate = true; - _worker_condition.notify_all (); + _empty_condition.notify_all (); } for (vector::iterator i = _worker_threads.begin(); i != _worker_threads.end(); ++i) { @@ -112,9 +113,9 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t return -1; } - shared_ptr pvf (new PlayerVideoFrame (xml, socket, _log)); + shared_ptr pvf (new PlayerVideo (xml, socket, _log)); - DCPVideoFrame dcp_video_frame (pvf, xml, _log); + DCPVideo dcp_video_frame (pvf, xml, _log); gettimeofday (&after_read, 0); @@ -136,10 +137,10 @@ Server::process (shared_ptr socket, struct timeval& after_read, struct t void Server::worker_thread () { - while (1) { + while (true) { boost::mutex::scoped_lock lock (_worker_mutex); while (_queue.empty () && !_terminate) { - _worker_condition.wait (lock); + _empty_condition.wait (lock); } if (_terminate) { @@ -194,7 +195,7 @@ Server::worker_thread () LOG_GENERAL_NC (message.str ()); } - _worker_condition.notify_all (); + _full_condition.notify_all (); } } @@ -291,11 +292,11 @@ Server::handle_accept (shared_ptr socket, boost::system::error_code cons /* Wait until the queue has gone down a bit */ while (_queue.size() >= _worker_threads.size() * 2 && !_terminate) { - _worker_condition.wait (lock); + _full_condition.wait (lock); } _queue.push_back (socket); - _worker_condition.notify_all (); + _empty_condition.notify_all (); start_accept (); }