Add global variable for Law encoded silence

This commit is contained in:
Andreas Eversberg 2012-07-28 11:15:30 +02:00
parent de6346a5bf
commit ec40766edc
3 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@
\*****************************************************************************/ \*****************************************************************************/
signed int *audio_law_to_s32; signed int *audio_law_to_s32;
unsigned char silence;
/* ulaw -> signed 16-bit */ /* ulaw -> signed 16-bit */
static signed int audio_ulaw_to_s32[] = static signed int audio_ulaw_to_s32[] =
@ -229,6 +230,7 @@ void generate_tables(char law)
int i, j; int i, j;
if (law == 'a') { if (law == 'a') {
silence = 0x2a;
audio_law_to_s32=audio_alaw_to_s32; audio_law_to_s32=audio_alaw_to_s32;
/* generating alaw-table */ /* generating alaw-table */
i = j = 0; i = j = 0;
@ -242,6 +244,7 @@ void generate_tables(char law)
i++; i++;
} }
} else { } else {
silence = 0xff;
audio_law_to_s32=audio_ulaw_to_s32; audio_law_to_s32=audio_ulaw_to_s32;
/* generating ulaw-table */ /* generating ulaw-table */
i = j = 0; i = j = 0;

View File

@ -9,6 +9,7 @@
** ** ** **
\*****************************************************************************/ \*****************************************************************************/
extern signed int *audio_law_to_s32; extern signed int *audio_law_to_s32;
extern unsigned char silence;
extern unsigned char audio_s16_to_law[65536]; extern unsigned char audio_s16_to_law[65536];
extern short audio_alaw_relations[]; extern short audio_alaw_relations[];
void generate_tables(char law); void generate_tables(char law);

View File

@ -2169,7 +2169,7 @@ int PmISDN::bridge_rx(unsigned char *data, int length)
if (p_m_load == 0 && ISDN_LOAD > 0) { if (p_m_load == 0 && ISDN_LOAD > 0) {
hh->prim = PH_DATA_REQ; hh->prim = PH_DATA_REQ;
hh->id = 0; hh->id = 0;
memset(buf+MISDN_HEADER_LEN, (options.law=='a')?0x2a:0xff, ISDN_LOAD); memset(buf+MISDN_HEADER_LEN, silence, ISDN_LOAD);
ret = sendto(p_m_mISDNport->b_sock[p_m_b_index].fd, buf, MISDN_HEADER_LEN+ISDN_LOAD, 0, NULL, 0); ret = sendto(p_m_mISDNport->b_sock[p_m_b_index].fd, buf, MISDN_HEADER_LEN+ISDN_LOAD, 0, NULL, 0);
if (ret <= 0) if (ret <= 0)
PERROR("Failed to send to socket %d\n", p_m_mISDNport->b_sock[p_m_b_index].fd); PERROR("Failed to send to socket %d\n", p_m_mISDNport->b_sock[p_m_b_index].fd);