Skip to content
Snippets Groups Projects
Commit e664901c authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Request more frames, allow reconnects

parent 07197633
Branches main
No related tags found
1 merge request!17Implements #49 RGBD Streamer
Pipeline #11106 failed
......@@ -56,7 +56,7 @@ NetSource::NetSource(nlohmann::json &config, ftl::net::Universe *net)
_recv(jpg, d);
});
N_ = 0;
N_ = 10;
// Initiate stream with request for first 10 frames
net->send(peer_, "get_stream", getURI(), 10, 0, net->id(), getURI());
......@@ -72,10 +72,10 @@ void NetSource::_recv(const vector<unsigned char> &jpg, const vector<unsigned ch
cv::imdecode(d, cv::IMREAD_UNCHANGED, &depth_);
depth_.convertTo(depth_, CV_32FC1, 1.0f/(16.0f*100.0f));
N_++;
if (N_ == 10) {
N_ = 0;
//net->send(peer_, "get_stream", getURI(), 10, 0, net->id(), getURI());
N_--;
if (N_ == 0) {
N_ += 10;
net_->send(peer_, "get_stream", getURI(), 10, 0, net_->id(), getURI());
}
}
......
......@@ -145,7 +145,7 @@ void Streamer::_schedule() {
continue;
}
if (s.second->clients[0].size() == 0) {
LOG(ERROR) << "Stream has no clients: " << uri;
//LOG(ERROR) << "Stream has no clients: " << uri;
continue;
}
slk.unlock();
......@@ -176,9 +176,13 @@ void Streamer::_schedule() {
auto i = src->clients[0].begin();
while (i != src->clients[0].end()) {
try {
net_->send((*i).peerid, (*i).uri, rgb_buf, d_buf);
} catch(...) {
(*i).txcount = (*i).txmax;
}
(*i).txcount++;
if ((*i).txcount == (*i).txmax) {
if ((*i).txcount >= (*i).txmax) {
LOG(INFO) << "Remove client";
i = src->clients[0].erase(i);
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment