diff --git a/VoIPController.cpp b/VoIPController.cpp index 41e688d..f8409a7 100644 --- a/VoIPController.cpp +++ b/VoIPController.cpp @@ -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); diff --git a/VoIPController.h b/VoIPController.h index c0979cb..0517411 100644 --- a/VoIPController.h +++ b/VoIPController.h @@ -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 endpoints, bool allowP2p); @@ -313,8 +312,6 @@ private: OpusEncoder* encoder; BlockingQueue* sendQueue; EchoCanceller* echoCanceller; - Php::Value inputCallbacks; - Php::Value outputCallbacks; std::vector emptySendBuffers; tgvoip_mutex_t sendBufferMutex; tgvoip_mutex_t endpointsMutex; diff --git a/audio/AudioInput.cpp b/audio/AudioInput.cpp index 6de9890..293d610 100644 --- a/audio/AudioInput.cpp +++ b/audio/AudioInput.cpp @@ -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(); diff --git a/audio/AudioInput.h b/audio/AudioInput.h index 222b0c8..97d6703 100644 --- a/audio/AudioInput.h +++ b/audio/AudioInput.h @@ -11,7 +11,6 @@ #include #include #include "../MediaStreamItf.h" -#include 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& devs); static int32_t GetEstimatedDelay(); diff --git a/audio/AudioOutput.cpp b/audio/AudioOutput.cpp index 19a7c06..a005ec7 100644 --- a/audio/AudioOutput.cpp +++ b/audio/AudioOutput.cpp @@ -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) diff --git a/audio/AudioOutput.h b/audio/AudioOutput.h index c0f02a4..e8dca04 100644 --- a/audio/AudioOutput.h +++ b/audio/AudioOutput.h @@ -11,7 +11,6 @@ #include #include #include "../MediaStreamItf.h" -#include 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& devs); bool IsInitialized();