multiplex: Add new handler types to reception_flow

This commit is contained in:
Heikki Tampio 2023-06-14 14:04:50 +03:00
parent dafad6cfd8
commit 00823467b3
2 changed files with 18 additions and 3 deletions

View File

@ -697,14 +697,13 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
UVG_LOG_INFO("Holepuncher packet");
//break;
}
/* -------------------- User packet -------------------------------- */
/* THIS IS WRONG, BECAUSE USER PACKETS DONT HAVE SSRC!! fix
else {
// TODO: Add functionality
UVG_LOG_INFO("User packet");
//break;
}
*/
// Here we don't lock ring mutex because the chaging is only done above.
// NOTE: If there is a need for multiple processing threads, the read should be guarded
switch ((ret = (*handler.second.primary)(ring_buffer_[ring_read_index_].read,

View File

@ -60,6 +60,14 @@ namespace uvgrtp {
std::vector<auxiliary_handler_cpp> auxiliary_cpp;
};
// -----------new packet handlers
typedef rtp_error_t(*packet_handler_new)(void*, int, uint8_t*, size_t);
struct handler_new {
packet_handler_new handler = nullptr;
std::function<rtp_error_t(uvgrtp::frame::rtp_frame ** out)> getter;
};
/* This class handles the reception processing of received RTP packets. It
* utilizes function dispatching to other classes to achieve this.
@ -262,6 +270,14 @@ namespace uvgrtp {
//void* user_hook_arg_;
//void (*user_hook_)(void* arg, uint8_t* payload);
// Map different types of handlers by remote SSRCs
std::map<std::shared_ptr<std::atomic<std::uint32_t>>, handler_new> rtcp_handlers_;
std::map<std::shared_ptr<std::atomic<std::uint32_t>>, handler_new> zrtp_handlers_;
std::map<std::shared_ptr<std::atomic<std::uint32_t>>, handler_new> rtp_handlers_;
std::map<std::shared_ptr<std::atomic<std::uint32_t>>, handler_new> srtp_handlers_;
std::map<std::shared_ptr<std::atomic<std::uint32_t>>, handler_new> srtcp_handlers_;
std::vector<Buffer> ring_buffer_;
std::mutex ring_mutex_;
// these uphold the ring buffer details