diff options
author | notsecure <notsecure@marek.ca> | 2014-07-07 17:37:05 -0400 |
---|---|---|
committer | notsecure <notsecure@marek.ca> | 2014-07-07 17:37:05 -0400 |
commit | c527979daa5b65ec9a838c1b3fe998af6375953a (patch) | |
tree | fef2bc08faf0caaffaf1a8afcc603ec7b631a9dc | |
parent | 3d4de767fe8fefb5eb2456674be9930388564ee8 (diff) |
make autotests compile
-rw-r--r-- | auto_tests/toxav_basic_test.c | 48 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 28 |
2 files changed, 51 insertions, 25 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 | |||
142 | static void callback_audio(ToxAv *av, int32_t call_index, int16_t *data, int length) | ||
143 | { | ||
144 | } | ||
145 | |||
146 | static 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); |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 2a931cb0..106d2f32 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -124,6 +124,14 @@ void callback_requ_timeout ( int32_t call_index, void *_arg ) | |||
124 | { | 124 | { |
125 | ck_assert_msg(0, "No answer!"); | 125 | ck_assert_msg(0, "No answer!"); |
126 | } | 126 | } |
127 | |||
128 | static void callback_audio(ToxAv *av, int32_t call_index, int16_t *data, int length) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | static void callback_video(ToxAv *av, int32_t call_index, vpx_image_t *img) | ||
133 | { | ||
134 | } | ||
127 | /*************************************************************************************************/ | 135 | /*************************************************************************************************/ |
128 | 136 | ||
129 | 137 | ||
@@ -142,6 +150,11 @@ void *in_thread_call (void *arg) | |||
142 | 150 | ||
143 | uint8_t prepared_payload[RTP_PAYLOAD_SIZE]; | 151 | uint8_t prepared_payload[RTP_PAYLOAD_SIZE]; |
144 | 152 | ||
153 | toxav_register_audio_recv_callback(this_call->Caller.av, callback_audio); | ||
154 | toxav_register_video_recv_callback(this_call->Caller.av, callback_video); | ||
155 | toxav_register_audio_recv_callback(this_call->Callee.av, callback_audio); | ||
156 | toxav_register_video_recv_callback(this_call->Callee.av, callback_video); | ||
157 | |||
145 | 158 | ||
146 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ | 159 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ |
147 | while (running) { | 160 | while (running) { |
@@ -192,18 +205,18 @@ void *in_thread_call (void *arg) | |||
192 | int recved; | 205 | int recved; |
193 | 206 | ||
194 | /* Payload from CALLER */ | 207 | /* Payload from CALLER */ |
195 | recved = toxav_recv_audio(this_call->Callee.av, 0, frame_size, storage); | 208 | /*recved = toxav_recv_audio(this_call->Callee.av, 0, frame_size, storage); |
196 | 209 | ||
197 | if ( recved ) { | 210 | if ( recved ) { |
198 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid");*/ | 211 | //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid"); |
199 | } | 212 | }*/ |
200 | 213 | ||
201 | /* Payload from CALLEE */ | 214 | /* Payload from CALLEE */ |
202 | recved = toxav_recv_audio(this_call->Caller.av, call_idx, frame_size, storage); | 215 | /*recved = toxav_recv_audio(this_call->Caller.av, call_idx, frame_size, storage); |
203 | 216 | ||
204 | if ( recved ) { | 217 | if ( recved ) { |
205 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid");*/ | 218 | //ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid"); |
206 | } | 219 | }*/ |
207 | 220 | ||
208 | c_sleep(20); | 221 | c_sleep(20); |
209 | } | 222 | } |
@@ -335,7 +348,6 @@ START_TEST(test_AV_three_calls) | |||
335 | toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control); | 348 | toxav_register_callstate_callback(callback_requ_timeout, av_OnRequestTimeout, &status_control); |
336 | 349 | ||
337 | 350 | ||
338 | |||
339 | for ( i = 0; i < 3; i++ ) | 351 | for ( i = 0; i < 3; i++ ) |
340 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); | 352 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); |
341 | 353 | ||
@@ -403,4 +415,4 @@ int main(int argc, char *argv[]) | |||
403 | // test_AV_three_calls(); | 415 | // test_AV_three_calls(); |
404 | // | 416 | // |
405 | // return 0; | 417 | // return 0; |
406 | } \ No newline at end of file | 418 | } |