projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to prevent OS X from sleeping during DCP encode.
[dcpomatic.git]
/
src
/
lib
/
encoder.cc
diff --git
a/src/lib/encoder.cc
b/src/lib/encoder.cc
index ca75e4ca1caa7a0c93088f5e2470e3990755a92f..73af11c55d2889412b232f80656cf2a72aa4e6ed 100644
(file)
--- a/
src/lib/encoder.cc
+++ b/
src/lib/encoder.cc
@@
-68,9
+68,6
@@
Encoder::Encoder (shared_ptr<const Film> f, weak_ptr<Job> j)
Encoder::~Encoder ()
{
terminate_threads ();
Encoder::~Encoder ()
{
terminate_threads ();
- if (_writer) {
- _writer->finish ();
- }
}
/** Add a worker thread for a each thread on a remote server. Caller must hold
}
/** Add a worker thread for a each thread on a remote server. Caller must hold
@@
-96,7
+93,6
@@
Encoder::process_begin ()
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
-
void
Encoder::process_end ()
{
void
Encoder::process_end ()
{
@@
-184,6
+180,8
@@
Encoder::frame_done ()
void
Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, bool same)
{
void
Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversion conversion, bool same)
{
+ _waker.nudge ();
+
boost::mutex::scoped_lock lock (_mutex);
/* XXX: discard 3D here if required */
boost::mutex::scoped_lock lock (_mutex);
/* XXX: discard 3D here if required */
@@
-200,6
+198,11
@@
Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversi
}
_writer->rethrow ();
}
_writer->rethrow ();
+ /* Re-throw any exception raised by one of our threads. If more
+ than one has thrown an exception, only one will be rethrown, I think;
+ but then, if that happens something has gone badly wrong.
+ */
+ rethrow ();
if (_writer->can_fake_write (_video_frames_out)) {
_writer->fake_write (_video_frames_out, eyes);
if (_writer->can_fake_write (_video_frames_out)) {
_writer->fake_write (_video_frames_out, eyes);
@@
-255,6
+258,7
@@
Encoder::terminate_threads ()
void
Encoder::encoder_thread (optional<ServerDescription> server)
void
Encoder::encoder_thread (optional<ServerDescription> server)
+try
{
/* Number of seconds that we currently wait between attempts
to connect to the server; not relevant for localhost
{
/* Number of seconds that we currently wait between attempts
to connect to the server; not relevant for localhost
@@
-336,6
+340,10
@@
Encoder::encoder_thread (optional<ServerDescription> server)
_condition.notify_all ();
}
}
_condition.notify_all ();
}
}
+catch (...)
+{
+ store_current ();
+}
void
Encoder::server_found (ServerDescription s)
void
Encoder::server_found (ServerDescription s)