1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-12-02 09:37:52 +01:00
This commit is contained in:
Daniil Gentili 2017-07-01 19:41:22 +02:00
parent 11dbde9601
commit 4db0510e8d
6 changed files with 10 additions and 17 deletions

View File

@ -98,9 +98,7 @@ voip_crypto_functions_t VoIPController::crypto; // set it yourself upon initiali
extern FILE* tgvoipLogFile;
VoIPController::VoIPController(Php::Value pinputCallbacks, Php::Value poutputCallbacks) : activeNetItfName(""), currentAudioInput("default"), currentAudioOutput("default"){
inputCallbacks = pinputCallbacks;
outputCallbacks = poutputCallbacks;
VoIPController::VoIPController() : activeNetItfName(""), currentAudioInput("default"), currentAudioOutput("default"){
seq=1;
lastRemoteSeq=0;
state=STATE_WAIT_INIT;
@ -981,9 +979,9 @@ simpleAudioBlock random_id:long random_bytes:string raw_data:string = DecryptedA
if(!audioInput){
LOGI("before create audio io");
audioInput=tgvoip::audio::AudioInput::Create(inputCallbacks);
audioInput=tgvoip::audio::AudioInput::Create(this);
audioInput->Configure(48000, 16, 1);
audioOutput=tgvoip::audio::AudioOutput::Create(outputCallbacks);
audioOutput=tgvoip::audio::AudioOutput::Create(this);
audioOutput->Configure(48000, 16, 1);
echoCanceller=new EchoCanceller(config.enableAEC, config.enableNS, config.enableAGC);
encoder=new OpusEncoder(audioInput);

View File

@ -28,7 +28,6 @@
#include "EchoCanceller.h"
#include "CongestionControl.h"
#include "NetworkSocket.h"
#include "phpcpp.h"
#define LIBTGVOIP_VERSION "0.4.2"
@ -229,7 +228,7 @@ class AudioInputDevice : public AudioDevice{
class VoIPController
{
public:
VoIPController(Php::Value pinputCallbacks, Php::Value poutputCallbacks);
VoIPController();
~VoIPController();
void SetRemoteEndpoints(std::vector<Endpoint> endpoints, bool allowP2p);
@ -313,8 +312,6 @@ private:
OpusEncoder* encoder;
BlockingQueue* sendQueue;
EchoCanceller* echoCanceller;
Php::Value inputCallbacks;
Php::Value outputCallbacks;
std::vector<BufferOutputStream*> emptySendBuffers;
tgvoip_mutex_t sendBufferMutex;
tgvoip_mutex_t endpointsMutex;

View File

@ -46,9 +46,9 @@ AudioInput::AudioInput(std::string deviceID) : currentDevice(deviceID){
failed=false;
}
AudioInput *AudioInput::Create(Php::Value callbacks){
AudioInput *AudioInput::Create(void* controller){
#ifdef PHP_LIBTGVOIP
return new AudioInputPHP(callbacks);
return new AudioInputPHP(controller);
#else
#if defined(__ANDROID__)
return new AudioInputAndroid();

View File

@ -11,7 +11,6 @@
#include <vector>
#include <string>
#include "../MediaStreamItf.h"
#include <phpcpp.h>
namespace tgvoip{
@ -29,7 +28,7 @@ public:
bool IsInitialized();
virtual std::string GetCurrentDevice();
virtual void SetCurrentDevice(std::string deviceID);
static AudioInput* Create(Php::Value callbacks);
static AudioInput* Create(void* controller);
static void EnumerateDevices(std::vector<AudioInputDevice>& devs);
static int32_t GetEstimatedDelay();

View File

@ -42,9 +42,9 @@ int AudioOutput::systemVersion;
#endif
int32_t AudioOutput::estimatedDelay=60;
AudioOutput *AudioOutput::Create(Php::Value callbacks){
AudioOutput *AudioOutput::Create(void* controller){
#ifdef PHP_LIBTGVOIP
return new AudioOutputPHP(callbacks);
return new AudioOutputPHP(controller);
#else
#if defined(__ANDROID__)
if(systemVersion<21)

View File

@ -11,7 +11,6 @@
#include <string>
#include <vector>
#include "../MediaStreamItf.h"
#include <phpcpp.h>
namespace tgvoip{
@ -30,7 +29,7 @@ public:
static int32_t GetEstimatedDelay();
virtual std::string GetCurrentDevice();
virtual void SetCurrentDevice(std::string deviceID);
static AudioOutput* Create(Php::Value callbacks);
static AudioOutput* Create(void* controller);
static void EnumerateDevices(std::vector<AudioOutputDevice>& devs);
bool IsInitialized();