summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-08-17 19:22:18 +0200
committerzugz (tox) <mbays+tox@sdf.org>2018-08-19 23:41:43 +0200
commit14484c6879ff5796d962b49aa76a7f3e04c2319c (patch)
treec02cf58bb7e047d01f5493d811a75eec2dfaecee /testing
parente32e0b3402006dabfc44e9a3eb1e806d9d3fc00d (diff)
make Mono_Time an argument to current_time_monotonic
Diffstat (limited to 'testing')
-rw-r--r--testing/av_test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/testing/av_test.c b/testing/av_test.c
index a36d0a00..d484250b 100644
--- a/testing/av_test.c
+++ b/testing/av_test.c
@@ -45,6 +45,7 @@ extern "C" {
45#include "../toxav/ring_buffer.c" 45#include "../toxav/ring_buffer.c"
46 46
47#include "../toxav/toxav.h" 47#include "../toxav/toxav.h"
48#include "../toxcore/Messenger.h"
48#include "../toxcore/mono_time.h" /* current_time_monotonic() */ 49#include "../toxcore/mono_time.h" /* current_time_monotonic() */
49#include "../toxcore/tox.h" 50#include "../toxcore/tox.h"
50#include "../toxcore/util.h" 51#include "../toxcore/util.h"
@@ -564,6 +565,9 @@ CHECK_ARG:
564 565
565 initialize_tox(&bootstrap, &AliceAV, &AliceCC, &BobAV, &BobCC); 566 initialize_tox(&bootstrap, &AliceAV, &AliceCC, &BobAV, &BobCC);
566 567
568 // TODO(iphydf): Don't depend on toxcore internals
569 const Mono_Time *mono_time = (*(Messenger **)bootstrap)->mono_time;
570
567 if (TEST_TRANSFER_A) { 571 if (TEST_TRANSFER_A) {
568 SNDFILE *af_handle; 572 SNDFILE *af_handle;
569 SF_INFO af_info; 573 SF_INFO af_info;
@@ -657,7 +661,7 @@ CHECK_ARG:
657 printf("Sample rate %d\n", af_info.samplerate); 661 printf("Sample rate %d\n", af_info.samplerate);
658 662
659 while (start_time + expected_time > time(nullptr)) { 663 while (start_time + expected_time > time(nullptr)) {
660 uint64_t enc_start_time = current_time_monotonic(); 664 uint64_t enc_start_time = current_time_monotonic(mono_time);
661 int64_t count = sf_read_short(af_handle, PCM, frame_size); 665 int64_t count = sf_read_short(af_handle, PCM, frame_size);
662 666
663 if (count > 0) { 667 if (count > 0) {
@@ -670,7 +674,7 @@ CHECK_ARG:
670 } 674 }
671 675
672 iterate_tox(bootstrap, AliceAV, BobAV, nullptr); 676 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
673 c_sleep((audio_frame_duration - (current_time_monotonic() - enc_start_time) - 1)); 677 c_sleep((audio_frame_duration - (current_time_monotonic(mono_time) - enc_start_time) - 1));
674 } 678 }
675 679
676 printf("Played file in: %lu; stopping stream...\n", time(nullptr) - start_time); 680 printf("Played file in: %lu; stopping stream...\n", time(nullptr) - start_time);