Pass RTP context flags to RTP packet dispatcher and handlers

Context flags may contain important information about how a packet
should be handled (such as RCE_FRAGMENT_GENERIC or RCE_HEVC_NO_INTRA_DELAY)
This commit is contained in:
Aaro Altonen 2020-08-04 13:08:35 +03:00
parent 46cf6dcf8e
commit 43e0452bfa
8 changed files with 11 additions and 11 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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<uvg_rtp::packet_handler>& 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_handler> packet_handlers_;

View File

@ -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:

View File

@ -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<uint32_t> 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
*

View File

@ -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;

View File

@ -116,7 +116,7 @@ std::vector<uvg_rtp::packet_handler>& 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;

View File

@ -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)