[Freeswitch-svn] [commit] r11693 - freeswitch/branches/gmaruzz/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Sun Feb 8 08:14:39 PST 2009
Author: gmaruzz
Date: Sun Feb 8 10:14:38 2009
New Revision: 11693
Log:
skypiax: skypiax_protocol.c indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Sun Feb 8 10:14:38 2009
@@ -46,24 +46,23 @@
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_close_socket(unsigned int fd)
{
- int res;
+ int res;
- res = closesocket(fd);
+ res = closesocket(fd);
return res;
}
#else /* WIN32 */
int skypiax_close_socket(unsigned int fd)
{
- int res;
+ int res;
- res = close(fd);
+ res = close(fd);
return res;
}
#endif /* WIN32 */
-
void *skypiax_do_tcp_srv_thread_func(void *obj)
{
private_t *tech_pvt = obj;
@@ -145,45 +144,48 @@
if (len == 320) {
unsigned int howmany;
- if (SAMPLERATE_SKYPIAX == 8000) {
- /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */
- a = 0;
- for (i = 0; i < len / sizeof(short); i++) {
- srv_out[a] = srv_in[i];
- i++;
- a++;
- }
- } else if (SAMPLERATE_SKYPIAX == 16000) {
- /* we're NOT downsampling from 16khz to 8khz, srv_out will contain ALL samples from srv_in */
- for (i = 0; i < len / sizeof(short); i++) {
- srv_out[i] = srv_in[i];
- }
- } else {
- ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
- }
- /* if not yet done, let's store the half incoming frame */
- if (!tech_pvt->audiobuf_is_loaded) {
- for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
- tech_pvt->audiobuf[i] = srv_out[i];
- }
- tech_pvt->audiobuf_is_loaded = 1;
- } else {
- /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */
- for (i = 0; i < SAMPLES_PER_FRAME / 2; i++){
- totalbuf[i] = tech_pvt->audiobuf[i];
- }
- for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) {
- totalbuf[i] = srv_out[a];
- i++;
- }
- /* send the complete frame through the pipe to our code waiting for incoming audio */
- howmany = skypiax_file_write(tech_pvt->audiopipe[1], totalbuf, SAMPLES_PER_FRAME * sizeof(short));
- if(howmany != SAMPLES_PER_FRAME * sizeof(short)){
- ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany, SAMPLES_PER_FRAME * sizeof(short));
- }
- /* done with the stored half frame */
- tech_pvt->audiobuf_is_loaded = 0;
+ if (SAMPLERATE_SKYPIAX == 8000) {
+ /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */
+ a = 0;
+ for (i = 0; i < len / sizeof(short); i++) {
+ srv_out[a] = srv_in[i];
+ i++;
+ a++;
}
+ } else if (SAMPLERATE_SKYPIAX == 16000) {
+ /* we're NOT downsampling from 16khz to 8khz, srv_out will contain ALL samples from srv_in */
+ for (i = 0; i < len / sizeof(short); i++) {
+ srv_out[i] = srv_in[i];
+ }
+ } else {
+ ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
+ }
+ /* if not yet done, let's store the half incoming frame */
+ if (!tech_pvt->audiobuf_is_loaded) {
+ for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+ tech_pvt->audiobuf[i] = srv_out[i];
+ }
+ tech_pvt->audiobuf_is_loaded = 1;
+ } else {
+ /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */
+ for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) {
+ totalbuf[i] = tech_pvt->audiobuf[i];
+ }
+ for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) {
+ totalbuf[i] = srv_out[a];
+ i++;
+ }
+ /* send the complete frame through the pipe to our code waiting for incoming audio */
+ howmany =
+ skypiax_file_write(tech_pvt->audiopipe[1], totalbuf,
+ SAMPLES_PER_FRAME * sizeof(short));
+ if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
+ ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany,
+ SAMPLES_PER_FRAME * sizeof(short));
+ }
+ /* done with the stored half frame */
+ tech_pvt->audiobuf_is_loaded = 0;
+ }
} else if (len == 0) {
DEBUGA_SKYPE("Skype client GONE\n", SKYPIAX_P_LOG);
More information about the Freeswitch-svn
mailing list