Add async callback support

This commit is contained in:
John Zhao
2018-05-31 15:39:42 +08:00
parent 425b181216
commit 7e55f78418
6 changed files with 203 additions and 23 deletions

View File

@@ -104,14 +104,16 @@ void Synthetic::StartVideoStreaming() {
if (it->second == MODE_NATIVE) {
auto &&stream = it->first;
device->SetStreamCallback(
stream, [this, stream](const device::StreamData &data) {
stream,
[this, stream](const device::StreamData &data) {
auto &&stream_data = data2api(data);
ProcessNativeStream(stream, stream_data);
// Need mutex if set callback after start
if (HasStreamCallback(stream)) {
stream_callbacks_.at(stream)(stream_data);
}
});
},
true);
}
}
device->Start(Source::VIDEO_STREAMING);