diff --git a/src/formats/h26x.cc b/src/formats/h26x.cc index 24e6f45..63898ad 100644 --- a/src/formats/h26x.cc +++ b/src/formats/h26x.cc @@ -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)) { diff --git a/src/formats/h26x.hh b/src/formats/h26x.hh index 9bce5b2..6dd2e01 100644 --- a/src/formats/h26x.hh +++ b/src/formats/h26x.hh @@ -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: diff --git a/src/formats/media.cc b/src/formats/media.cc index 6fac1f2..fbd6449 100644 --- a/src/formats/media.cc +++ b/src/formats/media.cc @@ -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; diff --git a/src/formats/media.hh b/src/formats/media.hh index 3202e6d..09ef999 100644 --- a/src/formats/media.hh +++ b/src/formats/media.hh @@ -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(); diff --git a/src/media_stream.cc b/src/media_stream.cc index 41a657c..2a5e8aa 100644 --- a/src/media_stream.cc +++ b/src/media_stream.cc @@ -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(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) { diff --git a/src/rtp.cc b/src/rtp.cc index 6770838..7ce257e 100644 --- a/src/rtp.cc +++ b/src/rtp.cc @@ -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) diff --git a/src/rtp.hh b/src/rtp.hh index 249316e..f9708ec 100644 --- a/src/rtp.hh +++ b/src/rtp.hh @@ -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: