multiplex: Update media handler installation in media_stream

This commit is contained in:
Heikki Tampio 2023-06-15 09:44:26 +03:00
parent 4ff8d1998e
commit 1675888791
4 changed files with 13 additions and 10 deletions

View File

@ -102,6 +102,11 @@ uvgrtp::formats::media_frame_info_t *uvgrtp::formats::media::get_media_frame_inf
{
return &minfo_;
}
rtp_error_t uvgrtp::formats::media::new_packet_handler(int rce_flags, uint8_t* read_ptr, size_t size, frame::rtp_frame** out)
{
UVG_LOG_ERROR("Missing args...........");
return packet_handler(nullptr, rce_flags, out);
}
rtp_error_t uvgrtp::formats::media::packet_handler(void *arg, int rce_flags, uvgrtp::frame::rtp_frame **out)
{

View File

@ -68,6 +68,7 @@ namespace uvgrtp {
* 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(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

@ -259,13 +259,10 @@ rtp_error_t uvgrtp::media_stream::create_media(rtp_format_t fmt)
case RTP_FORMAT_VDVI:
{
media_ = std::unique_ptr<uvgrtp::formats::media>(new uvgrtp::formats::media(socket_, rtp_, rce_flags_));
// TODO _______________________________
reception_flow_->install_aux_handler(
rtp_handler_key_,
media_->get_media_frame_info(),
media_->packet_handler,
nullptr
);
reception_flow_->new_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::placeholders::_4),
nullptr);
break;
}
default:

View File

@ -712,7 +712,7 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
if (ntohl(*(uint32_t*)&ptr[4]) == 0x5a525450) {
// TODO: Add functionality
UVG_LOG_INFO("ZRTP packet");
//break;
break;
}
/* -------------------- RTP check ---------------------------------- */
@ -725,7 +725,7 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
return_frame(frame);
break;
}
else if (retval == RTP_MULTIPLE_PKTS_READY) {
else if (retval == RTP_MULTIPLE_PKTS_READY && handlers->getter != nullptr) {
UVG_LOG_INFO("TODO:is this correct???");
while (handlers->getter(&frame) == RTP_PKT_READY) {
return_frame(frame);
@ -740,7 +740,7 @@ void uvgrtp::reception_flow::process_packet(int rce_flags)
else {
// No functionality needed
UVG_LOG_INFO("Holepuncher packet");
//break;
break;
}
}