summaryrefslogtreecommitdiff
path: root/auto_tests/toxav_basic_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/toxav_basic_test.c')
-rw-r--r--auto_tests/toxav_basic_test.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c
index 0a710746..bf130ecb 100644
--- a/auto_tests/toxav_basic_test.c
+++ b/auto_tests/toxav_basic_test.c
@@ -138,6 +138,15 @@ void callback_requ_timeout ( int32_t call_index, void *_arg )
138{ 138{
139 ck_assert_msg(0, "No answer!"); 139 ck_assert_msg(0, "No answer!");
140} 140}
141
142static void callback_audio(ToxAv *av, int32_t call_index, int16_t *data, int length)
143{
144}
145
146static void callback_video(ToxAv *av, int32_t call_index, vpx_image_t *img)
147{
148}
149
141/*************************************************************************************************/ 150/*************************************************************************************************/
142 151
143/* Alice calls bob and the call starts. 152/* Alice calls bob and the call starts.
@@ -222,6 +231,10 @@ START_TEST(test_AV_flows)
222 toxav_register_callstate_callback(callback_recv_error, av_OnError, &status_control); 231 toxav_register_callstate_callback(callback_recv_error, av_OnError, &status_control);
223 toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control); 232 toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control);
224 233
234 toxav_register_audio_recv_callback(status_control.Alice.av, callback_audio);
235 toxav_register_video_recv_callback(status_control.Alice.av, callback_video);
236 toxav_register_audio_recv_callback(status_control.Bob.av, callback_audio);
237 toxav_register_video_recv_callback(status_control.Bob.av, callback_video);
225 238
226 const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); 239 const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000);
227 int16_t sample_payload[frame_size]; 240 int16_t sample_payload[frame_size];
@@ -267,21 +280,22 @@ START_TEST(test_AV_flows)
267 toxav_send_audio(status_control.Bob.av, status_control.Bob.call_index, prepared_payload, payload_size); 280 toxav_send_audio(status_control.Bob.av, status_control.Bob.call_index, prepared_payload, payload_size);
268 281
269 /* Both receive */ 282 /* Both receive */
270 int16_t storage[frame_size]; 283 /*int16_t storage[frame_size];
271 int recved; 284 int recved;
272 285
273 /* Payload from Bob */ 286 /* Payload from Bob */
274 recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage); 287
288 /*recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage);
275 289
276 if ( recved ) { 290 if ( recved ) {
277 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");*/ 291 //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");
278 } 292 }
279 293
280 recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage); 294 recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage);
281 295
282 if ( recved ) { 296 if ( recved ) {
283 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");*/ 297 //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");
284 } 298 }*/
285 299
286 if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */ 300 if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */
287 step++; /* This terminates the loop */ 301 step++; /* This terminates the loop */
@@ -326,11 +340,11 @@ START_TEST(test_AV_flows)
326 int recved; 340 int recved;
327 341
328 /* Payload from Bob */ 342 /* Payload from Bob */
329 recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage); 343 /*recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage);
330 344
331 if ( recved ) { 345 if ( recved ) {
332 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");*/ 346 //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");
333 } 347 }*/
334 348
335 /* Video payload */ 349 /* Video payload */
336// toxav_recv_video(status_control.Alice.av, status_control.Alice.call_index, &video_storage); 350// toxav_recv_video(status_control.Alice.av, status_control.Alice.call_index, &video_storage);
@@ -346,11 +360,11 @@ START_TEST(test_AV_flows)
346 360
347 361
348 /* Payload from Alice */ 362 /* Payload from Alice */
349 recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage); 363 /*recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage);
350 364
351 if ( recved ) { 365 if ( recved ) {
352 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");*/ 366 //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");
353 } 367 }*/
354 368
355 if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */ 369 if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */
356 step++; /* This terminates the loop */ 370 step++; /* This terminates the loop */
@@ -397,11 +411,11 @@ START_TEST(test_AV_flows)
397 int recved; 411 int recved;
398 412
399 /* Payload from Bob */ 413 /* Payload from Bob */
400 recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage); 414 /*recved = toxav_recv_audio(status_control.Alice.av, status_control.Alice.call_index, frame_size, storage);
401 415
402 if ( recved ) { 416 if ( recved ) {
403 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");*/ 417 //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Bob is invalid");
404 } 418 }*/
405 419
406 /* Video payload */ 420 /* Video payload */
407// toxav_recv_video(status_control.Alice.av, status_control.Alice.call_index, &video_storage); 421// toxav_recv_video(status_control.Alice.av, status_control.Alice.call_index, &video_storage);
@@ -417,11 +431,11 @@ START_TEST(test_AV_flows)
417 431
418 432
419 /* Payload from Alice */ 433 /* Payload from Alice */
420 recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage); 434 /*recved = toxav_recv_audio(status_control.Bob.av, status_control.Bob.call_index, frame_size, storage);
421 435
422 if ( recved ) { 436 if ( recved ) {
423 /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");*/ 437 ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from Alice is invalid");
424 } 438 }*/
425 439
426 /* Video payload */ 440 /* Video payload */
427// toxav_recv_video(status_control.Bob.av, status_control.Bob.call_index, &video_storage); 441// toxav_recv_video(status_control.Bob.av, status_control.Bob.call_index, &video_storage);