Verified Commit 96450be0 authored by Phobos D'thorga's avatar Phobos D'thorga 🐲
Browse files

* Improved error handling for (Q)Xmpp-related code.

* QSsl errors shouldn't cause an unhandled exception now within the (Q)Xmpp code, now that they're properly handled too.
* Minor bug-fix applied to the Opus encoding code for QAudioInput's. Although the functions in relation to this are largely non-functioning still, and we might require outsider help as such (Issue #13).
parent 0745e07d
Pipeline #1038 passed with stages
in 26 minutes and 7 seconds
......@@ -448,7 +448,7 @@ void GkAudioEncoding::encodeOpus(const qint32 &bitrate, qint32 sample_rate, cons
//
// Convert from littleEndian...
for (qint32 j = 0; j < AUDIO_OPUS_FRAMES_PER_BUFFER; ++j) {
input_frame[j] = qFromLittleEndian<opus_int16>(m_buffer.data() + j * sizeof(opus_int16));
input_frame[j] = qFromLittleEndian<opus_int16>(m_buffer.data() + j * 2);
}
//
......@@ -465,7 +465,7 @@ void GkAudioEncoding::encodeOpus(const qint32 &bitrate, qint32 sample_rate, cons
//
// Commit out the memory buffer to the file itself!
const qint32 buf_size = AUDIO_OPUS_FRAMES_PER_BUFFER * sizeof(opus_int16);
const qint32 buf_size = AUDIO_OPUS_FRAMES_PER_BUFFER * 2;
m_buffer.remove(0, buf_size);
ret -= buf_size;
}
......
......@@ -246,6 +246,14 @@ void GkEventLogger::publishEvent(const QString &event, const GkSeverity &severit
*/
void GkEventLogger::recvXmppLog(QXmppLogger::MessageType msg_type, QString msg)
{
if (msg.isNull()) {
return;
}
if (msg.isEmpty()) {
return;
}
GkSeverity severity;
switch (msg_type) {
case QXmppLogger::MessageType::NoMessage:
......
......@@ -1687,8 +1687,9 @@ void GkXmppClient::handleError(QXmppClient::Error errorMsg)
*/
void GkXmppClient::handleError(const QString &errorMsg)
{
if (!errorMsg.isEmpty()) {
if (isConnected() || m_netState == GkNetworkState::Connecting) {
if (!errorMsg.isNull() && !errorMsg.isEmpty()) {
if (isConnected() || m_netState != GkNetworkState::Disconnected) {
m_netState = GkNetworkState::Disconnected;
killConnectionFromServer(true);
}
......@@ -1709,7 +1710,9 @@ void GkXmppClient::handleSslErrors(const QList<QSslError> &errorMsg)
{
if (!errorMsg.isEmpty()) {
for (const auto &error: errorMsg) {
emit sendError(error.errorString());
if (!error.errorString().isEmpty()) {
emit sendError(error.errorString());
}
}
}
......@@ -1938,6 +1941,7 @@ void GkXmppClient::killConnectionFromServer(const bool &askReconnectPolicy)
{
m_askToReconnectAuto = askReconnectPolicy;
disconnectFromServer();
m_netState = GkNetworkState::Disconnected;
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment