2020-03-15 19:44:00 +01:00
|
|
|
// Simplified scheme, for the new protocol
|
|
|
|
// Try unifying all flags, lengths and so on
|
|
|
|
|
|
|
|
packet$_
|
|
|
|
streamId:(## 2) // Max 2 streams, we don't need much anyway (0 and 3 are reserved values)
|
|
|
|
// If 0, is a pure-service message
|
|
|
|
// If 1, is an audio packet
|
|
|
|
// If 2, is a video packet
|
|
|
|
// If 3, is packet from one of the group call streams
|
|
|
|
flags:(## 6)
|
|
|
|
|
2020-03-28 17:05:24 +01:00
|
|
|
seq:# ackSeq:# ackMask:# // Different sequence for each streamId
|
|
|
|
|
2020-03-15 19:44:00 +01:00
|
|
|
streamIdExtended:(streamId == 3 ? (## 8) : false) // Extended stream ID for group calls
|
|
|
|
|
|
|
|
length:(## flags.0 ? 11 : (streamId > 0 ? 8 : 0))
|
|
|
|
eFlags:(## flags.0 ? 5 : 0) // We shouldn't typically need this, but since we have the space why not use it
|
|
|
|
|
2020-03-19 14:20:01 +01:00
|
|
|
fragmentIndex:eFlags.0?(## 8) // Logically, this flag can only appear on *big* fragmented messages
|
|
|
|
fragmentCount:eFlags.0?(## 8) // Logically, this flag can only appear on *big* fragmented messages
|
|
|
|
keyframe:eFlags.1?true // This flag can only appear for video streams (typically *big* messages, see ^)
|
2020-03-15 19:44:00 +01:00
|
|
|
|
2020-03-16 16:07:13 +01:00
|
|
|
data:bytes // No PTS, simply use the seq
|
2020-03-15 19:44:00 +01:00
|
|
|
|
2020-03-18 21:43:44 +01:00
|
|
|
recvTS:flags.1?int
|
|
|
|
extraFEC:flags.2?ExtraFEC
|
|
|
|
extraSignaling:flags.3?Extras<ExtraSignaling>
|
2020-03-27 19:13:37 +01:00
|
|
|
reserved:flags.4?true:true // Always true, allows us to distinguish from legacy packets if the maxLayer is wrong.
|
|
|
|
|
2020-03-15 19:44:00 +01:00
|
|
|
= Packet;
|
|
|
|
|
|
|
|
// ExtraFEC
|
|
|
|
extraFEC$_ mask:(## 8) [ length:(## 8) _:bytes ] = ExtraFEC;
|
|
|
|
|
|
|
|
// Extras
|
|
|
|
extras$_ {t:Type} (## 8) [ length:(## 8) extra:t ] = Extras t;
|
|
|
|
|
2020-03-18 19:54:56 +01:00
|
|
|
extraStreamFlags#01 streamId:(## 8) flags:(## 8) enabled:flags.0?true dtx:flags.1?true extraEC:flags.2?true paused:flags.3?true = ExtraSignaling;
|
|
|
|
extraStreamCsd#02 streamId:(## 8) width:(## 16) height:(## 16) count:(## 8) [ length:(## 8) codecSpecificData:bytes ] = ExtraSignaling;
|
2020-03-15 19:44:00 +01:00
|
|
|
|
|
|
|
extraLanEndpoint#03 address:# port:(## 16) = ExtraSignaling;
|
|
|
|
extraIpv6Endpoint#07 address:(## 128) port:(## 16) = ExtraSignaling;
|
|
|
|
|
2020-03-18 21:43:44 +01:00
|
|
|
extraNetworkChanged#04 streamId:(## 8) flags:(## 8) dataSavingEnabled:flags.0?true = ExtraSignaling;
|
2020-03-15 19:44:00 +01:00
|
|
|
|
|
|
|
extraGroupCallKey#05 key:(## 256) = ExtraSignaling;
|
|
|
|
extraGroupCallUpgrade#06 = ExtraSignaling;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// All signaling starting from here can only be done on packets with streamID 0 (only signaling, no data).
|
|
|
|
// New init/initACK
|
2020-03-18 19:54:56 +01:00
|
|
|
extraInit#08 peerVersion:# minVersion:# flags:(## 8) audioCodecs:Extras<int> decoders:Extras<int> maxResolution:(## 8) dataSavingEnabled:flags.0?true groupCallSupported:flags.1?true videoSendSupported:flags.2?true videoRecvSupported:flags.3?true = ExtraSignaling;
|
2020-03-15 19:44:00 +01:00
|
|
|
extraInitAck#09 peerVersion:# minVersion:# streams:Extras<StreamInfo> = ExtraSignaling;
|
|
|
|
|
|
|
|
// Misc signaling
|
|
|
|
extraPing#A = ExtraSignaling;
|
|
|
|
extraPong#B seq:# = ExtraSignaling;
|
|
|
|
|
|
|
|
// Stream info
|
|
|
|
streamInfo$_ streamId:(## 8) type:(## 8) codec:# frameDurationIgnored:(## 16) enabled:(## 8)= StreamInfo;
|