Encoder::~Encoder ()
{
terminate_threads ();
- if (_writer) {
- _writer->finish ();
- }
}
/** Add a worker thread for a each thread on a remote server. Caller must hold
ServerFinder::instance()->connect (boost::bind (&Encoder::server_found, this, _1));
}
-
void
Encoder::process_end ()
{
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 */
return;
}
- if (_writer->thrown ()) {
- _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);
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
_condition.notify_all ();
}
}
+catch (...)
+{
+ store_current ();
+}
void
Encoder::server_found (ServerDescription s)