1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-30 04:39:03 +01:00

Merge pull request #58 from telegramdesktop/tdesktop

Fix build for Linux.
This commit is contained in:
Gregory K 2018-11-09 20:40:40 +03:00 committed by GitHub
commit 296187a443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 14 deletions

View File

@ -34,7 +34,7 @@ AudioOutput* AudioIOCallback::GetOutput(){
#pragma mark - Input
AudioInputCallback::AudioInputCallback(){
thread=new Thread(new MethodPointer<AudioInputCallback>(&AudioInputCallback::RunThread, this), NULL);
thread=new Thread(std::bind(&AudioInputCallback::RunThread, this));
thread->SetName("AudioInputCallback");
}
@ -60,7 +60,7 @@ void AudioInputCallback::SetDataCallback(std::function<void(int16_t*, size_t)> c
dataCallback=c;
}
void AudioInputCallback::RunThread(void*){
void AudioInputCallback::RunThread(){
int16_t buf[960];
while(running){
double t=VoIPController::GetCurrentTime();
@ -76,7 +76,7 @@ void AudioInputCallback::RunThread(void*){
#pragma mark - Output
AudioOutputCallback::AudioOutputCallback(){
thread=new Thread(new MethodPointer<AudioOutputCallback>(&AudioOutputCallback::RunThread, this), NULL);
thread=new Thread(std::bind(&AudioOutputCallback::RunThread, this));
thread->SetName("AudioOutputCallback");
}
@ -106,7 +106,7 @@ void AudioOutputCallback::SetDataCallback(std::function<void(int16_t*, size_t)>
dataCallback=c;
}
void AudioOutputCallback::RunThread(void*){
void AudioOutputCallback::RunThread(){
int16_t buf[960];
while(running){
double t=VoIPController::GetCurrentTime();

View File

@ -22,7 +22,7 @@ namespace tgvoip{
virtual void Stop() override;
void SetDataCallback(std::function<void(int16_t*, size_t)> c);
private:
void RunThread(void*);
void RunThread();
bool running=false;
bool recording=false;
Thread* thread;
@ -38,7 +38,7 @@ namespace tgvoip{
virtual bool IsPlaying() override;
void SetDataCallback(std::function<void(int16_t*, size_t)> c);
private:
void RunThread(void*);
void RunThread();
bool running=false;
bool playing=false;
Thread* thread;

View File

@ -54,7 +54,7 @@ void AudioInputALSA::Start(){
return;
isRecording=true;
thread=new Thread(new MethodPointer<AudioInputALSA>(&AudioInputALSA::RunThread, this), NULL);
thread=new Thread(std::bind(&AudioInputALSA::RunThread, this));
thread->SetName("AudioInputALSA");
thread->Start();
}
@ -69,7 +69,7 @@ void AudioInputALSA::Stop(){
thread=NULL;
}
void AudioInputALSA::RunThread(void* arg){
void AudioInputALSA::RunThread(){
unsigned char buffer[BUFFER_SIZE*2];
snd_pcm_sframes_t frames;
while(isRecording){

View File

@ -25,7 +25,7 @@ public:
static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
private:
void RunThread(void* arg);
void RunThread();
int (*_snd_pcm_open)(snd_pcm_t** pcm, const char* name, snd_pcm_stream_t stream, int mode);
int (*_snd_pcm_set_params)(snd_pcm_t* pcm, snd_pcm_format_t format, snd_pcm_access_t access, unsigned int channels, unsigned int rate, int soft_resample, unsigned int latency);

View File

@ -53,7 +53,7 @@ void AudioOutputALSA::Start(){
return;
isPlaying=true;
thread=new Thread(new MethodPointer<AudioOutputALSA>(&AudioOutputALSA::RunThread, this), NULL);
thread=new Thread(std::bind(&AudioOutputALSA::RunThread, this));
thread->SetName("AudioOutputALSA");
thread->Start();
}
@ -71,7 +71,7 @@ void AudioOutputALSA::Stop(){
bool AudioOutputALSA::IsPlaying(){
return isPlaying;
}
void AudioOutputALSA::RunThread(void* arg){
void AudioOutputALSA::RunThread(){
unsigned char buffer[BUFFER_SIZE*2];
snd_pcm_sframes_t frames;
while(isPlaying){

View File

@ -25,7 +25,7 @@ public:
static void EnumerateDevices(std::vector<AudioOutputDevice>& devs);
private:
void RunThread(void* arg);
void RunThread();
int (*_snd_pcm_open)(snd_pcm_t** pcm, const char* name, snd_pcm_stream_t stream, int mode);
int (*_snd_pcm_set_params)(snd_pcm_t* pcm, snd_pcm_format_t format, snd_pcm_access_t access, unsigned int channels, unsigned int rate, int soft_resample, unsigned int latency);

View File

@ -11,6 +11,7 @@
#include <netdb.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include "../../logging.h"