diff options
author | Robert Adam <dev@robert-adam.de> | 2021-11-22 13:17:58 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2022-03-27 10:49:58 +0300 |
commit | 1d45d991aa4d53b6c1bd7d7cae0126a21f3991e1 (patch) | |
tree | bd810f21a6cc43fa718e0f2807ac373403244edf /src/PacketDataStream.h | |
parent | 06b56530997fb623c9690ad7bdb8d3f5915d48a0 (diff) |
CHANGE: Use Protobuf for UDP messages
Previously Mumble was using a custom binary format for transmitting data
via UDP (mainly audio). This has worked for a long time but besides
being inconvenient for 3rdParty implementors (they had to manually
re-implement encoding and decoding support for this format) this format
was not very flexible and changes to the data format were very hard.
In order to improve on this situation, this commit introduces changes
that allow to use Protobuf for the UDP messages as well (it's already
used for TCP). With that it should be relatively easy to extend/change
the UDP packet formats in the future and 3rdParty implementors can now
simply use Protobuf to handle decoding/encoding packets for them (much
less work and much less prone to errors).
Since the new Protobuf format is incompatible with the old UDP format,
this commit also includes support for dealing with older clients or
servers that don't recognize the new protocol yet. That way the new
protocol format is only used if both the client and the server are
recent enough to have it implemented (assumed to be the case >=1.5.0).
Note also that the server will make sure that clients using the old and
the new format can seamlessly communicate with one another.
Therefore, on the surface it should not be noticeable to the user which
protocol is currently used.
Note also that the new protocol format only supports Opus as an audio
codec. If one of the legacy codecs is to be used, the legacy packet
format has to be used as well. However, all codecs except for Opus will
be removed from Mumble in the future anyway.
Fixes #4350
Diffstat (limited to 'src/PacketDataStream.h')
-rw-r--r-- | src/PacketDataStream.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/PacketDataStream.h b/src/PacketDataStream.h index 30ba8d01a..f3241bb92 100644 --- a/src/PacketDataStream.h +++ b/src/PacketDataStream.h @@ -93,6 +93,8 @@ public: const unsigned char *dataPtr() const { return reinterpret_cast< const unsigned char * >(&data[offset]); } + unsigned char *dataPtr() { return reinterpret_cast< unsigned char * >(&data[offset]); } + const char *charPtr() const { return reinterpret_cast< const char * >(&data[offset]); } QByteArray dataBlock(quint32 len) { @@ -116,6 +118,8 @@ protected: } public: + PacketDataStream(const unsigned char *d, int msize) { setup(const_cast< unsigned char * >(d), msize); }; + PacketDataStream(const char *d, int msize) { setup(const_cast< unsigned char * >(reinterpret_cast< const unsigned char * >(d)), msize); }; |