|
1 | 1 | /*********************************************************************/
|
2 |
| -/* Copyright (c) 2015-2016, EPFL/Blue Brain Project */ |
3 |
| -/* Daniel.Nachbaur <[email protected]> */ |
4 |
| -/* Raphael Dumusc <[email protected]> */ |
| 2 | +/* Copyright (c) 2015-2018, EPFL/Blue Brain Project */ |
| 3 | +/* Daniel.Nachbaur <[email protected]>*/ |
| 4 | +/* Raphael Dumusc <[email protected]> */ |
5 | 5 | /* All rights reserved. */
|
6 | 6 | /* */
|
7 | 7 | /* Redistribution and use in source and binary forms, with or */
|
@@ -105,10 +105,18 @@ void QmlStreamer::Impl::_afterRender(const QImage image)
|
105 | 105 | if (!_sendFuture.valid() || !_sendFuture.get())
|
106 | 106 | return;
|
107 | 107 |
|
108 |
| - if (!_stream && !_setupDeflectStream()) |
| 108 | + if (!_stream) |
109 | 109 | {
|
110 |
| - qWarning() << "Could not setup Deflect stream"; |
111 |
| - return; |
| 110 | + try |
| 111 | + { |
| 112 | + _setupDeflectStream(); |
| 113 | + } |
| 114 | + catch (const std::runtime_error& e) |
| 115 | + { |
| 116 | + qWarning() << e.what(); |
| 117 | + _onStreamClosed(); |
| 118 | + return; |
| 119 | + } |
112 | 120 | }
|
113 | 121 |
|
114 | 122 | if (image.isNull())
|
@@ -248,16 +256,13 @@ std::string QmlStreamer::Impl::_getDeflectStreamIdentifier() const
|
248 | 256 | return streamId.empty() ? DEFAULT_STREAM_ID : streamId;
|
249 | 257 | }
|
250 | 258 |
|
251 |
| -bool QmlStreamer::Impl::_setupDeflectStream() |
| 259 | +void QmlStreamer::Impl::_setupDeflectStream() |
252 | 260 | {
|
253 | 261 | if (!_stream)
|
254 | 262 | _stream.reset(new Stream(_getDeflectStreamIdentifier(), _streamHost));
|
255 | 263 |
|
256 |
| - if (!_stream->isConnected()) |
257 |
| - return false; |
258 |
| - |
259 | 264 | if (!_stream->registerForEvents())
|
260 |
| - return false; |
| 265 | + throw std::runtime_error("Stream failed to register for events"); |
261 | 266 |
|
262 | 267 | if (_sizeHints != SizeHints())
|
263 | 268 | _stream->sendSizeHints(_sizeHints);
|
@@ -297,8 +302,6 @@ bool QmlStreamer::Impl::_setupDeflectStream()
|
297 | 302 |
|
298 | 303 | connect(_eventReceiver.get(), &EventReceiver::closed, this,
|
299 | 304 | &QmlStreamer::Impl::_onStreamClosed);
|
300 |
| - |
301 |
| - return true; |
302 | 305 | }
|
303 | 306 |
|
304 | 307 | void QmlStreamer::Impl::_connectTouchInjector()
|
|
0 commit comments