diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/conversation/gnunet-helper-audio-record.c | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) | |
download | gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip |
-remove trailing whitespace
Diffstat (limited to 'src/conversation/gnunet-helper-audio-record.c')
-rw-r--r-- | src/conversation/gnunet-helper-audio-record.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/conversation/gnunet-helper-audio-record.c b/src/conversation/gnunet-helper-audio-record.c index 54c9b7909..5e42de2b5 100644 --- a/src/conversation/gnunet-helper-audio-record.c +++ b/src/conversation/gnunet-helper-audio-record.c | |||
@@ -92,7 +92,7 @@ static unsigned char *opus_data; | |||
92 | static float *pcm_buffer; | 92 | static float *pcm_buffer; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Length of the pcm data needed for one OPUS frame | 95 | * Length of the pcm data needed for one OPUS frame |
96 | */ | 96 | */ |
97 | static int pcm_length; | 97 | static int pcm_length; |
98 | 98 | ||
@@ -151,7 +151,7 @@ packetizer () | |||
151 | size_t off; | 151 | size_t off; |
152 | ssize_t ret; | 152 | ssize_t ret; |
153 | int len; // FIXME: int? | 153 | int len; // FIXME: int? |
154 | size_t msg_size; | 154 | size_t msg_size; |
155 | 155 | ||
156 | while (transmit_buffer_length >= transmit_buffer_index + pcm_length) | 156 | while (transmit_buffer_length >= transmit_buffer_index + pcm_length) |
157 | { | 157 | { |
@@ -195,9 +195,9 @@ packetizer () | |||
195 | if (0 != new_size) | 195 | if (0 != new_size) |
196 | { | 196 | { |
197 | nbuf = pa_xmalloc (new_size); | 197 | nbuf = pa_xmalloc (new_size); |
198 | memmove (nbuf, | 198 | memmove (nbuf, |
199 | &transmit_buffer[transmit_buffer_index], | 199 | &transmit_buffer[transmit_buffer_index], |
200 | new_size); | 200 | new_size); |
201 | pa_xfree (transmit_buffer); | 201 | pa_xfree (transmit_buffer); |
202 | transmit_buffer = nbuf; | 202 | transmit_buffer = nbuf; |
203 | } | 203 | } |
@@ -207,7 +207,7 @@ packetizer () | |||
207 | transmit_buffer = NULL; | 207 | transmit_buffer = NULL; |
208 | } | 208 | } |
209 | transmit_buffer_index = 0; | 209 | transmit_buffer_index = 0; |
210 | transmit_buffer_length = new_size; | 210 | transmit_buffer_length = new_size; |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
@@ -216,7 +216,7 @@ packetizer () | |||
216 | */ | 216 | */ |
217 | static void | 217 | static void |
218 | stream_read_callback (pa_stream * s, | 218 | stream_read_callback (pa_stream * s, |
219 | size_t length, | 219 | size_t length, |
220 | void *userdata) | 220 | void *userdata) |
221 | { | 221 | { |
222 | const void *data; | 222 | const void *data; |
@@ -233,7 +233,7 @@ stream_read_callback (pa_stream * s, | |||
233 | 233 | ||
234 | if (pa_stream_peek (s, (const void **) &data, &length) < 0) | 234 | if (pa_stream_peek (s, (const void **) &data, &length) < 0) |
235 | { | 235 | { |
236 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 236 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
237 | _("pa_stream_peek() failed: %s\n"), | 237 | _("pa_stream_peek() failed: %s\n"), |
238 | pa_strerror (pa_context_errno (context))); | 238 | pa_strerror (pa_context_errno (context))); |
239 | quit (1); | 239 | quit (1); |
@@ -243,9 +243,9 @@ stream_read_callback (pa_stream * s, | |||
243 | GNUNET_assert (length > 0); | 243 | GNUNET_assert (length > 0); |
244 | if (NULL != transmit_buffer) | 244 | if (NULL != transmit_buffer) |
245 | { | 245 | { |
246 | transmit_buffer = pa_xrealloc (transmit_buffer, | 246 | transmit_buffer = pa_xrealloc (transmit_buffer, |
247 | transmit_buffer_length + length); | 247 | transmit_buffer_length + length); |
248 | memcpy (&transmit_buffer[transmit_buffer_length], | 248 | memcpy (&transmit_buffer[transmit_buffer_length], |
249 | data, | 249 | data, |
250 | length); | 250 | length); |
251 | transmit_buffer_length += length; | 251 | transmit_buffer_length += length; |
@@ -266,12 +266,12 @@ stream_read_callback (pa_stream * s, | |||
266 | * Exit callback for SIGTERM and SIGINT | 266 | * Exit callback for SIGTERM and SIGINT |
267 | */ | 267 | */ |
268 | static void | 268 | static void |
269 | exit_signal_callback (pa_mainloop_api * m, | 269 | exit_signal_callback (pa_mainloop_api * m, |
270 | pa_signal_event * e, | 270 | pa_signal_event * e, |
271 | int sig, | 271 | int sig, |
272 | void *userdata) | 272 | void *userdata) |
273 | { | 273 | { |
274 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 274 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
275 | _("Got signal, exiting.\n")); | 275 | _("Got signal, exiting.\n")); |
276 | quit (1); | 276 | quit (1); |
277 | } | 277 | } |
@@ -289,17 +289,17 @@ stream_state_callback (pa_stream * s, void *userdata) | |||
289 | { | 289 | { |
290 | case PA_STREAM_CREATING: | 290 | case PA_STREAM_CREATING: |
291 | case PA_STREAM_TERMINATED: | 291 | case PA_STREAM_TERMINATED: |
292 | break; | 292 | break; |
293 | case PA_STREAM_READY: | 293 | case PA_STREAM_READY: |
294 | { | 294 | { |
295 | const pa_buffer_attr *a; | 295 | const pa_buffer_attr *a; |
296 | 296 | ||
297 | char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], | 297 | char cmt[PA_CHANNEL_MAP_SNPRINT_MAX], |
298 | sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; | 298 | sst[PA_SAMPLE_SPEC_SNPRINT_MAX]; |
299 | 299 | ||
300 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 300 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
301 | _("Stream successfully created.\n")); | 301 | _("Stream successfully created.\n")); |
302 | 302 | ||
303 | if (!(a = pa_stream_get_buffer_attr (s))) | 303 | if (!(a = pa_stream_get_buffer_attr (s))) |
304 | { | 304 | { |
305 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 305 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -313,24 +313,24 @@ stream_state_callback (pa_stream * s, void *userdata) | |||
313 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 313 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
314 | _("Buffer metrics: maxlength=%u, fragsize=%u\n"), | 314 | _("Buffer metrics: maxlength=%u, fragsize=%u\n"), |
315 | a->maxlength, a->fragsize); | 315 | a->maxlength, a->fragsize); |
316 | } | 316 | } |
317 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 317 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
318 | _("Using sample spec '%s', channel map '%s'.\n"), | 318 | _("Using sample spec '%s', channel map '%s'.\n"), |
319 | pa_sample_spec_snprint (sst, sizeof (sst), | 319 | pa_sample_spec_snprint (sst, sizeof (sst), |
320 | pa_stream_get_sample_spec (s)), | 320 | pa_stream_get_sample_spec (s)), |
321 | pa_channel_map_snprint (cmt, sizeof (cmt), | 321 | pa_channel_map_snprint (cmt, sizeof (cmt), |
322 | pa_stream_get_channel_map (s))); | 322 | pa_stream_get_channel_map (s))); |
323 | 323 | ||
324 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 324 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
325 | _("Connected to device %s (%u, %ssuspended).\n"), | 325 | _("Connected to device %s (%u, %ssuspended).\n"), |
326 | pa_stream_get_device_name (s), | 326 | pa_stream_get_device_name (s), |
327 | pa_stream_get_device_index (s), | 327 | pa_stream_get_device_index (s), |
328 | pa_stream_is_suspended (s) ? "" : "not "); | 328 | pa_stream_is_suspended (s) ? "" : "not "); |
329 | } | 329 | } |
330 | break; | 330 | break; |
331 | case PA_STREAM_FAILED: | 331 | case PA_STREAM_FAILED: |
332 | default: | 332 | default: |
333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
334 | _("Stream error: %s\n"), | 334 | _("Stream error: %s\n"), |
335 | pa_strerror (pa_context_errno (pa_stream_get_context (s)))); | 335 | pa_strerror (pa_context_errno (pa_stream_get_context (s)))); |
336 | quit (1); | 336 | quit (1); |
@@ -357,9 +357,9 @@ context_state_callback (pa_context * c, | |||
357 | { | 357 | { |
358 | int r; | 358 | int r; |
359 | pa_buffer_attr na; | 359 | pa_buffer_attr na; |
360 | 360 | ||
361 | GNUNET_assert (!stream_in); | 361 | GNUNET_assert (!stream_in); |
362 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 362 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
363 | _("Connection established.\n")); | 363 | _("Connection established.\n")); |
364 | if (! (stream_in = | 364 | if (! (stream_in = |
365 | pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL))) | 365 | pa_stream_new (c, "GNUNET_VoIP recorder", &sample_spec, NULL))) |
@@ -374,7 +374,7 @@ context_state_callback (pa_context * c, | |||
374 | memset (&na, 0, sizeof (na)); | 374 | memset (&na, 0, sizeof (na)); |
375 | na.maxlength = UINT32_MAX; | 375 | na.maxlength = UINT32_MAX; |
376 | na.fragsize = pcm_length; | 376 | na.fragsize = pcm_length; |
377 | if ((r = pa_stream_connect_record (stream_in, NULL, &na, | 377 | if ((r = pa_stream_connect_record (stream_in, NULL, &na, |
378 | PA_STREAM_ADJUST_LATENCY)) < 0) | 378 | PA_STREAM_ADJUST_LATENCY)) < 0) |
379 | { | 379 | { |
380 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 380 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -382,12 +382,12 @@ context_state_callback (pa_context * c, | |||
382 | pa_strerror (pa_context_errno (c))); | 382 | pa_strerror (pa_context_errno (c))); |
383 | goto fail; | 383 | goto fail; |
384 | } | 384 | } |
385 | 385 | ||
386 | break; | 386 | break; |
387 | } | 387 | } |
388 | case PA_CONTEXT_TERMINATED: | 388 | case PA_CONTEXT_TERMINATED: |
389 | quit (0); | 389 | quit (0); |
390 | break; | 390 | break; |
391 | case PA_CONTEXT_FAILED: | 391 | case PA_CONTEXT_FAILED: |
392 | default: | 392 | default: |
393 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 393 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -413,13 +413,13 @@ pa_init () | |||
413 | 413 | ||
414 | if (!pa_sample_spec_valid (&sample_spec)) | 414 | if (!pa_sample_spec_valid (&sample_spec)) |
415 | { | 415 | { |
416 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 416 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
417 | _("Wrong Spec\n")); | 417 | _("Wrong Spec\n")); |
418 | } | 418 | } |
419 | /* set up main record loop */ | 419 | /* set up main record loop */ |
420 | if (!(m = pa_mainloop_new ())) | 420 | if (!(m = pa_mainloop_new ())) |
421 | { | 421 | { |
422 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 422 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
423 | _("pa_mainloop_new() failed.\n")); | 423 | _("pa_mainloop_new() failed.\n")); |
424 | } | 424 | } |
425 | mainloop_api = pa_mainloop_get_api (m); | 425 | mainloop_api = pa_mainloop_get_api (m); |
@@ -434,9 +434,9 @@ pa_init () | |||
434 | 434 | ||
435 | if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP"))) | 435 | if (!(context = pa_context_new (mainloop_api, "GNUNET VoIP"))) |
436 | { | 436 | { |
437 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 437 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
438 | _("pa_context_new() failed.\n")); | 438 | _("pa_context_new() failed.\n")); |
439 | } | 439 | } |
440 | pa_context_set_state_callback (context, &context_state_callback, NULL); | 440 | pa_context_set_state_callback (context, &context_state_callback, NULL); |
441 | if (pa_context_connect (context, NULL, 0, NULL) < 0) | 441 | if (pa_context_connect (context, NULL, 0, NULL) < 0) |
442 | { | 442 | { |
@@ -446,7 +446,7 @@ pa_init () | |||
446 | } | 446 | } |
447 | if (pa_mainloop_run (m, &i) < 0) | 447 | if (pa_mainloop_run (m, &i) < 0) |
448 | { | 448 | { |
449 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 449 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
450 | _("pa_mainloop_run() failed.\n")); | 450 | _("pa_mainloop_run() failed.\n")); |
451 | } | 451 | } |
452 | } | 452 | } |
@@ -466,7 +466,7 @@ opus_init () | |||
466 | pcm_buffer = pa_xmalloc (pcm_length); | 466 | pcm_buffer = pa_xmalloc (pcm_length); |
467 | opus_data = GNUNET_malloc (max_payload_bytes); | 467 | opus_data = GNUNET_malloc (max_payload_bytes); |
468 | enc = opus_encoder_create (SAMPLING_RATE, | 468 | enc = opus_encoder_create (SAMPLING_RATE, |
469 | channels, | 469 | channels, |
470 | OPUS_APPLICATION_VOIP, | 470 | OPUS_APPLICATION_VOIP, |
471 | &err); | 471 | &err); |
472 | opus_encoder_ctl (enc, | 472 | opus_encoder_ctl (enc, |