summaryrefslogtreecommitdiff
path: root/src/lib/encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-12-30 23:01:54 +0000
committerCarl Hetherington <cth@carlh.net>2013-12-30 23:01:54 +0000
commitf87a0f16f8cee026ee33c3a46b93b43d4b3cf5ff (patch)
tree4b51832a916d6b45468113dd05bf59f6342464a7 /src/lib/encoder.cc
parentf74cd31aa1b14816716ee1ffc59e99d4cc350dd5 (diff)
Catch exceptions from Encoder threads.
Diffstat (limited to 'src/lib/encoder.cc')
-rw-r--r--src/lib/encoder.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index ca75e4ca1..b78bcaeea 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -96,7 +96,6 @@ Encoder::process_begin ()
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
-
void
Encoder::process_end ()
{
@@ -200,6 +199,11 @@ Encoder::process_video (shared_ptr<PlayerImage> image, Eyes eyes, ColourConversi
}
_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);
@@ -255,6 +259,7 @@ Encoder::terminate_threads ()
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
@@ -336,6 +341,10 @@ Encoder::encoder_thread (optional<ServerDescription> server)
_condition.notify_all ();
}
}
+catch (...)
+{
+ store_current ();
+}
void
Encoder::server_found (ServerDescription s)