multiplex: Comment out functions related to sending user packets

This commit is contained in:
Heikki Tampio 2023-05-29 14:06:44 +03:00
parent 695ffedba3
commit 5b6a06f14f
4 changed files with 26 additions and 18 deletions

View File

@ -273,9 +273,11 @@ namespace uvgrtp {
*/ */
rtp_error_t push_frame(std::unique_ptr<uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags); rtp_error_t push_frame(std::unique_ptr<uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags);
/* ----------- User packets not yet supported -----------
rtp_error_t send_user_packet(uint8_t* data, uint32_t payload_size, rtp_error_t send_user_packet(uint8_t* data, uint32_t payload_size,
std::string remote_address, uint16_t port); std::string remote_address, uint16_t port);
rtp_error_t install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload)); rtp_error_t install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload));
*/
/** /**
* \brief Poll a frame indefinitely from the media stream object * \brief Poll a frame indefinitely from the media stream object

View File

@ -630,7 +630,7 @@ rtp_error_t uvgrtp::media_stream::push_frame(std::unique_ptr<uint8_t[]> data, si
return ret; return ret;
} }
/* ----------- User packets not yet supported -----------
rtp_error_t uvgrtp::media_stream::send_user_packet(uint8_t* data, uint32_t payload_size, rtp_error_t uvgrtp::media_stream::send_user_packet(uint8_t* data, uint32_t payload_size,
std::string remote_address, uint16_t port) std::string remote_address, uint16_t port)
{ {
@ -658,7 +658,7 @@ rtp_error_t uvgrtp::media_stream::install_user_hook(void* arg, void (*hook)(void
return reception_flow_->install_user_hook(arg, hook);; return reception_flow_->install_user_hook(arg, hook);;
} }*/
uvgrtp::frame::rtp_frame *uvgrtp::media_stream::pull_frame() uvgrtp::frame::rtp_frame *uvgrtp::media_stream::pull_frame()
{ {

View File

@ -34,8 +34,8 @@ uvgrtp::reception_flow::reception_flow(bool ipv6) :
handler_mapping_({}), handler_mapping_({}),
should_stop_(true), should_stop_(true),
receiver_(nullptr), receiver_(nullptr),
user_hook_arg_(nullptr), //user_hook_arg_(nullptr),
user_hook_(nullptr), //user_hook_(nullptr),
ring_buffer_(), ring_buffer_(),
ring_read_index_(-1), // invalid first index that will increase to a valid one ring_read_index_(-1), // invalid first index that will increase to a valid one
last_ring_write_index_(-1), last_ring_write_index_(-1),
@ -366,7 +366,7 @@ void uvgrtp::reception_flow::return_frame(uvgrtp::frame::rtp_frame *frame)
frames_mtx_.unlock(); frames_mtx_.unlock();
} }
} }
/* ----------- User packets not yet supported -----------
rtp_error_t uvgrtp::reception_flow::install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload)) rtp_error_t uvgrtp::reception_flow::install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload))
{ {
if (!hook) if (!hook)
@ -391,9 +391,9 @@ void uvgrtp::reception_flow::return_user_pkt(uint8_t* pkt)
else { else {
UVG_LOG_DEBUG("No user hook installed"); UVG_LOG_DEBUG("No user hook installed");
} }
} }*/
void uvgrtp::reception_flow::call_aux_handlers(uint32_t key, int rce_flags, uvgrtp::frame::rtp_frame **frame, uint8_t* ptr) void uvgrtp::reception_flow::call_aux_handlers(uint32_t key, int rce_flags, uvgrtp::frame::rtp_frame **frame)
{ {
rtp_error_t ret; rtp_error_t ret;
@ -632,9 +632,6 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
else if (current_ssrc == 0) { else if (current_ssrc == 0) {
found = true; found = true;
} }
//else {
// return_user_pkt(ptr);
//}
if (!found) { if (!found) {
// No SSRC match found, skip this handler // No SSRC match found, skip this handler
continue; continue;
@ -653,7 +650,7 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
} }
case RTP_PKT_NOT_HANDLED: case RTP_PKT_NOT_HANDLED:
{ {
// packet was not handled by this primary handlers, proceed to the next one /* ----------- User packets not yet supported -----------
std::string from_str; std::string from_str;
if (ipv6_) { if (ipv6_) {
from_str = uvgrtp::socket::sockaddr_ip6_to_string(from6); from_str = uvgrtp::socket::sockaddr_ip6_to_string(from6);
@ -663,13 +660,16 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
} }
UVG_LOG_DEBUG("User packet from ip: %s", from_str.c_str()); UVG_LOG_DEBUG("User packet from ip: %s", from_str.c_str());
return_user_pkt(ptr); return_user_pkt(ptr);
*/
// packet was not handled by this primary handlers, proceed to the next one
continue; continue;
/* packet was handled by the primary handler /* packet was handled by the primary handler
* and should be dispatched to the auxiliary handler(s) */ * and should be dispatched to the auxiliary handler(s) */
} }
case RTP_PKT_MODIFIED: case RTP_PKT_MODIFIED:
{ {
call_aux_handlers(handler.first, rce_flags, &frame, ptr); call_aux_handlers(handler.first, rce_flags, &frame);
break; break;
} }
case RTP_GENERIC_ERROR: case RTP_GENERIC_ERROR:

View File

@ -29,7 +29,9 @@ namespace uvgrtp {
class socket; class socket;
typedef void (*recv_hook)(void* arg, uvgrtp::frame::rtp_frame* frame); typedef void (*recv_hook)(void* arg, uvgrtp::frame::rtp_frame* frame);
typedef void (*user_hook)(void* arg, uint8_t* payload, uint32_t payload_size);
// Not yet supported
//typedef void (*user_hook)(void* arg, uint8_t* payload, uint32_t payload_size);
struct receive_pkt_hook { struct receive_pkt_hook {
void* arg = nullptr; void* arg = nullptr;
@ -183,7 +185,9 @@ namespace uvgrtp {
void set_buffer_size(const ssize_t& value); void set_buffer_size(const ssize_t& value);
ssize_t get_buffer_size() const; ssize_t get_buffer_size() const;
void set_payload_size(const size_t& value); void set_payload_size(const size_t& value);
rtp_error_t install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload));
// Not yet supported
//rtp_error_t install_user_hook(void* arg, void (*hook)(void*, uint8_t* payload));
/// \endcond /// \endcond
private: private:
@ -196,10 +200,11 @@ namespace uvgrtp {
/* Return a processed RTP frame to user either through frame queue or receive hook */ /* Return a processed RTP frame to user either through frame queue or receive hook */
void return_frame(uvgrtp::frame::rtp_frame *frame); void return_frame(uvgrtp::frame::rtp_frame *frame);
void return_user_pkt(uint8_t* pkt); // Not yet supported
//void return_user_pkt(uint8_t* pkt);
/* Call auxiliary handlers of a primary handler */ /* Call auxiliary handlers of a primary handler */
void call_aux_handlers(uint32_t key, int rce_flags, uvgrtp::frame::rtp_frame **frame, uint8_t* ptr); void call_aux_handlers(uint32_t key, int rce_flags, uvgrtp::frame::rtp_frame **frame);
inline void increase_buffer_size(ssize_t next_write_index); inline void increase_buffer_size(ssize_t next_write_index);
@ -240,8 +245,9 @@ namespace uvgrtp {
sockaddr_in from; sockaddr_in from;
}; };
void* user_hook_arg_; // Not yet supported
void (*user_hook_)(void* arg, uint8_t* payload); //void* user_hook_arg_;
//void (*user_hook_)(void* arg, uint8_t* payload);
std::vector<Buffer> ring_buffer_; std::vector<Buffer> ring_buffer_;
std::mutex ring_mutex_; std::mutex ring_mutex_;