22 #include "opus/opus.h" 24 #include <QMutexLocker> 31 m_mutex(QMutex::Recursive)
33 qDebug(
"AudioOpus::AudioOpus: libopus version %s", opus_get_version_string());
46 bool newInstance =
true;
47 QMutexLocker mutexLocker(&
m_mutex);
53 m_encoderState = opus_encoder_create(fs, nChannels, OPUS_APPLICATION_AUDIO, &error);
57 qWarning(
"AudioOpus::setEncoder: error: %s", opus_strerror(error));
63 qDebug(
"AudioOpus::setEncoder: fs: %d, nChannels: %d", fs, nChannels);
71 qWarning(
"AudioOpus::setEncoder: set bitrate error: %s", opus_strerror(error));
80 qWarning(
"AudioOpus::setEncoder: set constant bitrate error: %s", opus_strerror(error));
88 QMutexLocker mutexLocker(&
m_mutex);
92 qWarning(
"AudioOpus::encode: encoder not initialized");
100 qWarning(
"AudioOpus::encode failed: %s", opus_strerror(nbBytes));
static const int m_bitrate
Fixed 64kb/s bitrate (8kB/s)
static const int m_maxPacketSize
int encode(int frameSize, int16_t *in, uint8_t *out)
void setEncoder(int32_t fs, int nChannels)
OpusEncoder * m_encoderState