diff options
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r-- | auto_tests/toxav_many_test.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index b499b439..f9a24012 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include "../toxcore/tox.h" | 14 | #include "../toxcore/tox.h" |
15 | #include "../toxcore/logger.h" | 15 | #include "../toxcore/logger.h" |
16 | #include "../toxcore/crypto_core.h" | ||
16 | #include "../toxav/toxav.h" | 17 | #include "../toxav/toxav.h" |
17 | 18 | ||
18 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) | 19 | #if defined(_WIN32) || defined(__WIN32__) || defined (WIN32) |
@@ -131,9 +132,11 @@ void* in_thread_call (void* arg) | |||
131 | int step = 0,running = 1; | 132 | int step = 0,running = 1; |
132 | int call_idx; | 133 | int call_idx; |
133 | 134 | ||
135 | const int frame_size = (av_DefaultSettings.audio_sample_rate * av_DefaultSettings.audio_frame_duration / 1000); | ||
136 | int16_t sample_payload[frame_size]; | ||
137 | randombytes_salsa20_random_buf(sample_payload, sizeof(int16_t) * frame_size); | ||
134 | 138 | ||
135 | int16_t sample_payload[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; | 139 | uint8_t prepared_payload[RTP_PAYLOAD_SIZE]; |
136 | uint8_t prepared_payload[1000]; | ||
137 | 140 | ||
138 | 141 | ||
139 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ | 142 | /* NOTE: CALLEE WILL ALWAHYS NEED CALL_IDX == 0 */ |
@@ -162,37 +165,37 @@ void* in_thread_call (void* arg) | |||
162 | toxav_prepare_transmission(this_call->Callee.av, 0, &cast, 1); | 165 | toxav_prepare_transmission(this_call->Callee.av, 0, &cast, 1); |
163 | toxav_prepare_transmission(this_call->Caller.av, call_idx, &cast, 1); | 166 | toxav_prepare_transmission(this_call->Caller.av, call_idx, &cast, 1); |
164 | 167 | ||
165 | int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, 1000, sample_payload, 120); | 168 | int payload_size = toxav_prepare_audio_frame(this_call->Caller.av, call_idx, prepared_payload, RTP_PAYLOAD_SIZE, sample_payload, frame_size); |
166 | if (!( payload_size > 0 )) { | 169 | if ( payload_size < 0 ) { |
167 | ck_assert_msg ( 0, "Failed to encode payload" ); | 170 | ck_assert_msg ( 0, "Failed to encode payload" ); |
168 | } | 171 | } |
169 | 172 | ||
173 | |||
170 | while (time(NULL) - start < 10) { /* 10 seconds */ | 174 | while (time(NULL) - start < 10) { /* 10 seconds */ |
171 | /* Both send */ | 175 | /* Both send */ |
172 | toxav_send_audio(this_call->Caller.av, call_idx, prepared_payload, payload_size); | 176 | toxav_send_audio(this_call->Caller.av, call_idx, prepared_payload, payload_size); |
173 | 177 | ||
174 | toxav_send_audio(this_call->Callee.av, 0, prepared_payload, payload_size); | 178 | toxav_send_audio(this_call->Callee.av, 0, prepared_payload, payload_size); |
175 | 179 | ||
176 | call_print(time(NULL) - start, "Blaaah"); | ||
177 | /* Both receive */ | 180 | /* Both receive */ |
178 | int16_t storage[1000]; | 181 | int16_t storage[RTP_PAYLOAD_SIZE]; |
179 | int recved; | 182 | int recved; |
180 | 183 | ||
181 | /* Payload from CALLER */ | 184 | /* Payload from CALLER */ |
182 | recved = toxav_recv_audio(this_call->Callee.av, 0, 120, storage); | 185 | recved = toxav_recv_audio(this_call->Callee.av, 0, frame_size, storage); |
183 | 186 | ||
184 | if ( recved ) { | 187 | if ( recved ) { |
185 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid");*/ | 188 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLER is invalid");*/ |
186 | } | 189 | } |
187 | 190 | ||
188 | /* Payload from CALLEE */ | 191 | /* Payload from CALLEE */ |
189 | recved = toxav_recv_audio(this_call->Caller.av, call_idx, 120, storage); | 192 | recved = toxav_recv_audio(this_call->Caller.av, call_idx, frame_size, storage); |
190 | 193 | ||
191 | if ( recved ) { | 194 | if ( recved ) { |
192 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid");*/ | 195 | /*ck_assert_msg(recved == 10 && memcmp(storage, sample_payload, 10) == 0, "Payload from CALLEE is invalid");*/ |
193 | } | 196 | } |
194 | 197 | ||
195 | //c_sleep(20); | 198 | c_sleep(20); |
196 | } | 199 | } |
197 | 200 | ||
198 | step++; /* This terminates the loop */ | 201 | step++; /* This terminates the loop */ |