[Speex-dev] speex_encode segfault
Michele "O-Zone" Pinassi
zerozone.liste at gmail.com
Thu Jun 30 01:55:55 PDT 2005
Hi,
i'm following encoder example in the manual.pdf of speex documentation. Here's
my portion of code:
int SPEEX_EncodePCM(struct _IDA_ClientSocket *IDA,char *buffer,unsigned char
*PCM,int num_samples) {
int ret,c,d=0,nbBytes,ttBytes=0;
float PCM_F[160];
char cBits[200];
#ifndef DISABLESPEEX
speex_bits_reset(&IDA->speex_bits);
for(c=0;c<num_samples;c++) {
PCM_F[d] = (float)((int)PCM[c] << 8) - 32640;
if(d >= 159) {
speex_encode(IDA->speex_state,PCM_F,&IDA->speex_bits);
nbBytes = speex_bits_write(&IDA->speex_bits, cBits, 200);
memcpy(buffer+ttBytes,cBits,nbBytes);
ttBytes += nbBytes;
d = 0;
} else {
d++;
}
}
LOG_Write(LOG_DEBUG,"[%s:%d] Speex frame:
%d\n",__FILE__,__LINE__,ttBytes);
return ttBytes;
#endif
}
int SPEEX_Init(struct _IDA_ClientSocket *IDA) {
int tmp;
IDA->speex_state = speex_encoder_init(&speex_nb_mode);
tmp = 8;
speex_encoder_ctl(IDA->speex_state, SPEEX_SET_QUALITY, &tmp);
speex_bits_init(&IDA->speex_bits);
}
int SPEEX_Close(struct _IDA_ClientSocket *IDA) {
#ifndef DISABLESPEEX
speex_bits_destroy(&IDA->speex_bits);
speex_encoder_destroy(IDA->speex_state);
#endif
}
when i run this code gdb say me:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 49156 (LWP 5719)]
0x405195cc in speex_encode (state=0x7ec30d93, in=0xbf3ff624, bits=0x80955bc)
at modes.c:575
in modes.c
(gdb)
i'm using speex 1.0.5. Someone can help me ?
Thanks ! Oz
--
----
O-Zone ! No (C) 2005
www.zerozone.it
More information about the Speex-dev
mailing list