diff --git a/applications/tools/simple_viewer/main.cpp b/applications/tools/simple_viewer/main.cpp index ba8f1435cbeb09d5cdb4ace3764d22da69a3da87..2710530cc35894d59f29485071f424d931f3ccb8 100644 --- a/applications/tools/simple_viewer/main.cpp +++ b/applications/tools/simple_viewer/main.cpp @@ -118,23 +118,19 @@ static void run(ftl::Configurable *root) { ftl::stream::Receiver *gen = ftl::create<ftl::stream::Receiver>(root, "receiver", &pool); gen->setStream(stream); - //sender->onRequest([stream](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { - // if (spkt.channel == Channel::Colour) { - // stream->reset(); - // } - //}); - int count = 0; for (auto &s : stream_uris) { LOG(INFO) << " --- found stream: " << s; auto *nstream = ftl::create<ftl::stream::Net>(stream, std::string("netstream")+std::to_string(count), net); nstream->set("uri", s); + //nstream->select(0, {Channel::Colour}, true); stream->add(nstream); ++count; } generators.push_back(gen); stream->begin(); + stream->select(0, Channel::Colour + Channel::Depth, true); } for (auto *g : generators) { diff --git a/components/streams/src/netstream.cpp b/components/streams/src/netstream.cpp index 9e0f1f48b664de45b3a48b127628fc889ef0c581..31cc9ddc050e5054431fccbc16688514a560c2fa 100644 --- a/components/streams/src/netstream.cpp +++ b/components/streams/src/netstream.cpp @@ -63,10 +63,11 @@ bool Net::post(const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet // Check if the channel has been requested recently enough. If not then disable it. if (host_ && pkt.data.size() > 0 && spkt.frame_number == 0 && static_cast<int>(spkt.channel) >= 0 && static_cast<int>(spkt.channel) < 32) { if (reqtally_[static_cast<int>(spkt.channel)] == 0) { + --reqtally_[static_cast<int>(spkt.channel)]; auto sel = selected(0); sel -= spkt.channel; select(0, sel); - LOG(INFO) << "Unselect Channel: " << (int)spkt.channel; + LOG(INFO) << "Unselect Channel: " << (int)spkt.channel << " (" << (int)spkt.streamID << ")"; } else { --reqtally_[static_cast<int>(spkt.channel)]; } @@ -185,9 +186,10 @@ bool Net::begin() { if (tally_ <= 5) { // Yes, so send new requests if (size() > 0) { - auto sel = selected(0); + const auto &sel = selected(0); for (auto c : sel) { + LOG(INFO) << "DO I SEND REQ"; _sendRequest(c, kAllFramesets, kAllFrames, 30, 0); } } @@ -213,6 +215,7 @@ bool Net::begin() { } else { select(spkt.frameSetID(), selected(spkt.frameSetID()) + spkt.channel); } + LOG(INFO) << "GOT REQUEST"; _processRequest(p, pkt); } else { // FIXME: Allow availability to change... @@ -266,7 +269,7 @@ void Net::reset() { bool Net::_sendRequest(Channel c, uint8_t frameset, uint8_t frames, uint8_t count, uint8_t bitrate) { if (!active_ || host_) return false; - //LOG(INFO) << "SENDING REQUEST FOR " << (int)c; + LOG(INFO) << "SENDING REQUEST FOR " << (int)c; Packet pkt = { codec_t::Any, // TODO: Allow specific codec requests