multiplex: Remove several unnecessary helper functions

This commit is contained in:
Heikki Tampio 2023-07-24 13:09:27 +03:00
parent dbe4287076
commit b3d2267bc1
7 changed files with 14 additions and 30 deletions

View File

@ -633,16 +633,12 @@ bool uvgrtp::formats::h26x::is_duplicate_frame(uint32_t timestamp, uint16_t seq_
}
return false;
}
rtp_error_t uvgrtp::formats::h26x::new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, uvgrtp::frame::rtp_frame** out)
rtp_error_t uvgrtp::formats::h26x::packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, uvgrtp::frame::rtp_frame** out)
{
(void)args;
(void)read_ptr;
(void)size;
return packet_handler(rce_flags, out);
}
rtp_error_t uvgrtp::formats::h26x::packet_handler(int rce_flags, uvgrtp::frame::rtp_frame** out)
{
uvgrtp::frame::rtp_frame* frame = *out;
if (is_duplicate_frame(frame->header.timestamp, frame->header.seq)) {

View File

@ -115,8 +115,7 @@ namespace uvgrtp {
* 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 */
rtp_error_t packet_handler(int rce_flags, frame::rtp_frame** frame);
rtp_error_t new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, uvgrtp::frame::rtp_frame** out);
rtp_error_t packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, uvgrtp::frame::rtp_frame** out);
protected:

View File

@ -102,16 +102,12 @@ uvgrtp::formats::media_frame_info_t *uvgrtp::formats::media::get_media_frame_inf
{
return &minfo_;
}
rtp_error_t uvgrtp::formats::media::new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out)
rtp_error_t uvgrtp::formats::media::packet_handler(void* arg, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out)
{
(void)rce_flags;
(void)read_ptr;
(void)size;
return packet_handler(args, rce_flags, out);
}
rtp_error_t uvgrtp::formats::media::packet_handler(void *arg, int rce_flags, uvgrtp::frame::rtp_frame **out)
{
auto minfo = (uvgrtp::formats::media_frame_info_t *)arg;
auto frame = *out;
uint32_t ts = frame->header.timestamp;

View File

@ -67,8 +67,7 @@ namespace uvgrtp {
* 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(void *arg, int rce_flags, frame::rtp_frame **frame);
rtp_error_t new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out);
rtp_error_t packet_handler(void* arg, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out);
/* Return pointer to the internal frame info structure which is relayed to packet handler */
media_frame_info_t *get_media_frame_info();

View File

@ -187,7 +187,7 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt)
uvgrtp::formats::h264* format_264 = new uvgrtp::formats::h264(socket_, rtp_, rce_flags_);
reception_flow_->install_handler(
5, remote_ssrc_,
std::bind(&uvgrtp::formats::h264::new_packet_handler, format_264, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::bind(&uvgrtp::formats::h264::packet_handler, format_264, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5), nullptr
);
reception_flow_->install_getter(remote_ssrc_,
@ -201,7 +201,7 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt)
uvgrtp::formats::h265* format_265 = new uvgrtp::formats::h265(socket_, rtp_, rce_flags_);
reception_flow_->install_handler(
5, remote_ssrc_,
std::bind(&uvgrtp::formats::h265::new_packet_handler, format_265, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::bind(&uvgrtp::formats::h265::packet_handler, format_265, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5), nullptr
);
reception_flow_->install_getter(remote_ssrc_,
@ -215,7 +215,7 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt)
uvgrtp::formats::h266* format_266 = new uvgrtp::formats::h266(socket_, rtp_, rce_flags_);
reception_flow_->install_handler(
5, remote_ssrc_,
std::bind(&uvgrtp::formats::h266::new_packet_handler, format_266, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::bind(&uvgrtp::formats::h266::packet_handler, format_266, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5), nullptr
);
reception_flow_->install_getter(remote_ssrc_,
@ -252,7 +252,7 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt)
media_ = std::unique_ptr<uvgrtp::formats::media>(new uvgrtp::formats::media(socket_, rtp_, rce_flags_));
reception_flow_->install_handler(
5, remote_ssrc_,
std::bind(&uvgrtp::formats::media::new_packet_handler, media_.get(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::bind(&uvgrtp::formats::media::packet_handler, media_.get(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5), media_->get_media_frame_info());
break;
}
@ -296,7 +296,7 @@ rtp_error_t uvgrtp::media_stream::install_packet_handlers()
{
reception_flow_->install_handler(
1, remote_ssrc_,
std::bind(&uvgrtp::rtp::new_packet_handler, rtp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::bind(&uvgrtp::rtp::packet_handler, rtp_, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5),
nullptr);
if (rce_flags_ & RCE_RTCP) {

View File

@ -233,15 +233,10 @@ uint32_t uvgrtp::rtp::get_rtp_ts() const {
return rtp_ts_;
}
rtp_error_t uvgrtp::rtp::new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out)
{
(void)args;
return packet_handler(size, (void*)read_ptr, rce_flags, out);
}
rtp_error_t uvgrtp::rtp::packet_handler(ssize_t size, void *packet, int rce_flags, uvgrtp::frame::rtp_frame **out)
rtp_error_t uvgrtp::rtp::packet_handler(void* args, int rce_flags, uint8_t* packet, size_t size, uvgrtp::frame::rtp_frame **out)
{
(void)rce_flags;
(void)args;
/* not an RTP frame */
if (size < 12)

View File

@ -44,8 +44,7 @@ namespace uvgrtp {
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, int rce_flags, frame::rtp_frame **out);
rtp_error_t new_packet_handler(void* args, int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out);
rtp_error_t packet_handler(void* args, int rce_flags, uint8_t* packet, size_t size, uvgrtp::frame::rtp_frame** out);
private: