formats: H26x flush queue after each NAL unit

This commit is contained in:
Heikki Tampio 2024-02-06 10:14:01 +02:00
parent ab70083bab
commit 3f956dfabb
1 changed files with 10 additions and 5 deletions

View File

@ -386,12 +386,21 @@ rtp_error_t uvgrtp::formats::h26x::push_media_frame(sockaddr_in& addr, sockaddr_
} }
(void)finalize_aggregation_pkt(); (void)finalize_aggregation_pkt();
// actually send the packets
ret = fqueue_->flush_queue(addr, addr6, ssrc);
clear_aggregation_info();
} }
for (auto& nal : nals) // non-aggregatable NAL units for (auto& nal : nals) // non-aggregatable NAL units
{ {
UVG_LOG_DEBUG("NAL size %u", nal.size);
if (!nal.aggregate || !should_aggregate) if (!nal.aggregate || !should_aggregate)
{ {
if ((ret = fqueue_->init_transaction(data + nal.offset)) != RTP_OK) {
UVG_LOG_ERROR("Invalid frame queue or failed to initialize transaction!");
return ret;
}
// single NAL unit uses the NAL unit header as the payload header meaning that it does not // single NAL unit uses the NAL unit header as the payload header meaning that it does not
// add anything extra to the packet and we can just compare the NAL size with the payload size allowed // add anything extra to the packet and we can just compare the NAL size with the payload size allowed
if (nal.size <= payload_size) // send as a single NAL unit packet if (nal.size <= payload_size) // send as a single NAL unit packet
@ -409,13 +418,9 @@ rtp_error_t uvgrtp::formats::h26x::push_media_frame(sockaddr_in& addr, sockaddr_
fqueue_->deinit_transaction(); fqueue_->deinit_transaction();
return ret; return ret;
} }
ret = fqueue_->flush_queue(addr, addr6, ssrc);
} }
} }
// actually send the packets
ret = fqueue_->flush_queue(addr, addr6, ssrc);
clear_aggregation_info();
return ret; return ret;
} }