Skip to content

Exclude SRT Header from receiver buffer size  #1548

@maxsharabayko

Description

@maxsharabayko

Note! This request to be discussed.

As an SRT user, I would like to specify the receiver buffer size relative to the payload being transmitted.

As of now, the value provided via SRTO_RCVBUF is converted internally to the number of packets.
The conversion is done dividing the option value by (MTU - UDP_HDR_SIZE), where UDP_HDR_SIZE = 28 (20 bytes IPv4 + 8 bytes of UDP).

num_pkts = SRTO_RCVBUF / (MTU - UDP_HDR_SIZE)
  • To consider. The case when IPv6 is used with a header size of 40 bytes is not taken into account while the buffer size is calculated. Can this be improved?

As a user, I want to provide the buffer size to receive my streaming, and I am mainly concerned about the payload, not the payload + SRT header.

Note that CUnitQueue allocates the memory for the receiver buffer. It actually allocates num_pkts * max_payload_size, while SRT Packet Header is implicitly allocated with each CUnit that holds the CPacket structure.
So effectively the allocated memory is num_pkts * (max_payload_size + SRT_HDR_SIZE).

Proposed behavior

The resulting number of packets is increased.

num_pkts = SRTO_RCVBUF / (MTU - UDP_HDR_SIZE - SRT_HDR_SIZE)

SRT Version: v1.4.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: MaintenanceWork required to maintain or clean up the code[core]Area: Changes in SRT library core

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions