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

Allow access to netstream peer

parent 39c09095
Branches
No related tags found
1 merge request!212Major refactor of frame streaming
Pipeline #18185 passed
......@@ -56,6 +56,8 @@ class Net : public Stream {
bool end() override;
bool active() override;
inline const ftl::UUID &getPeer() const { return peer_; }
private:
SHARED_MUTEX mutex_;
bool active_;
......
......@@ -27,11 +27,14 @@ class Sender : public ftl::Configurable {
*/
void post(const ftl::rgbd::FrameSet &fs);
//void onStateChange(const std::function<void(ftl::codecs::Channel, int, int)>&);
private:
ftl::stream::Stream *stream_;
int64_t timestamp_;
SHARED_MUTEX mutex_;
std::atomic_flag do_inject_;
//std::function<void(ftl::codecs::Channel, int, int)> state_cb_;
std::unordered_map<int, ftl::codecs::Encoder*> encoders_;
......
......@@ -21,12 +21,19 @@ Sender::~Sender() {
// Delete all encoders
}
/*void Sender::onStateChange(const std::function<void(ftl::codecs::Channel,const ftl::rgbd::FrameState&)> &cb) {
if (cb && state_cb_) throw ftl::exception("State change callback already set");
state_cb_ = cb;
}*/
void Sender::setStream(ftl::stream::Stream*s) {
if (stream_) stream_->onPacket(nullptr);
stream_ = s;
stream_->onPacket([this](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
LOG(INFO) << "SENDER REQUEST : " << (int)spkt.channel;
//if (state_cb_) state_cb_(spkt.channel, spkt.streamID, spkt.frame_number);
// Inject state packets
//do_inject_ = true;
do_inject_.clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment