diff options
Diffstat (limited to 'auto_tests/toxav_basic_test.c')
-rw-r--r-- | auto_tests/toxav_basic_test.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 5fe17b40..528b1f9d 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -82,7 +82,7 @@ void callback_recv_starting ( void *av, int32_t call_index, void *_arg ) | |||
82 | /* Alice always sends invite */ | 82 | /* Alice always sends invite */ |
83 | printf("Call started on Alice side...\n"); | 83 | printf("Call started on Alice side...\n"); |
84 | cast->Alice.status = InCall; | 84 | cast->Alice.status = InCall; |
85 | toxav_prepare_transmission(av, call_index, &muhcaps, 1); | 85 | toxav_prepare_transmission(av, call_index, 3, 0, 1); |
86 | } | 86 | } |
87 | void callback_recv_ending ( void *av, int32_t call_index, void *_arg ) | 87 | void callback_recv_ending ( void *av, int32_t call_index, void *_arg ) |
88 | { | 88 | { |
@@ -105,7 +105,7 @@ void callback_call_started ( void *av, int32_t call_index, void *_arg ) | |||
105 | /* Alice always sends invite */ | 105 | /* Alice always sends invite */ |
106 | printf("Call started on Bob side...\n"); | 106 | printf("Call started on Bob side...\n"); |
107 | cast->Bob.status = InCall; | 107 | cast->Bob.status = InCall; |
108 | toxav_prepare_transmission(av, call_index, &muhcaps, 1); | 108 | toxav_prepare_transmission(av, call_index, 3, 0, 1); |
109 | } | 109 | } |
110 | void callback_call_canceled ( void *av, int32_t call_index, void *_arg ) | 110 | void callback_call_canceled ( void *av, int32_t call_index, void *_arg ) |
111 | { | 111 | { |
@@ -133,8 +133,27 @@ void callback_call_ended ( void *av, int32_t call_index, void *_arg ) | |||
133 | 133 | ||
134 | void callback_call_type_change ( void *av, int32_t call_index, void *_arg ) | 134 | void callback_call_type_change ( void *av, int32_t call_index, void *_arg ) |
135 | { | 135 | { |
136 | printf("Call type changed; new type: %s!\n", toxav_get_peer_transmission_type | 136 | ToxAvCodecSettings csettings; |
137 | (av, call_index, 0) == TypeAudio ? "audio" : "video"); | 137 | toxav_get_peer_csettings(av, call_index, 0, &csettings); |
138 | |||
139 | printf("New settings: \n" | ||
140 | "Type: %u \n" | ||
141 | "Video bitrate: %u \n" | ||
142 | "Video height: %u \n" | ||
143 | "Video width: %u \n" | ||
144 | "Audio bitrate: %u \n" | ||
145 | "Audio framedur: %u \n" | ||
146 | "Audio sample rate: %u \n" | ||
147 | "Audio channels: %u \n", | ||
148 | csettings.call_type, | ||
149 | csettings.video_bitrate, | ||
150 | csettings.max_video_height, | ||
151 | csettings.max_video_width, | ||
152 | csettings.audio_bitrate, | ||
153 | csettings.audio_frame_duration, | ||
154 | csettings.audio_sample_rate, | ||
155 | csettings.audio_channels | ||
156 | ); | ||
138 | } | 157 | } |
139 | 158 | ||
140 | void callback_requ_timeout ( void *av, int32_t call_index, void *_arg ) | 159 | void callback_requ_timeout ( void *av, int32_t call_index, void *_arg ) |
@@ -183,9 +202,9 @@ void register_callbacks(ToxAv *av, void *data) | |||
183 | tox_do(bootstrap_node); tox_do(Alice); tox_do(Bob); \ | 202 | tox_do(bootstrap_node); tox_do(Alice); tox_do(Bob); \ |
184 | switch ( step ) {\ | 203 | switch ( step ) {\ |
185 | case 0: /* Alice */ printf("Alice is calling...\n");\ | 204 | case 0: /* Alice */ printf("Alice is calling...\n");\ |
186 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, AliceCallType, 10); step++; break;\ | 205 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, &muhcaps, 10); step++; break;\ |
187 | case 1: /* Bob */ if (status_control.Bob.status == Ringing) { printf("Bob answers...\n");\ | 206 | case 1: /* Bob */ if (status_control.Bob.status == Ringing) { printf("Bob answers...\n");\ |
188 | cur_time = time(NULL); toxav_answer(status_control.Bob.av, status_control.Bob.call_index, BobCallType); step++; } break; \ | 207 | cur_time = time(NULL); toxav_answer(status_control.Bob.av, status_control.Bob.call_index, &muhcaps); step++; } break; \ |
189 | case 2: /* Rtp transmission */ \ | 208 | case 2: /* Rtp transmission */ \ |
190 | if (status_control.Bob.status == InCall && status_control.Alice.status == InCall) | 209 | if (status_control.Bob.status == InCall && status_control.Alice.status == InCall) |
191 | 210 | ||
@@ -224,7 +243,6 @@ START_TEST(test_AV_flows) | |||
224 | off = 0; | 243 | off = 0; |
225 | } | 244 | } |
226 | 245 | ||
227 | |||
228 | if (tox_get_friend_connection_status(Alice, 0) == 1 && tox_get_friend_connection_status(Bob, 0) == 1) | 246 | if (tox_get_friend_connection_status(Alice, 0) == 1 && tox_get_friend_connection_status(Bob, 0) == 1) |
229 | break; | 247 | break; |
230 | 248 | ||
@@ -404,9 +422,8 @@ START_TEST(test_AV_flows) | |||
404 | /* Wait 2 seconds and change transmission type */ | 422 | /* Wait 2 seconds and change transmission type */ |
405 | if (time(NULL) - times_they_are_a_changin > 2) { | 423 | if (time(NULL) - times_they_are_a_changin > 2) { |
406 | times_they_are_a_changin = time(NULL); | 424 | times_they_are_a_changin = time(NULL); |
407 | toxav_change_type(status_control.Alice.av, status_control.Alice.call_index, | 425 | muhcaps.audio_bitrate ++; |
408 | toxav_get_peer_transmission_type(status_control.Bob.av, status_control.Bob.call_index, 0) | 426 | toxav_change_settings(status_control.Alice.av, status_control.Alice.call_index, &muhcaps); |
409 | == TypeAudio ? TypeVideo : TypeAudio); | ||
410 | } | 427 | } |
411 | 428 | ||
412 | if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */ | 429 | if (time(NULL) - cur_time > 10) { /* Transmit for 10 seconds */ |
@@ -440,7 +457,7 @@ START_TEST(test_AV_flows) | |||
440 | switch ( step ) { | 457 | switch ( step ) { |
441 | case 0: /* Alice */ | 458 | case 0: /* Alice */ |
442 | printf("Alice is calling...\n"); | 459 | printf("Alice is calling...\n"); |
443 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, TypeAudio, 10); | 460 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, &muhcaps, 10); |
444 | step++; | 461 | step++; |
445 | break; | 462 | break; |
446 | 463 | ||
@@ -481,7 +498,7 @@ START_TEST(test_AV_flows) | |||
481 | switch ( step ) { | 498 | switch ( step ) { |
482 | case 0: /* Alice */ | 499 | case 0: /* Alice */ |
483 | printf("Alice is calling...\n"); | 500 | printf("Alice is calling...\n"); |
484 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, TypeAudio, 10); | 501 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, &muhcaps, 10); |
485 | step++; | 502 | step++; |
486 | break; | 503 | break; |
487 | 504 | ||
@@ -508,8 +525,8 @@ START_TEST(test_AV_flows) | |||
508 | } | 525 | } |
509 | 526 | ||
510 | /* | 527 | /* |
511 | * Timeout | 528 | * Timeout |
512 | */ | 529 | */ |
513 | { | 530 | { |
514 | int step = 0; | 531 | int step = 0; |
515 | int running = 1; | 532 | int running = 1; |
@@ -522,7 +539,7 @@ START_TEST(test_AV_flows) | |||
522 | switch ( step ) { | 539 | switch ( step ) { |
523 | case 0: | 540 | case 0: |
524 | printf("Alice is calling...\n"); | 541 | printf("Alice is calling...\n"); |
525 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, TypeAudio, 10); | 542 | toxav_call(status_control.Alice.av, &status_control.Alice.call_index, 0, &muhcaps, 10); |
526 | step++; | 543 | step++; |
527 | break; | 544 | break; |
528 | 545 | ||