diff options
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r-- | auto_tests/toxav_many_test.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index ee4c812c..5276c2f9 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -65,49 +65,49 @@ void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *dat | |||
65 | 65 | ||
66 | 66 | ||
67 | /******************************************************************************/ | 67 | /******************************************************************************/ |
68 | void callback_recv_invite ( void* av, int32_t call_index, void *_arg ) | 68 | void callback_recv_invite ( void *av, int32_t call_index, void *_arg ) |
69 | { | 69 | { |
70 | /* | 70 | /* |
71 | Status *cast = _arg; | 71 | Status *cast = _arg; |
72 | 72 | ||
73 | cast->calls[call_index].Callee.status = Ringing;*/ | 73 | cast->calls[call_index].Callee.status = Ringing;*/ |
74 | } | 74 | } |
75 | void callback_recv_ringing ( void* av, int32_t call_index, void *_arg ) | 75 | void callback_recv_ringing ( void *av, int32_t call_index, void *_arg ) |
76 | { | 76 | { |
77 | Status *cast = _arg; | 77 | Status *cast = _arg; |
78 | cast->calls[call_index].Caller.status = Ringing; | 78 | cast->calls[call_index].Caller.status = Ringing; |
79 | } | 79 | } |
80 | void callback_recv_starting ( void* av, int32_t call_index, void *_arg ) | 80 | void callback_recv_starting ( void *av, int32_t call_index, void *_arg ) |
81 | { | 81 | { |
82 | Status *cast = _arg; | 82 | Status *cast = _arg; |
83 | cast->calls[call_index].Caller.status = InCall; | 83 | cast->calls[call_index].Caller.status = InCall; |
84 | } | 84 | } |
85 | void callback_recv_ending ( void* av, int32_t call_index, void *_arg ) | 85 | void callback_recv_ending ( void *av, int32_t call_index, void *_arg ) |
86 | { | 86 | { |
87 | Status *cast = _arg; | 87 | Status *cast = _arg; |
88 | cast->calls[call_index].Caller.status = Ended; | 88 | cast->calls[call_index].Caller.status = Ended; |
89 | } | 89 | } |
90 | 90 | ||
91 | void callback_call_started ( void* av, int32_t call_index, void *_arg ) | 91 | void callback_call_started ( void *av, int32_t call_index, void *_arg ) |
92 | { | 92 | { |
93 | /* | 93 | /* |
94 | Status *cast = _arg; | 94 | Status *cast = _arg; |
95 | 95 | ||
96 | cast->calls[call_index].Callee.status = InCall;*/ | 96 | cast->calls[call_index].Callee.status = InCall;*/ |
97 | } | 97 | } |
98 | void callback_call_canceled ( void* av, int32_t call_index, void *_arg ) | 98 | void callback_call_canceled ( void *av, int32_t call_index, void *_arg ) |
99 | { | 99 | { |
100 | /* | 100 | /* |
101 | Status *cast = _arg; | 101 | Status *cast = _arg; |
102 | 102 | ||
103 | cast->calls[call_index].Callee.status = Cancel;*/ | 103 | cast->calls[call_index].Callee.status = Cancel;*/ |
104 | } | 104 | } |
105 | void callback_call_rejected ( void* av, int32_t call_index, void *_arg ) | 105 | void callback_call_rejected ( void *av, int32_t call_index, void *_arg ) |
106 | { | 106 | { |
107 | Status *cast = _arg; | 107 | Status *cast = _arg; |
108 | cast->calls[call_index].Caller.status = Rejected; | 108 | cast->calls[call_index].Caller.status = Rejected; |
109 | } | 109 | } |
110 | void callback_call_ended ( void* av, int32_t call_index, void *_arg ) | 110 | void callback_call_ended ( void *av, int32_t call_index, void *_arg ) |
111 | { | 111 | { |
112 | /* | 112 | /* |
113 | Status *cast = _arg; | 113 | Status *cast = _arg; |
@@ -115,7 +115,7 @@ void callback_call_ended ( void* av, int32_t call_index, void *_arg ) | |||
115 | cast->calls[call_index].Callee.status = Ended;*/ | 115 | cast->calls[call_index].Callee.status = Ended;*/ |
116 | } | 116 | } |
117 | 117 | ||
118 | void callback_requ_timeout ( void* av, int32_t call_index, void *_arg ) | 118 | void callback_requ_timeout ( void *av, int32_t call_index, void *_arg ) |
119 | { | 119 | { |
120 | ck_assert_msg(0, "No answer!"); | 120 | ck_assert_msg(0, "No answer!"); |
121 | } | 121 | } |
@@ -127,21 +127,21 @@ static void callback_audio(ToxAv *av, int32_t call_index, int16_t *data, int len | |||
127 | static void callback_video(ToxAv *av, int32_t call_index, vpx_image_t *img) | 127 | static void callback_video(ToxAv *av, int32_t call_index, vpx_image_t *img) |
128 | { | 128 | { |
129 | } | 129 | } |
130 | void register_callbacks(ToxAv* av, void* data) | 130 | void register_callbacks(ToxAv *av, void *data) |
131 | { | 131 | { |
132 | toxav_register_callstate_callback(av, callback_call_started, av_OnStart, data); | 132 | toxav_register_callstate_callback(av, callback_call_started, av_OnStart, data); |
133 | toxav_register_callstate_callback(av, callback_call_canceled, av_OnCancel, data); | 133 | toxav_register_callstate_callback(av, callback_call_canceled, av_OnCancel, data); |
134 | toxav_register_callstate_callback(av, callback_call_rejected, av_OnReject, data); | 134 | toxav_register_callstate_callback(av, callback_call_rejected, av_OnReject, data); |
135 | toxav_register_callstate_callback(av, callback_call_ended, av_OnEnd, data); | 135 | toxav_register_callstate_callback(av, callback_call_ended, av_OnEnd, data); |
136 | toxav_register_callstate_callback(av, callback_recv_invite, av_OnInvite, data); | 136 | toxav_register_callstate_callback(av, callback_recv_invite, av_OnInvite, data); |
137 | 137 | ||
138 | toxav_register_callstate_callback(av, callback_recv_ringing, av_OnRinging, data); | 138 | toxav_register_callstate_callback(av, callback_recv_ringing, av_OnRinging, data); |
139 | toxav_register_callstate_callback(av, callback_recv_starting, av_OnStarting, data); | 139 | toxav_register_callstate_callback(av, callback_recv_starting, av_OnStarting, data); |
140 | toxav_register_callstate_callback(av, callback_recv_ending, av_OnEnding, data); | 140 | toxav_register_callstate_callback(av, callback_recv_ending, av_OnEnding, data); |
141 | 141 | ||
142 | toxav_register_callstate_callback(av, callback_requ_timeout, av_OnRequestTimeout, data); | 142 | toxav_register_callstate_callback(av, callback_requ_timeout, av_OnRequestTimeout, data); |
143 | 143 | ||
144 | 144 | ||
145 | toxav_register_audio_recv_callback(av, callback_audio); | 145 | toxav_register_audio_recv_callback(av, callback_audio); |
146 | toxav_register_video_recv_callback(av, callback_video); | 146 | toxav_register_video_recv_callback(av, callback_video); |
147 | } | 147 | } |
@@ -157,9 +157,9 @@ void *in_thread_call (void *arg) | |||
157 | uint64_t start = 0; | 157 | uint64_t start = 0; |
158 | int step = 0; | 158 | int step = 0; |
159 | int call_idx; | 159 | int call_idx; |
160 | 160 | ||
161 | call_running[this_call->idx] = 1; | 161 | call_running[this_call->idx] = 1; |
162 | 162 | ||
163 | const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); | 163 | const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); |
164 | int16_t sample_payload[frame_size]; | 164 | int16_t sample_payload[frame_size]; |
165 | randombytes((uint8_t *)sample_payload, sizeof(int16_t) * frame_size); | 165 | randombytes((uint8_t *)sample_payload, sizeof(int16_t) * frame_size); |
@@ -168,7 +168,7 @@ void *in_thread_call (void *arg) | |||
168 | 168 | ||
169 | register_callbacks(this_call->Caller.av, &status_control); | 169 | register_callbacks(this_call->Caller.av, &status_control); |
170 | register_callbacks(this_call->Callee.av, arg); | 170 | register_callbacks(this_call->Callee.av, arg); |
171 | 171 | ||
172 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ | 172 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ |
173 | while (call_running[this_call->idx]) { | 173 | while (call_running[this_call->idx]) { |
174 | 174 | ||
@@ -322,19 +322,19 @@ START_TEST(test_AV_three_calls) | |||
322 | 322 | ||
323 | for (i = 0; i < 3; i ++) { | 323 | for (i = 0; i < 3; i ++) { |
324 | status_control.calls[i].idx = i; | 324 | status_control.calls[i].idx = i; |
325 | 325 | ||
326 | status_control.calls[i].Caller.av = uniqcallerav; | 326 | status_control.calls[i].Caller.av = uniqcallerav; |
327 | status_control.calls[i].Caller.id = 0; | 327 | status_control.calls[i].Caller.id = 0; |
328 | status_control.calls[i].Caller.status= none; | 328 | status_control.calls[i].Caller.status = none; |
329 | 329 | ||
330 | status_control.calls[i].Callee.av = toxav_new(callees[i], 1); | 330 | status_control.calls[i].Callee.av = toxav_new(callees[i], 1); |
331 | status_control.calls[i].Callee.id = i; | 331 | status_control.calls[i].Callee.id = i; |
332 | status_control.calls[i].Callee.status= none; | 332 | status_control.calls[i].Callee.status = none; |
333 | } | 333 | } |
334 | 334 | ||
335 | pthread_mutex_init(&muhmutex, NULL); | 335 | pthread_mutex_init(&muhmutex, NULL); |
336 | 336 | ||
337 | for ( i = 0; i < 3; i++ ) | 337 | for ( i = 0; i < 3; i++ ) |
338 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); | 338 | pthread_create(&status_control.calls[i].tid, NULL, in_thread_call, &status_control.calls[i]); |
339 | 339 | ||
340 | /* Now start 3 calls and they'll run for 10 s */ | 340 | /* Now start 3 calls and they'll run for 10 s */ |