Add a bit of logging for creating/destruction of opus

merge-requests/6/head
Phil Taylor 2021-08-15 11:36:08 +01:00
rodzic c5c0046e3a
commit 04562a6ca5
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -43,9 +43,11 @@ audioHandler::~audioHandler()
qDebug(logAudio()) << "Resampler closed";
}
if (encoder != Q_NULLPTR) {
qInfo(logAudio()) << "Destroying opus encoder";
opus_encoder_destroy(encoder);
}
if (decoder != Q_NULLPTR) {
qInfo(logAudio()) << "Destroying opus decoder";
opus_decoder_destroy(decoder);
}
}
@ -254,6 +256,7 @@ bool audioHandler::init(audioSetup setupIn)
opus_encoder_ctl(encoder, OPUS_SET_INBAND_FEC(1));
opus_encoder_ctl(encoder, OPUS_SET_DTX(1));
opus_encoder_ctl(encoder, OPUS_SET_PACKET_LOSS_PERC(5));
qInfo(logAudio()) << "Creating opus encoder: " << opus_strerror(opus_err);
}
}
else {
@ -261,15 +264,12 @@ bool audioHandler::init(audioSetup setupIn)
if (setup.codec == 0x40 || setup.codec == 0x80) {
// Opus codec
decoder = opus_decoder_create(setup.samplerate, setup.radioChan, &opus_err);
qInfo(logAudio()) << "Creating opus decoder: " << opus_strerror(opus_err);
}
}
wf_resampler_get_ratio(resampler, &ratioNum, &ratioDen);
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "wf_resampler_init() returned: " << resample_error << " ratioNum" << ratioNum << " ratioDen" << ratioDen;
if (opus_err < 0)
{
qInfo(logAudio()) << "Faile to create opus" << (setup.isinput ? "Encoder" : "Decoder") << opus_strerror(opus_err);
}
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "thread id" << QThread::currentThreadId();