Author: gmaruzz Date: Sun Feb 8 08:28:45 2009 New Revision: 11690 Log: skypiax: checking sizes on win 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 08:28:45 2009 @@ -126,8 +126,10 @@ unsigned int howmany; if (SAMPLERATE_SKYPIAX == 8000) { - + NOTICA("sizeof(short)=%d, \tSAMPLES_PER_FRAME=%d, \tSAMPLES_PER_FRAME/sizeof(short)=%d\n", SKYPIAX_P_LOG, sizeof(short), SAMPLES_PER_FRAME, SAMPLES_PER_FRAME/sizeof(short)); + NOTICA("sizeof(short)=%d, \tlen=%d, \tlen/sizeof(short)/2=%d\n", SKYPIAX_P_LOG, sizeof(short), len, len/sizeof(short)/2); a = 0; + /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */ for (i = 0; i < len / sizeof(short); i++) { srv_out[a] = srv_in[i]; i++; @@ -141,11 +143,11 @@ tech_pvt->audiobuf_is_loaded = 1; } else { - howmany = len / 2 / 2; - for (i = 0; i < howmany; i++) + howmany = len / sizeof(short) / 2; + for (i = 0; i < howmany; i++){ totalbuf[i] = tech_pvt->audiobuf[i]; + } - howmany = len / 2 / 2; for (a = 0; a < howmany; a++) { totalbuf[i] = srv_out[a]; i++; @@ -158,6 +160,8 @@ } } else if (SAMPLERATE_SKYPIAX == 16000) { + NOTICA("sizeof(short)=%d, SAMPLES_PER_FRAME=%d, SAMPLES_PER_FRAME/sizeof(short)=%d\n", SKYPIAX_P_LOG, sizeof(short), SAMPLES_PER_FRAME, SAMPLES_PER_FRAME/sizeof(short)); + NOTICA("sizeof(short)=%d, len=%d, len/sizeof(short)=%d\n", SKYPIAX_P_LOG, sizeof(short), len, len/sizeof(short)); if (!tech_pvt->audiobuf_is_loaded) { for (i = 0; i < (len / sizeof(short)); i++) { @@ -167,8 +171,9 @@ } else { howmany = SAMPLES_PER_FRAME * sizeof(short); - for (i = 0; i < (len / sizeof(short)); i++) + for (i = 0; i < (len / sizeof(short)); i++){ totalbuf[i] = tech_pvt->audiobuf[i]; + } for (a = 0; a < (len / sizeof(short)); a++) { totalbuf[i] = srv_in[a]; i++;