diff --git a/include/formats/hevc.hh b/include/formats/hevc.hh index 5fe101f..e7dc1ca 100644 --- a/include/formats/hevc.hh +++ b/include/formats/hevc.hh @@ -33,7 +33,7 @@ namespace uvg_rtp { * Return RTP_PKT_NOT_HANDLED if the packet is not handled by this handler * Return RTP_PKT_MODIFIED if the packet was modified but should be forwarded to other handlers * Return RTP_GENERIC_ERROR if the packet was corrupted in some way */ - static rtp_error_t packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out); + static rtp_error_t packet_handler(ssize_t size, void *packet, int flags, frame::rtp_frame **out); protected: rtp_error_t __push_frame(uint8_t *data, size_t data_len, int flags); diff --git a/include/formats/media.hh b/include/formats/media.hh index 177ec86..01407f4 100644 --- a/include/formats/media.hh +++ b/include/formats/media.hh @@ -33,7 +33,7 @@ namespace uvg_rtp { * Return RTP_PKT_NOT_HANDLED if the packet is not handled by this handler * Return RTP_PKT_MODIFIED if the packet was modified but should be forwarded to other handlers * Return RTP_GENERIC_ERROR if the packet was corrupted in some way */ - static rtp_error_t packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out); + static rtp_error_t packet_handler(ssize_t size, void *packet, int flags, frame::rtp_frame **out); protected: virtual rtp_error_t __push_frame(uint8_t *data, size_t data_len, int flags); diff --git a/include/pkt_dispatch.hh b/include/pkt_dispatch.hh index add40ff..7ac83e4 100644 --- a/include/pkt_dispatch.hh +++ b/include/pkt_dispatch.hh @@ -10,7 +10,7 @@ namespace uvg_rtp { - typedef rtp_error_t (*packet_handler)(ssize_t, void *, uvg_rtp::frame::rtp_frame **); + typedef rtp_error_t (*packet_handler)(ssize_t, void *, int, uvg_rtp::frame::rtp_frame **); class pkt_dispatcher : public runner { public: @@ -44,7 +44,7 @@ namespace uvg_rtp { std::vector& get_handlers(); private: - static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket& socket); + static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket& socket, int flags); uvg_rtp::socket socket_; std::vector packet_handlers_; diff --git a/include/rtp.hh b/include/rtp.hh index de1ba08..a0fcc05 100644 --- a/include/rtp.hh +++ b/include/rtp.hh @@ -31,7 +31,7 @@ namespace uvg_rtp { void update_sequence(uint8_t *buffer); /* Validates the RTP header pointed to by "packet" */ - static rtp_error_t packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out); + static rtp_error_t packet_handler(ssize_t size, void *packet, int flags, frame::rtp_frame **out); private: diff --git a/src/formats/hevc_pkt_handler.cc b/src/formats/hevc_pkt_handler.cc index a99b21b..72fd9a4 100644 --- a/src/formats/hevc_pkt_handler.cc +++ b/src/formats/hevc_pkt_handler.cc @@ -100,13 +100,13 @@ static void __drop_frame(frame_info_t& finfo, uint32_t ts) finfo.erase(ts); } -rtp_error_t hevc_packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out) +rtp_error_t hevc_packet_handler(ssize_t size, void *packet, int flags, uvg_rtp::frame::rtp_frame **out) { static frame_info_t finfo; static std::unordered_set dropped; uvg_rtp::frame::rtp_frame *frame; - bool enable_idelay = false;//!(receiver->get_conf().flags & RCE_HEVC_NO_INTRA_DELAY); + bool enable_idelay = !(flags & RCE_HEVC_NO_INTRA_DELAY); /* Use "intra" to keep track of intra frames * diff --git a/src/formats/media.cc b/src/formats/media.cc index 87d2b9e..95551b1 100644 --- a/src/formats/media.cc +++ b/src/formats/media.cc @@ -83,7 +83,7 @@ rtp_error_t uvg_rtp::formats::media::__push_frame(uint8_t *data, size_t data_len return socket_->sendto(buffers, 0); } -static rtp_error_t packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out) +static rtp_error_t packet_handler(ssize_t size, void *packet, int flags, uvg_rtp::frame::rtp_frame **out) { (void)size, (void)packet; return RTP_OK; diff --git a/src/pkt_dispatch.cc b/src/pkt_dispatch.cc index 9539e2f..d36467f 100644 --- a/src/pkt_dispatch.cc +++ b/src/pkt_dispatch.cc @@ -116,7 +116,7 @@ std::vector& uvg_rtp::pkt_dispatcher::get_handlers() * * If a handler receives a non-null "out", it can safely ignore "packet" and operate just on * the "out" parameter because at that point it already contains all needed information. */ -static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket& socket) +static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket& socket, int flags) { int nread; fd_set read_fds; @@ -151,7 +151,7 @@ static void runner(uvg_rtp::pkt_dispatcher *dispatcher, uvg_rtp::socket& socket) } for (auto& handler : dispatcher->get_handlers()) { - switch ((ret = (*handler)(nread, recv_buffer, &frame))) { + switch ((ret = (*handler)(nread, recv_buffer, flags, &frame))) { /* packet was handled successfully */ case RTP_OK: break; diff --git a/src/rtp.cc b/src/rtp.cc index 6b71fa8..bd5443b 100644 --- a/src/rtp.cc +++ b/src/rtp.cc @@ -138,7 +138,7 @@ rtp_format_t uvg_rtp::rtp::get_payload() return (rtp_format_t)fmt_; } -static rtp_error_t packet_handler(ssize_t size, void *packet, uvg_rtp::frame::rtp_frame **out) +static rtp_error_t packet_handler(ssize_t size, void *packet, int flags, uvg_rtp::frame::rtp_frame **out) { /* not an RTP frame */ if (size < 12)