mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-11 07:07:53 +00:00
Added AGC on audio output because some echo cancellation implementations don't like loud audio in speakerphone mode; this should only be enabled when using the earpiece speaker, on devices that have one. Also, the AGC on the input is now configured with a much lower target level.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "audio/Resampler.h"
|
||||
#include "logging.h"
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define PACKET_SIZE (960*2)
|
||||
|
||||
@@ -222,6 +223,9 @@ void tgvoip::OpusDecoder::RunThread(){
|
||||
unsigned char *buf=bufferPool->Get();
|
||||
if(buf){
|
||||
if(size>0){
|
||||
for(std::vector<AudioEffect*>::iterator effect=postProcEffects.begin();effect!=postProcEffects.end();++effect){
|
||||
(*effect)->Process(reinterpret_cast<int16_t*>(processedBuffer+(PACKET_SIZE*i)), 960);
|
||||
}
|
||||
memcpy(buf, processedBuffer+(PACKET_SIZE*i), PACKET_SIZE);
|
||||
}else{
|
||||
LOGE("Error decoding, result=%d", size);
|
||||
@@ -255,3 +259,13 @@ void tgvoip::OpusDecoder::ResetQueue(){
|
||||
void tgvoip::OpusDecoder::SetJitterBuffer(JitterBuffer* jitterBuffer){
|
||||
this->jitterBuffer=jitterBuffer;
|
||||
}
|
||||
|
||||
void tgvoip::OpusDecoder::AddAudioEffect(AudioEffect *effect){
|
||||
postProcEffects.push_back(effect);
|
||||
}
|
||||
|
||||
void tgvoip::OpusDecoder::RemoveAudioEffect(AudioEffect *effect){
|
||||
std::vector<AudioEffect*>::iterator i=std::find(postProcEffects.begin(), postProcEffects.end(), effect);
|
||||
if(i!=postProcEffects.end())
|
||||
postProcEffects.erase(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user