diff --git a/plugins/opusCodec/src/OpusDecoder.cpp b/plugins/opusCodec/src/OpusDecoder.cpp index e95d813fb4..40e4954cb3 100644 --- a/plugins/opusCodec/src/OpusDecoder.cpp +++ b/plugins/opusCodec/src/OpusDecoder.cpp @@ -57,8 +57,9 @@ AthenaOpusDecoder::AthenaOpusDecoder(int sampleRate, int numChannels) { } AthenaOpusDecoder::~AthenaOpusDecoder() { - if (_decoder) + if (_decoder) { opus_decoder_destroy(_decoder); + } } @@ -71,7 +72,7 @@ void AthenaOpusDecoder::decode(const QByteArray &encodedBuffer, QByteArray &deco * _opusNumChannels; decodedBuffer.resize(bufferSize); - int bufferFrames = decodedBuffer.size() / _opusNumChannels / static_cast(sizeof( opus_int16 )); + int bufferFrames = decodedBuffer.size() / _opusNumChannels / static_cast(sizeof(opus_int16)); qCDebug(decoder) << "Opus decode: encodedBytes = " << encodedBuffer.length() << "; decodedBufferBytes = " << decodedBuffer.size() << "; frameCount = " << bufferFrames; @@ -109,7 +110,7 @@ void AthenaOpusDecoder::lostFrame(QByteArray &decodedBuffer) { int bufferFrames = decodedBuffer.size() / _opusNumChannels / static_cast(sizeof(opus_int16)); int decoded_frames = opus_decode(_decoder, nullptr, 0, reinterpret_cast(decodedBuffer.data()), - bufferFrames, 1 ); + bufferFrames, 1); if (decoded_frames >= 0) { diff --git a/plugins/opusCodec/src/OpusEncoder.cpp b/plugins/opusCodec/src/OpusEncoder.cpp index 124ca3e3e1..75b190b0dc 100644 --- a/plugins/opusCodec/src/OpusEncoder.cpp +++ b/plugins/opusCodec/src/OpusEncoder.cpp @@ -160,12 +160,12 @@ int AthenaOpusEncoder::getMaxBandwidth() const { return returnValue; } -void AthenaOpusEncoder::setMaxBandwidth(int maxbw) { +void AthenaOpusEncoder::setMaxBandwidth(int maxBandwidth) { assert(_encoder); - int errorCode = opus_encoder_ctl(_encoder, OPUS_SET_MAX_BANDWIDTH(maxbw)); + int errorCode = opus_encoder_ctl(_encoder, OPUS_SET_MAX_BANDWIDTH(maxBandwidth)); if (errorCode != OPUS_OK) { - qCWarning(encoder) << "Error when setting max bandwidth to " << maxbw << ": " << errorToString(errorCode); + qCWarning(encoder) << "Error when setting max bandwidth to " << maxBandwidth << ": " << errorToString(errorCode); } } diff --git a/plugins/opusCodec/src/OpusEncoder.h b/plugins/opusCodec/src/OpusEncoder.h index 107b0f82ca..10640bf409 100644 --- a/plugins/opusCodec/src/OpusEncoder.h +++ b/plugins/opusCodec/src/OpusEncoder.h @@ -16,11 +16,6 @@ class AthenaOpusEncoder : public Encoder { public: - const int DEFAULT_BITRATE = 128000; - const int DEFAULT_COMPLEXITY = 10; - const int DEFAULT_APPLICATION = OPUS_APPLICATION_VOIP; - const int DEFAULT_SIGNAL = OPUS_AUTO; - AthenaOpusEncoder(int sampleRate, int numChannels); ~AthenaOpusEncoder() override; @@ -66,6 +61,11 @@ public: private: + const int DEFAULT_BITRATE = 128000; + const int DEFAULT_COMPLEXITY = 10; + const int DEFAULT_APPLICATION = OPUS_APPLICATION_VOIP; + const int DEFAULT_SIGNAL = OPUS_AUTO; + int _opusSampleRate = 0; int _opusChannels = 0; int _opusExpectedLoss = 0;