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:
parent
46cf6dcf8e
commit
43e0452bfa
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue