summaryrefslogtreecommitdiffstats
path: root/pica-client/audiovideocallcontroller.cpp
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-12-05 21:04:17 +0400
committerAnton <anton@picapica.im>2026-12-05 21:04:17 +0400
commit309faedd1a819629fb2d131929fb72e4d10be722 (patch)
tree9cd29e9644d95cc72aedebc615c6900f524106e4 /pica-client/audiovideocallcontroller.cpp
parente16b5b1d09bbbdd4d7fc99f4f3526ff47cc04bf8 (diff)
downloadpica-pica-309faedd1a819629fb2d131929fb72e4d10be722.tar.gz
pica-pica-309faedd1a819629fb2d131929fb72e4d10be722.zip
pica-client: max MTU on private networks, reduce MTU if video packets get lost
Diffstat (limited to 'pica-client/audiovideocallcontroller.cpp')
-rw-r--r--pica-client/audiovideocallcontroller.cpp12
1 files changed, 8 insertions, 4 deletions
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);