Restore lock stream datas

This commit is contained in:
John Zhao 2018-06-01 16:50:15 +08:00
parent 9c20d62763
commit 7451b6417d
2 changed files with 13 additions and 5 deletions

View File

@ -351,12 +351,14 @@ void Device::WaitForStreams() {
std::vector<device::StreamData> Device::GetStreamDatas(const Stream &stream) {
CHECK(video_streaming_);
CHECK_NOTNULL(streams_);
std::lock_guard<std::mutex> _(mtx_streams_);
return streams_->GetStreamDatas(stream);
}
device::StreamData Device::GetLatestStreamData(const Stream &stream) {
CHECK(video_streaming_);
CHECK_NOTNULL(streams_);
std::lock_guard<std::mutex> _(mtx_streams_);
return streams_->GetLatestStreamData(stream);
}
@ -424,10 +426,13 @@ void Device::StartVideoStreaming() {
return;
}
// auto &&time_beg = times::now();
{
std::lock_guard<std::mutex> _(mtx_streams_);
if (streams_->PushStream(Capabilities::STEREO, data)) {
CallbackPushedStreamData(Stream::LEFT);
CallbackPushedStreamData(Stream::RIGHT);
}
}
continuation();
// VLOG(2) << "Stereo video callback cost "
// << times::count<times::milliseconds>(times::now() - time_beg)

View File

@ -18,6 +18,7 @@
#include <limits>
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
@ -272,6 +273,8 @@ class MYNTEYE_API Device {
std::map<Capabilities, StreamRequest> stream_config_requests_;
std::mutex mtx_streams_;
std::shared_ptr<Channels> channels_;
std::shared_ptr<Motions> motions_;