mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
rtp: take into account ipv4/ipv6 when calculating header size
Calculate the header_size based on the IP version instead of using a hardcoded value. Fixes #4524
This commit is contained in:
parent
180967bb64
commit
830bd19ca2
4 changed files with 22 additions and 4 deletions
|
|
@ -71,6 +71,7 @@ struct impl {
|
|||
uint32_t ts_offset;
|
||||
uint32_t psamples;
|
||||
uint32_t mtu;
|
||||
uint32_t header_size;
|
||||
uint32_t payload_size;
|
||||
|
||||
struct spa_ringbuffer ring;
|
||||
|
|
@ -442,11 +443,14 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
|
|||
|
||||
impl->payload = pw_properties_get_uint32(props, "rtp.payload", impl->payload);
|
||||
impl->mtu = pw_properties_get_uint32(props, "net.mtu", DEFAULT_MTU);
|
||||
if (impl->mtu <= PACKET_HEADER_SIZE) {
|
||||
impl->header_size = pw_properties_get_uint32(props, "net.header", IP4_HEADER_SIZE + UDP_HEADER_SIZE);
|
||||
impl->header_size += RTP_HEADER_SIZE;
|
||||
|
||||
if (impl->mtu <= impl->header_size) {
|
||||
pw_log_error("invalid MTU %d, using %d", impl->mtu, DEFAULT_MTU);
|
||||
impl->mtu = DEFAULT_MTU;
|
||||
}
|
||||
impl->payload_size = impl->mtu - PACKET_HEADER_SIZE;
|
||||
impl->payload_size = impl->mtu - impl->header_size;
|
||||
|
||||
impl->seq = pw_rand32();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue