mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-03 13:47:50 -04:00
Audio UDP/RTP: Opus: delete and re-create encoder state when changing its parameters
This commit is contained in:
parent
bd48a2feb5
commit
765ee4a8ba
@ -45,16 +45,12 @@ void AudioOpus::setEncoder(int32_t fs, int nChannels)
|
|||||||
bool newInstance = true;
|
bool newInstance = true;
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
if (m_encoderState)
|
if (m_encoderState) {
|
||||||
{
|
opus_encoder_destroy(m_encoderState);
|
||||||
error = opus_encoder_init(m_encoderState, fs, nChannels, OPUS_APPLICATION_AUDIO);
|
|
||||||
newInstance = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_encoderState = opus_encoder_create(fs, nChannels, OPUS_APPLICATION_AUDIO, &error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_encoderState = opus_encoder_create(fs, nChannels, OPUS_APPLICATION_AUDIO, &error);
|
||||||
|
|
||||||
if (error != OPUS_OK)
|
if (error != OPUS_OK)
|
||||||
{
|
{
|
||||||
qWarning("AudioOpus::setEncoder: %s error: %s", newInstance ? "create" : "init", opus_strerror(error));
|
qWarning("AudioOpus::setEncoder: %s error: %s", newInstance ? "create" : "init", opus_strerror(error));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user