Skip to content

Commit b1e3359

Browse files
Stefan EilemannStefan Eilemann
authored andcommitted
CR #153
1 parent 2db7e93 commit b1e3359

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

deflect/ReceiveBuffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class ReceiveBuffer
6565
* Add a source of segments.
6666
* @param sourceIndex Unique source identifier
6767
* @return false if the source was already added or if
68-
* finishFrameForSource()
69-
* has already been called for all existing source (TODO DISCL-241).
68+
* finishFrameForSource() has already been called for all existing
69+
* source (TODO DISCL-241).
7070
*/
7171
DEFLECT_API bool addSource(size_t sourceIndex);
7272

deflect/Stream.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Stream
127127
* @param image The image to send. Note that the image is not copied, so the
128128
* referenced must remain valid until the send is finished.
129129
* @return true if the image data could be sent, false otherwise
130-
* @version 1.0
130+
* @version 1.6
131131
* @sa finishFrame()
132132
*/
133133
DEFLECT_API Future send(const ImageWrapper& image);
@@ -142,7 +142,7 @@ class Stream
142142
* stereo rendering.
143143
*
144144
* @sa send()
145-
* @version 1.0
145+
* @version 1.6
146146
*/
147147
DEFLECT_API Future finishFrame();
148148

@@ -157,7 +157,7 @@ class Stream
157157
* referenced must remain valid until the send is finished
158158
* @return true if the image data could be sent, false otherwise.
159159
* @see send()
160-
* @version 1.1
160+
* @version 1.6
161161
*/
162162
DEFLECT_API Future sendAndFinish(const ImageWrapper& image);
163163

doc/Changelog.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ Changelog {#Changelog}
1010
skipping the YUV -> RGB conversion step.
1111
Additionally, Stream images can be further compressed using optional
1212
[chroma subsampling](ChromaSubsampling.md).
13-
* [152](https://github.com/BlueBrain/Deflect/pull/152):
14-
Changed coding style of the project to conform to new .clang-format rules.
15-
* [148](https://github.com/BlueBrain/Deflect/pull/148):
13+
* [148](https://github.com/BlueBrain/Deflect/pull/148),
14+
[153](https://github.com/BlueBrain/Deflect/pull/153):
1615
Support for streaming stereo 3D content in a frame-sequential manner.
1716

1817
## Deflect 0.12

doc/StereoStreaming.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ New view enum in deflect/types.h:
2121
The ImageWrapper takes an additional View parameter.
2222

2323
API changes to the Stream class:
24-
* asyncSend is deprecated but work as before, but only for mono views
24+
* asyncSend is renamed to sendAndFinish, asyncSend forwards and is deprecated
2525
* send and finish are now asynchronous and return a future instead of bool
2626

2727
The send operation sends one tile of one eye pass to the server. The finishFrame
@@ -31,8 +31,8 @@ finishFrame is analogous to a swap buffer call, with the extension that all
3131
client's finish is synchronized by the server.
3232

3333
On the server side, no changes to the Server API (except some cleanups). Each
34-
Frame dispatched now contains the View information. A frame is considered
35-
complete when all connected clients did send a finish.
34+
Segment dispatched now with a Frame contains the View information. A frame is
35+
considered complete when all connected clients have send a finish.
3636

3737

3838
## Protocol
@@ -54,15 +54,15 @@ Example of a stereo 3D client application using synchronous operations:
5454

5555
deflect::ImageWrapper leftImage( data, width, height, deflect::RGBA );
5656
leftImage.view = deflect::View::left_eye;
57-
deflectStream->send( leftImage );
57+
deflectStream->send( leftImage ).wait();
5858

5959
/** ...render right image... */
6060

6161
deflect::ImageWrapper rightImage( data, width, height, deflect::RGBA );
6262
rightImage.view = deflect::View::right_eye;
63-
deflectStream->send( rightImage );
63+
deflectStream->send( rightImage ).wait();
6464

65-
deflectStream->finishFrame();
65+
deflectStream->finishFrame().wait();
6666

6767
/** ...synchronize with other render clients (network barrier)... */
6868
}
@@ -72,25 +72,27 @@ Example of a stereo 3D client application using the asynchronous operations:
7272
deflect::Stream stream( ... );
7373

7474
/** ...synchronize start with other render clients (network barrier)... */
75-
75+
std::vector< std::future< bool >> futures;
7676
renderLoop()
7777
{
78-
if( !leftFuture.valid() || !leftFuture.get( ))
79-
return;
78+
for( auto& future : futures )
79+
if( !future.get( ))
80+
return;
81+
futures.clear();
8082

8183
/** ...render left image... */
8284

8385
deflect::ImageWrapper leftImage( leftData, width, height, deflect::RGBA );
8486
leftImage.view = deflect::View::left_eye;
85-
auto leftFuture = deflectStream->send( leftImage );
87+
futures.emplace_back( deflectStream->send( leftImage ));
8688

8789
/** ...render right image... */
8890

8991
deflect::ImageWrapper rightImage( rightData, width, height, deflect::RGBA );
9092
rightImage.view = deflect::View::right_eye;
91-
auto rightFuture = deflectStream->send( rightImage );
93+
futures.emplace_back( deflectStream->send( rightImage ));
9294

93-
deflectStream->finishFrame();
95+
futures.emplace_back( deflectStream->finishFrame( ));
9496

9597
/** ...synchronize with other render clients (network barrier)... */
9698
}

tests/cpp/perf/benchmarkStreamer.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ class Application
241241
_noiseImage.height(), deflect::RGBA);
242242
deflectImage.compressionPolicy = deflect::COMPRESSION_OFF;
243243

244-
return _stream->send(deflectImage).get() &&
245-
_stream->finishFrame().get();
244+
return _stream->sendAndFinish(deflectImage).get();
246245
}
247246

248247
bool sendJpeg()
@@ -253,8 +252,7 @@ class Application
253252
deflectImage.compressionPolicy = deflect::COMPRESSION_ON;
254253
deflectImage.compressionQuality = _options.quality;
255254

256-
return _stream->send(deflectImage).get() &&
257-
_stream->finishFrame().get();
255+
return _stream->sendAndFinish(deflectImage).get();
258256
}
259257

260258
bool sendPrecompressedJpeg()

0 commit comments

Comments
 (0)