summaryrefslogtreecommitdiffstats
path: root/doc/protocol-specification.txt
diff options
context:
space:
mode:
authorAnton <anton@picapica.im>2026-11-29 23:38:25 +0400
committerAnton <anton@picapica.im>2026-11-29 23:38:25 +0400
commit56863d74399c8d7354a00bc8ddc87b924ef870ab (patch)
treebd9e44c438f974f80aa6cfef59fe842d3e128ee7 /doc/protocol-specification.txt
parentd6ce3a2226bda81cce96c61f0a73fb1516adbd0b (diff)
downloadpica-pica-call_quality_presets.tar.gz
pica-pica-call_quality_presets.zip
pica-client: new presets tab, call quality presetscall_quality_presets
Diffstat (limited to 'doc/protocol-specification.txt')
-rw-r--r--doc/protocol-specification.txt65
1 files changed, 61 insertions, 4 deletions
diff --git a/doc/protocol-specification.txt b/doc/protocol-specification.txt
index f7e500d..024e70b 100644
--- a/doc/protocol-specification.txt
+++ b/doc/protocol-specification.txt
@@ -453,8 +453,8 @@ Commands:
Audio and Video Calls.
-The call control messages (0x70 - 0x75) are sent between clients over a c2c or
-directc2c connection.
+The call control messages (0x70 - 0x75) and the reception reports (0x79) are
+sent between clients over a c2c or directc2c connection.
The media packets (0x76, 0x77) are sent over a mediac2c connection when one is
established, and over the c2c or directc2c connection otherwise. Over a
mediac2c connection every datagram contains exactly one message, and messages
@@ -489,8 +489,11 @@ is used. Otherwise the peer steps down through the sizes its camera offers that
are smaller in area (width x height), largest first, to the first one that
fits. When none of them does, it
uses the smallest of them, or the configured size if the camera offers nothing
-smaller; video is sent in any case. The recommendation is not enforced on the
-receiving side: video larger than it is still received and shown.
+smaller; video is sent in any case. A peer using a call quality preset rather
+than a configured size chooses among the camera's sizes that fit in the first
+place, falling back to the smallest the same way. The recommendation is not
+enforced on the receiving side: video larger than it is still received and
+shown.
address list - the addresses where the sender's media socket for this call may
be reachable, as elements of the 0xA4 format, of types 0xA0 and 0xA1 only:
@@ -704,6 +707,60 @@ select the address it came from, see step 2 above; all others have no effect.
A DTLS record never starts with the octet 0x78, so probes are told apart from
DTLS records by their first octet at any stage of the connection.
====================================================
+Call reception report.
+Sent by each side of an active call every 2 seconds, over the c2c or directc2c
+connection - never over the mediac2c one, so that it arrives even when that
+connection loses most of what it carries. It tells the peer what arrived of the
+media it sent, so that the peer can fit its bitrate and picture size to what
+the connection carries.
+
+[0x79 0x79]
+[period, uint16_t, little-endian]
+[audio packets received, uint16_t, little-endian]
+[audio packets lost, uint16_t, little-endian]
+[video packets received, uint16_t, little-endian]
+[video packets lost, uint16_t, little-endian]
+[audio octets received, uint32_t, little-endian]
+[video octets received, uint32_t, little-endian]
+[queuing delay, uint16_t, little-endian]
+
+22 octets
+
+period - the milliseconds the report covers: the time since the previous
+report, or since the call became active for the first one.
+
+packets received - the 0x76 (audio) or 0x77 (video) messages that arrived in
+the period, over either transport, duplicates included.
+
+packets lost - the messages the period's sequence numbers say should have
+arrived but did not: the advance of the highest sequence number received
+(counting its wraparounds, at 65536 for 0x76 and at 32768 for the 15-bit
+counter of 0x77) over the period, less the packets received; 0 if that is
+negative. A packet that arrives in a later period than the one it was counted
+as lost in is not taken back. Over a c2c or directc2c connection nothing is
+lost, and these are 0.
+
+octets received - the data carried by those messages, without their headers.
+
+queuing delay - how much later than usual the period's audio packets arrived,
+in milliseconds: the average of their one-way delays (arrival time less the
+packet's timestamp, which includes the offset between the two sides' clocks)
+less the smallest one-way delay of any audio packet in the last 30 seconds.
+0xFFFF if no audio packet arrived in the period. Audio is used because its
+packets are small, frequent and sent as they are produced, while the fragments
+of one video frame share a timestamp and leave in a burst.
+
+Values that do not fit are sent as 0xFFFF (0xFFFE for the queuing delay).
+The report is ignored when no call is active, as it may have been sent just
+before the call ended.
+
+The sender of the media may lower its bitrate when the reports show loss or
+a growing queuing delay, and raise it while they show neither; a client set to
+the "Adaptive" call quality does, stepping its picture size down and up with
+the bitrate and announcing every new size in a 0x75 message. A new size of the
+same codec does not need the receiving side to restart its decoder: the stream
+itself carries the size, and the encoder starts it with a keyframe.
+====================================================
Ping.