Changeset 2321:9df21a38f3af in roaraudio
- Timestamp:
- 08/06/09 00:19:29 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarphone.c
r2312 r2321 51 51 int samples; 52 52 int transcode; 53 int64_t dtx_threshold; 53 54 } g_conf; 54 55 … … 68 69 " --device DEVICE - Set the device\n" 69 70 " --antiecho AEMODE - Set the anti echo mode\n" 71 " --threshold DTXTHRES - Set the DTX threshold, disabled by default\n" 70 72 " --transcode - Use local transcodeing\n" 71 73 " --help - Show this help\n" … … 154 156 } 155 157 158 int zero_if_noise16 (int16_t * data, size_t samples) { 159 int64_t rms = roar_rms2_1_16(data, samples); 160 161 if ( rms < g_conf.dtx_threshold ) 162 memset(data, 0, samples*2); 163 164 return 0; 165 } 166 156 167 int run_stream (struct roar_vio_calls * s0, struct roar_vio_calls * s1, struct roar_audio_info * info) { 157 168 size_t len; … … 171 182 if ( (miclen = roar_vio_read(s0, micbuf, len)) <= 0 ) 172 183 break; 184 185 if ( g_conf.dtx_threshold > 0 ) 186 if ( info->bits == 16 ) 187 zero_if_noise16(micbuf, miclen/2); 188 173 189 if ( g_conf.transcode ) { 174 190 if ( roar_bixcoder_write_packet(transcoder, micbuf, miclen) == -1 ) … … 218 234 memset(&g_conf, 0, sizeof(g_conf)); 219 235 220 g_conf.antiecho = AE_ROARD; 236 g_conf.antiecho = AE_ROARD; 237 g_conf.dtx_threshold = -1; 221 238 222 239 for (i = 1; i < argc; i++) { … … 251 268 return 1; 252 269 } 270 } else if ( strcmp(k, "--threshold") == 0 ) { 271 g_conf.dtx_threshold = atol(argv[++i]); 272 273 // use threshold^2 or threshold < 0 for not using DTX 274 if ( g_conf.dtx_threshold > 0 ) 275 g_conf.dtx_threshold *= g_conf.dtx_threshold; 253 276 } else if ( strcmp(k, "--transcode") == 0 ) { 254 277 g_conf.transcode = 1;
Note: See TracChangeset
for help on using the changeset viewer.