mirror of
https://github.com/danog/php-libtgvoip.git
synced 2024-11-30 04:19:26 +01:00
Time for segfaults
This commit is contained in:
parent
3e38322214
commit
d5c236087c
12
Makefile
12
Makefile
@ -9,12 +9,12 @@
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
INCLUDES = -Ilibtgvoip -I/usr/include/opus -I/usr/local/ssl/ -Ilibtgvoip/webrtc_dsp
|
||||
LDINCLUDES = ${INCLUDES}
|
||||
CXXFLAGS = ${INCLUDES} -Wall -O0 -c -std=c++11 -fpic -finline-functions -ffast-math -fno-strict-aliasing -DUSE_KISS_FFT -DFIXED_POINT -DPHP_LIBTGVOIP -DWEBRTC_POSIX -DTGVOIP_USE_DESKTOP_DSP -DWEBRTC_APM_DEBUG_DUMP=0 -g -DTGVOIP_USE_CXX11_LIB -o
|
||||
CFLAGS = ${INCLUDES} -O0 -DUSE_KISS_FFT -fexceptions -fpic -DTGVOIP_USE_CXX11_LIB -DPHP_LIBTGVOIP -DWEBRTC_POSIX -DTGVOIP_USE_DESKTOP_DSP -DWEBRTC_APM_DEBUG_DUMP=0 -g
|
||||
INCLUDES = -Ilibtgvoip -I/usr/include/opus -I/usr/local/ssl/include/ -Ilibtgvoip/webrtc_dsp
|
||||
LDINCLUDES = -L/usr/local/ssl/lib
|
||||
CXXFLAGS = ${INCLUDES} -O0 -Wall -c -std=c++11 -fpic -finline-functions -ffast-math -fno-strict-aliasing -DUSE_KISS_FFT -DFIXED_POINT -DPHP_LIBTGVOIP -DWEBRTC_POSIX -DTGVOIP_USE_DESKTOP_DSP -DWEBRTC_APM_DEBUG_DUMP=0 -g -DTGVOIP_USE_CXX11_LIB -o
|
||||
CFLAGS = ${INCLUDES} -O0 -DUSE_KISS_FFT -fexceptions -fpic -DPHP_LIBTGVOIP -DWEBRTC_POSIX -DTGVOIP_USE_DESKTOP_DSP -DWEBRTC_APM_DEBUG_DUMP=0 -g
|
||||
|
||||
LDFLAGS = -shared -lphpcpp ${LDINCLUDES} -lopus -lpthread -lstdc++ -Wl,-z,defs -lcrypto -lssl -lm
|
||||
LFLAGS = -shared ${LDINCLUDES} -Wl,--verbose -pthread -lphpcpp -lopus -lpthread -lstdc++ -lcrypto -lssl -lm -Wl,-z,defs
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
CXXFLAGS += -mfloat-abi=softfp -mfpu=neon
|
||||
@ -136,7 +136,7 @@ OBJECTS = $(OBJECTS_CC:%.c=%.o)
|
||||
all: ${OBJECTS} ${EXTENSION}
|
||||
|
||||
${EXTENSION}: ${OBJECTS}
|
||||
${CC} ${LDFLAGS} -o $@ ${OBJECTS}
|
||||
${CC} ${LFLAGS} -o $@ ${OBJECTS}
|
||||
|
||||
${OBJECTS}:
|
||||
|
||||
|
@ -24,6 +24,8 @@ AudioInputPHP::AudioInputPHP(Php::Value callbacks){
|
||||
AudioInputPHP::~AudioInputPHP(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AudioInputPHP::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels) {
|
||||
configureMethod((int32_t)sampleRate, (int32_t)bitsPerSample, (int32_t)channels);
|
||||
}
|
||||
@ -31,9 +33,8 @@ void AudioInputPHP::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint3
|
||||
void AudioInputPHP::Start(){
|
||||
if(running)
|
||||
return;
|
||||
startMethod();
|
||||
running = true;
|
||||
|
||||
startMethod();
|
||||
}
|
||||
|
||||
void AudioInputPHP::Stop(){
|
||||
@ -41,11 +42,18 @@ void AudioInputPHP::Stop(){
|
||||
running = false;
|
||||
}
|
||||
bool AudioInputPHP::writeFrames(const char* data){
|
||||
if(!running)
|
||||
if (running) {
|
||||
LOGE("STARTED");
|
||||
unsigned char * buf = (unsigned char *) malloc(960*2*sizeof(unsigned char));
|
||||
memcpy(buf, data, 960*2);
|
||||
InvokeCallback(buf, (size_t)960*2);
|
||||
delete buf;
|
||||
return true;
|
||||
} else {
|
||||
LOGE("NOT STARTED");
|
||||
return false;
|
||||
unsigned char * buf = (unsigned char *) malloc(960*2);
|
||||
memcpy(buf, data, 960*2);
|
||||
InvokeCallback(buf, (size_t)960*2);
|
||||
delete buf;
|
||||
return true;
|
||||
}/*
|
||||
if (!running) {
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ AudioOutputPHP::AudioOutputPHP(Php::Value callbacks){
|
||||
stopMethod = callbacks["stop"];
|
||||
configureMethod = callbacks["configure"];
|
||||
getLevelMethod = callbacks["get_level"];
|
||||
running = false;
|
||||
}
|
||||
AudioOutputPHP::~AudioOutputPHP(){
|
||||
}
|
||||
|
||||
|
||||
void AudioOutputPHP::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){
|
||||
configureMethod((int32_t)sampleRate, (int32_t)bitsPerSample, (int32_t)channels);
|
||||
}
|
||||
@ -28,8 +30,8 @@ void AudioOutputPHP::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint
|
||||
void AudioOutputPHP::Start(){
|
||||
if(running)
|
||||
return;
|
||||
startMethod();
|
||||
running = true;
|
||||
startMethod();
|
||||
}
|
||||
|
||||
void AudioOutputPHP::Stop(){
|
||||
|
Loading…
Reference in New Issue
Block a user