mirror of
https://github.com/danog/libtgvoip.git
synced 2024-11-26 12:14:39 +01:00
Fix audio quality issues
This commit is contained in:
parent
7186f51a6f
commit
2252eb1a20
@ -5,7 +5,7 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#define LOG_PACKETS 1
|
||||
//#define LOG_PACKETS 1
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -108,7 +108,7 @@ double AudioPacketSender::setPacketLoss(double percent)
|
||||
|
||||
if (percent > 2)
|
||||
{
|
||||
resendCount = std::clamp(percent / 2, 0.0, 3.0);
|
||||
resendCount = std::clamp(percent / 2, 0.0, 2.0);
|
||||
}
|
||||
/*else if (percent > 5)
|
||||
{
|
||||
|
@ -252,6 +252,7 @@ int tgvoip::OpusDecoder::DecodeNextFrame()
|
||||
consecutiveLostPackets = 0;
|
||||
if (prevWasEC != isEC && size)
|
||||
{
|
||||
LOGE("========== JITTER: Switching from %s to %s ==========", prevWasEC ? "EC" : "main", isEC ? "EC" : "main");
|
||||
// It turns out the waveforms generated by the PLC feature are also great to help smooth out the
|
||||
// otherwise audible transition between the frames from different decoders. Those are basically an extrapolation
|
||||
// of the previous successfully decoded data -- which is exactly what we need here.
|
||||
@ -280,6 +281,7 @@ int tgvoip::OpusDecoder::DecodeNextFrame()
|
||||
else
|
||||
{
|
||||
size = opus_decode(prevWasEC ? ecDec : dec, NULL, 0, (opus_int16 *)decodeBuffer, packetsPerFrame * 960, 0);
|
||||
LOGE("========== JITTER: OPUS PLC ==========");
|
||||
//LOGV("PLC");
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,8 @@ void tgvoip::OpusEncoder::Stop()
|
||||
|
||||
void tgvoip::OpusEncoder::SetBitrate(uint32_t bitrate)
|
||||
{
|
||||
requestedBitrate = bitrate;
|
||||
LOGE("=============== SETTING BITRATE TO %u ===============", bitrate);
|
||||
requestedBitrate = 20000;
|
||||
}
|
||||
|
||||
void tgvoip::OpusEncoder::Encode(int16_t *data, size_t len)
|
||||
|
@ -279,7 +279,7 @@ void VoIPController::UpdateAudioBitrate()
|
||||
int act = conctl.GetBandwidthControlAction();
|
||||
if (dynamic_cast<AudioPacketSender *>(GetStreamByType<OutgoingAudioStream>()->packetSender.get())->getShittyInternetMode())
|
||||
{
|
||||
encoder->SetBitrate(8000);
|
||||
//encoder->SetBitrate(8000);
|
||||
}
|
||||
else if (act == TGVOIP_CONCTL_ACT_DECREASE)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user