moq-wg / moq-transport

draft-ietf-moq-transport
Other
83 stars 20 forks source link

Can we make the control message length field 16 bits instead of varint? #554

Open afrind opened 4 weeks ago

afrind commented 4 weeks ago

It's very annoying to write a message serializer for the current messages. Doing it in two-passes (one to compute the length, one to serialize) is one option. Using some kind of buffer chaining is another. But do we need to? The control messages aren't large, so I don't think we need more than 64k for any single message. They also aren't so frequent that we need to shave a length byte for 64 byte messages. Using a fixed size length allows you to pin a placeholder, serialize the message, and write the actual length back.

afrind commented 4 weeks ago

FWIW - right now I'm just adding 16 bits of space and always encoding a 2 byte varint, and restricting my control msgs to 14 bits.

ianswett commented 4 weeks ago

We could, but I'm not sure there's an advantage over your approach of only using 14 bits? For those who care about saving an extra byte, at least for some messages that are always short, they can use the 1 byte encoding.

fluffy commented 3 weeks ago

Isn't this just as annoying for all the varints everywhere in the control message ? Just trying to get at if there is some reason this first one is particularly irritating?