formats: Add flag RTP_H26X_DO_NOT_AGGR and its functionality

This commit is contained in:
Heikki Tampio 2024-02-19 11:54:00 +02:00
parent c2b381e64a
commit a2c42f32a3
2 changed files with 8 additions and 3 deletions

View File

@ -151,7 +151,10 @@ typedef enum RTP_FLAGS {
* want to provide the NAL units without the start code prefix yourself,
* you may use this flag to disable Start Code Lookup (SCL) and the frames
* will be treated as send-ready NAL units. */
RTP_NO_H26X_SCL = 1 << 2
RTP_NO_H26X_SCL = 1 << 2,
/** Disable the use of Aggregation Packets in H26x formats **/
RTP_H26X_DO_NOT_AGGR = 1 << 3
} rtp_flags_t;

View File

@ -362,7 +362,9 @@ rtp_error_t uvgrtp::formats::h26x::push_media_frame(sockaddr_in& addr, sockaddr_
return RTP_INVALID_VALUE;
}
if (should_aggregate) // an aggregate packet is possible
bool do_not_aggr = (rtp_flags & RTP_H26X_DO_NOT_AGGR);
if (should_aggregate && !do_not_aggr) // an aggregate packet is possible
{
if ((ret = fqueue_->init_transaction(data)) != RTP_OK) {
UVG_LOG_ERROR("Invalid frame queue or failed to initialize transaction!");
@ -394,7 +396,7 @@ rtp_error_t uvgrtp::formats::h26x::push_media_frame(sockaddr_in& addr, sockaddr_
for (auto& nal : nals) // non-aggregatable NAL units
{
//UVG_LOG_DEBUG("NAL size %u", nal.size);
if (!nal.aggregate || !should_aggregate)
if (do_not_aggr || !nal.aggregate || !should_aggregate)
{
if ((ret = fqueue_->init_transaction(data + nal.offset, true)) != RTP_OK) {
UVG_LOG_ERROR("Invalid frame queue or failed to initialize transaction!");