diff options
author | Benjamin Jemlich <pcgod@users.sourceforge.net> | 2011-04-29 12:53:57 +0400 |
---|---|---|
committer | Benjamin Jemlich <pcgod@users.sourceforge.net> | 2011-05-14 12:09:08 +0400 |
commit | 900f1e56774900eb088f2ba1723b86b33d46a540 (patch) | |
tree | 6c257d01f6c12668185d935c1e2830fb5ebd538f /src | |
parent | d9324c2d787ac2956320d8533b3ddad65e9624e4 (diff) |
Opus support for the server
Untested but should work because it's only a minor modification
of the existing CELT/Speex code.
Diffstat (limited to 'src')
-rw-r--r-- | src/Message.h | 2 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/Message.h b/src/Message.h index 526e5ccff..5f9038ffc 100644 --- a/src/Message.h +++ b/src/Message.h @@ -69,7 +69,7 @@ class MessageHandler { public: - enum UDPMessageType { UDPVoiceCELTAlpha, UDPPing, UDPVoiceSpeex, UDPVoiceCELTBeta }; + enum UDPMessageType { UDPVoiceCELTAlpha, UDPPing, UDPVoiceSpeex, UDPVoiceCELTBeta, UDPVoiceOpus }; #define MUMBLE_MH_MSG(x) x, enum MessageType { diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 1adcbe23e..8f812149b 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -759,7 +759,8 @@ void Server::run() { switch (msgType) { case MessageHandler::UDPVoiceSpeex: case MessageHandler::UDPVoiceCELTAlpha: - case MessageHandler::UDPVoiceCELTBeta: { + case MessageHandler::UDPVoiceCELTBeta: + case MessageHandler::UDPVoiceOpus: { u->bUdp = true; processMsg(u, buffer, len); break; @@ -882,6 +883,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { char buffer[UDP_PACKET_SIZE]; PacketDataStream pdi(data + 1, len - 1); PacketDataStream pds(buffer+1, UDP_PACKET_SIZE-1); + MessageHandler::UDPMessageType msgType = static_cast<MessageHandler::UDPMessageType>((buffer[0] >> 5) & 0x7); unsigned int type = data[0] & 0xe0; unsigned int target = data[0] & 0x1f; unsigned int poslen; @@ -896,10 +898,16 @@ void Server::processMsg(ServerUser *u, const char *data, int len) { pdi >> counter; - do { - counter = pdi.next8(); - pdi.skip(counter & 0x7f); - } while ((counter & 0x80) && pdi.isValid()); + if (msgType != MessageHandler::UDPVoiceOpus) { + do { + counter = pdi.next8(); + pdi.skip(counter & 0x7f); + } while ((counter & 0x80) && pdi.isValid()); + } else { + unsigned int voicelen; + pds >> voicelen; + pds.skip(voicelen); + } poslen = pdi.left(); @@ -1252,6 +1260,7 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser * case MessageHandler::UDPVoiceCELTAlpha: case MessageHandler::UDPVoiceCELTBeta: case MessageHandler::UDPVoiceSpeex: + case MessageHandler::UDPVoiceOpus: processMsg(u, buffer, l); break; default: |