From 11544ebe755cdcf345f53c581c2b1370ccd95e87 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 28 Jan 2014 11:24:53 +0000 Subject: [PATCH] Try to prevent windows machines going to sleep during encodes. --- ChangeLog | 4 ++++ src/lib/cross.cc | 8 ++++++++ src/lib/cross.h | 1 + src/lib/encoder.cc | 2 ++ 4 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 429a3f027..e5398c26f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-01-28 Carl Hetherington + + * Try to prevent Windows machines going to sleep during encodes. + 2014-01-26 Carl Hetherington * Change default JPEG2000 bandwith to 100MBps. diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 57b3f93b2..9f7a76124 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -298,3 +298,11 @@ dcpomatic_fseek (FILE* stream, int64_t offset, int whence) return fseek (stream, offset, whence); #endif } + +void +kick () +{ +#ifdef DCPOMATIC_WINDOWS + SetThreadExecutionState (ES_CONTINUOUS); +#endif +} diff --git a/src/lib/cross.h b/src/lib/cross.h index 7e032e5a1..822b36631 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -35,3 +35,4 @@ extern boost::filesystem::path app_contents (); #endif extern FILE * fopen_boost (boost::filesystem::path, std::string); extern int dcpomatic_fseek (FILE *, int64_t, int); +void kick (); diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index fbec3e4d0..92b4763be 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -180,6 +180,8 @@ Encoder::frame_done () void Encoder::process_video (shared_ptr image, Eyes eyes, ColourConversion conversion, bool same) { + kick (); + boost::mutex::scoped_lock lock (_mutex); /* XXX: discard 3D here if required */ -- 2.30.2