From e6211103f04f728200504c0756eff3561746e218 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 16 Sep 2020 12:22:33 +0000 Subject: [PATCH] VoIP fixes --- VoIPController.h | 1 + controller/audio/OpusEncoder.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/VoIPController.h b/VoIPController.h index 7d61286..79c06f0 100755 --- a/VoIPController.h +++ b/VoIPController.h @@ -91,6 +91,7 @@ enum enum { + STATE_CREATED = 0, STATE_WAIT_INIT = 1, STATE_WAIT_INIT_ACK, STATE_ESTABLISHED, diff --git a/controller/audio/OpusEncoder.cpp b/controller/audio/OpusEncoder.cpp index 5a46ad3..02f3cbb 100755 --- a/controller/audio/OpusEncoder.cpp +++ b/controller/audio/OpusEncoder.cpp @@ -41,11 +41,11 @@ tgvoip::OpusEncoder::OpusEncoder(const std::shared_ptr &source, this->source = source; source->SetCallback(tgvoip::OpusEncoder::Callback, this); - enc = opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, NULL); + enc = opus_encoder_create(48000, 1, OPUS_APPLICATION_AUDIO, NULL); opus_encoder_ctl(enc, OPUS_SET_COMPLEXITY(10)); opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(1)); opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC(1)); - opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE)); + opus_encoder_ctl(enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC)); opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(OPUS_AUTO)); opus_encoder_ctl(enc, OPUS_SET_BITRATE(OPUS_AUTO)); requestedBitrate = 20000; @@ -66,7 +66,7 @@ tgvoip::OpusEncoder::OpusEncoder(const std::shared_ptr &source, { secondaryEncoder = opus_encoder_create(48000, 1, OPUS_APPLICATION_VOIP, NULL); opus_encoder_ctl(secondaryEncoder, OPUS_SET_COMPLEXITY(10)); - opus_encoder_ctl(secondaryEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE)); + opus_encoder_ctl(secondaryEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC)); opus_encoder_ctl(secondaryEncoder, OPUS_SET_BITRATE(currentSecondaryBitrate)); } else