From 309faedd1a819629fb2d131929fb72e4d10be722 Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 5 Dec 2026 21:04:17 +0400 Subject: pica-client: max MTU on private networks, reduce MTU if video packets get lost --- pica-client/audiovideocallcontroller.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'pica-client/audiovideocallcontroller.cpp') diff --git a/pica-client/audiovideocallcontroller.cpp b/pica-client/audiovideocallcontroller.cpp index 5f24e73..d367066 100644 --- a/pica-client/audiovideocallcontroller.cpp +++ b/pica-client/audiovideocallcontroller.cpp @@ -730,12 +730,16 @@ void AudioVideoCallController::media_transport_changed(QByteArray peer_id, bool if (peer_id != m_peer_id) return; - // Fragments stay datagram sized for the whole call (see - // startVideoPipeline()); this only lowers the size further, for when the - // media connection turns out to carry less than was assumed. Direct call, + // Over a media connection the datagram is the hard limit and max_payload + // is exactly what fits into one, whether that is less than was assumed at + // the start of the call (see startVideoPipeline()) or - on a local network + // - more. Back on the c2c connection, where a message can carry far more + // than any datagram, fragments stay datagram sized so that the media can + // move to a datagram again without changing size mid-frame. Direct call, // not invokeMethod()/QueuedConnection - see the comment in // stopAudioPipeline(): cam's thread is blocked inside Capture(). - cam->setMaxFragmentSize(qMin((int)max_payload, (int)PICA_MEDIA_SAFE_PAYLOAD)); + cam->setMaxFragmentSize(direct_udp && max_payload > 0 ? (int)max_payload + : (int)PICA_MEDIA_SAFE_PAYLOAD); if (callwindow) callwindow->setMediaTransport(direct_udp, ciphersuitename); -- cgit v1.2.1