Murmur: Add codec warnings and ignore non-Opus packets if Opus is enabled

Also includes the CELT warning for "broken" clients by Nicos Gollan.
This commit is contained in:
Benjamin Jemlich 2012-06-08 23:42:17 +02:00
parent 144347812d
commit 7ec4f6a67c
2 changed files with 12 additions and 0 deletions

View File

@ -200,11 +200,13 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg
mpcrypt.set_client_nonce(std::string(reinterpret_cast<const char *>(uSource->csCrypt.decrypt_iv), AES_BLOCK_SIZE));
sendMessage(uSource, mpcrypt);
bool fake_celt_support = false;
if (msg.celt_versions_size() > 0) {
for (int i=0;i < msg.celt_versions_size(); ++i)
uSource->qlCodecs.append(msg.celt_versions(i));
} else {
uSource->qlCodecs.append(static_cast<qint32>(0x8000000b));
fake_celt_support = true;
}
uSource->bOpus = msg.opus();
recheckCodecVersions();
@ -216,6 +218,12 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg
mpcv.set_opus(bOpus);
sendMessage(uSource, mpcv);
if (!bOpus && uSource->bOpus && fake_celt_support) {
sendTextMessage(NULL, uSource, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the CELT codec, you won't be able to talk to or hear most clients. Please make sure your client was built with CELT support."));
} else if (bOpus && !uSource->bOpus) {
sendTextMessage(NULL, uSource, false, QLatin1String("<strong>WARNING:</strong> Your client doesn't support the Opus codec, you won't be able to talk or hear anyone. Please upgrade to a client with Opus support."));
}
// Transmit channel tree
QQueue<Channel *> q;
QSet<Channel *> chans;

View File

@ -772,6 +772,8 @@ void Server::run() {
case MessageHandler::UDPVoiceSpeex:
case MessageHandler::UDPVoiceCELTAlpha:
case MessageHandler::UDPVoiceCELTBeta:
if (bOpus)
break;
case MessageHandler::UDPVoiceOpus: {
u->bUdp = true;
processMsg(u, buffer, len);
@ -1274,6 +1276,8 @@ void Server::message(unsigned int uiType, const QByteArray &qbaMsg, ServerUser *
case MessageHandler::UDPVoiceCELTAlpha:
case MessageHandler::UDPVoiceCELTBeta:
case MessageHandler::UDPVoiceSpeex:
if (bOpus)
break;
case MessageHandler::UDPVoiceOpus:
processMsg(u, buffer, l);
break;