X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fencoder.cc;h=0c41d8d806a8ec9bf627a54b2ac579315edab074;hb=57d00c880094b1dfebaee18f4ecafb1dd44b0afb;hp=cc2deaa9387333b2efbc9a3ed965611fb998c416;hpb=a07b5d79f2ac072d550ccb5587fe527c5340e248;p=dcpomatic.git diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index cc2deaa93..0c41d8d80 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -78,12 +78,10 @@ Encoder::~Encoder () void Encoder::begin () { - if (!EncodeServerFinder::instance()->disabled ()) { - weak_ptr wp = shared_from_this (); - _server_found_connection = EncodeServerFinder::instance()->ServersListChanged.connect ( - boost::bind (&Encoder::call_servers_list_changed, wp) - ); - } + weak_ptr wp = shared_from_this (); + _server_found_connection = EncodeServerFinder::instance()->ServersListChanged.connect ( + boost::bind (&Encoder::call_servers_list_changed, wp) + ); } /* We don't want the servers-list-changed callback trying to do things @@ -207,11 +205,13 @@ Encoder::encode (shared_ptr pv) boost::mutex::scoped_lock queue_lock (_queue_mutex); - /* Wait until the queue has gone down a bit */ - while (_queue.size() >= threads * 2) { - LOG_TIMING ("decoder-sleep queue=%1", _queue.size()); + /* Wait until the queue has gone down a bit. Allow one thing in the queue even + when there are no threads. + */ + while (_queue.size() >= (threads * 2) + 1) { + LOG_TIMING ("decoder-sleep queue=%1 threads=%2", _queue.size(), threads); _full_condition.wait (queue_lock); - LOG_TIMING ("decoder-wake queue=%1", _queue.size()); + LOG_TIMING ("decoder-wake queue=%1 threads=%2", _queue.size(), threads); } _writer->rethrow ();