Improve detection of unsupported codec.

merge-requests/6/head
Phil Taylor 2021-08-15 11:19:34 +01:00
rodzic 758724f8af
commit c5c0046e3a
2 zmienionych plików z 27 dodań i 19 usunięć

Wyświetl plik

@ -4,7 +4,7 @@
#include "udphandler.h" #include "udphandler.h"
#include "logcategories.h" #include "logcategories.h"
udpHandler::udpHandler(udpPreferences prefs,audioSetup rx, audioSetup tx) : udpHandler::udpHandler(udpPreferences prefs, audioSetup rx, audioSetup tx) :
controlPort(prefs.controlLANPort), controlPort(prefs.controlLANPort),
civPort(0), civPort(0),
audioPort(0), audioPort(0),
@ -237,10 +237,10 @@ void udpHandler::dataReceived()
{ {
status_packet_t in = (status_packet_t)r.constData(); status_packet_t in = (status_packet_t)r.constData();
if (in->type != 0x01) { if (in->type != 0x01) {
if (in->error == 0x00ffffff && !streamOpened) if (in->error == 0xffffffff && !streamOpened)
{ {
emit haveNetworkError(radioIP.toString(), "Auth failed, try rebooting the radio."); emit haveNetworkError(radioIP.toString(), "Connection failed, wait a few minutes or reboot the radio.");
qInfo(logUdp()) << this->metaObject()->className() << ": Auth failed, try rebooting the radio."; qInfo(logUdp()) << this->metaObject()->className() << ": Connection failed, wait a few minutes or reboot the radio.";
} }
else if (in->error == 0x00000000 && in->disc == 0x01) else if (in->error == 0x00000000 && in->disc == 0x01)
{ {
@ -272,6 +272,27 @@ void udpHandler::dataReceived()
{ {
login_response_packet_t in = (login_response_packet_t)r.constData(); login_response_packet_t in = (login_response_packet_t)r.constData();
if (in->type != 0x01) { if (in->type != 0x01) {
connectionType = in->connection;
qInfo(logUdp()) << "Got connection type:" << connectionType;
if (connectionType == "FTTH")
{
highBandwidthConnection = true;
}
if (connectionType != "WFVIEW") // NOT WFVIEW
{
if (rxSetup.codec >= 0x40 || txSetup.codec >= 0x40)
{
emit haveNetworkError(QString("UDP"), QString("Opus codec not supported, forcing LPCM16"));
if (rxSetup.codec >= 0x40)
rxSetup.codec = 0x04;
if (txSetup.codec >= 0x40)
txSetup.codec = 0x04;
}
}
if (in->error == 0xfeffffff) if (in->error == 0xfeffffff)
{ {
emit haveNetworkStatus("Invalid Username/Password"); emit haveNetworkStatus("Invalid Username/Password");
@ -295,20 +316,6 @@ void udpHandler::dataReceived()
} }
} }
if (!strcmp(in->connection, "FTTH"))
{
highBandwidthConnection = true;
}
if (!strcmp(in->connection, "WFVIEW"))
{
}
else {
if (rxSetup.codec >= 0x40 || txSetup.codec >= 0x40)
{
emit haveNetworkError(QString("UDP"),QString("Opus codec not supported"));
}
}
qInfo(logUdp()) << this->metaObject()->className() << ": Detected connection speed " << in->connection; qInfo(logUdp()) << this->metaObject()->className() << ": Detected connection speed " << in->connection;
} }
break; break;
@ -317,6 +324,7 @@ void udpHandler::dataReceived()
{ {
conninfo_packet_t in = (conninfo_packet_t)r.constData(); conninfo_packet_t in = (conninfo_packet_t)r.constData();
if (in->type != 0x01) { if (in->type != 0x01) {
devName = in->name; devName = in->name;
QHostAddress ip = QHostAddress(qToBigEndian(in->ipaddress)); QHostAddress ip = QHostAddress(qToBigEndian(in->ipaddress));
if (!streamOpened && in->busy) if (!streamOpened && in->busy)

Wyświetl plik

@ -120,7 +120,7 @@ public:
quint32 packetsLost=0; quint32 packetsLost=0;
quint16 seqPrefix = 0; quint16 seqPrefix = 0;
QString connectionType="";
int congestion = 0; int congestion = 0;