mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
module-rtp: calculate payload_size based on MTU
The actual payload size depends on the MTU but should not include the IP/UDP and RTP headers. Fixes #4396
This commit is contained in:
parent
73b5a10021
commit
a53bc035c0
4 changed files with 15 additions and 4 deletions
|
|
@ -71,6 +71,7 @@ struct impl {
|
|||
uint32_t ts_offset;
|
||||
uint32_t psamples;
|
||||
uint32_t mtu;
|
||||
uint32_t payload_size;
|
||||
|
||||
struct spa_ringbuffer ring;
|
||||
uint8_t buffer[BUFFER_SIZE];
|
||||
|
|
@ -440,6 +441,11 @@ 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) {
|
||||
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->seq = pw_rand32();
|
||||
|
||||
|
|
@ -477,7 +483,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
|
|||
pw_log_warn("rtp.ptime doesn't match rtp.framecount. Choosing rtp.ptime");
|
||||
}
|
||||
} else {
|
||||
impl->psamples = impl->mtu / impl->stride;
|
||||
impl->psamples = impl->payload_size / impl->stride;
|
||||
impl->psamples = SPA_CLAMP(impl->psamples, min_samples, max_samples);
|
||||
if (direction == PW_DIRECTION_INPUT) {
|
||||
pw_properties_set(props, "rtp.ptime",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue