X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=benchmark_audio_mixer.cpp;h=3327179c3518e6dc492b794c636d7d24bafde7a7;hb=b9feb66845bf24465b7671ac9ff7a52b88f6032b;hp=4b8f84a93ef0458dffa25d8806a54564afa2400e;hpb=cf7b9ee186d4ef8e5da0531b75854c97b821be44;p=nageru diff --git a/benchmark_audio_mixer.cpp b/benchmark_audio_mixer.cpp index 4b8f84a..3327179 100644 --- a/benchmark_audio_mixer.cpp +++ b/benchmark_audio_mixer.cpp @@ -61,6 +61,10 @@ void callback(float level_lufs, float peak_db, vector process_frame(unsigned frame_num, AudioMixer *mixer) { + duration> frame_duration(frame_num); + steady_clock::time_point ts = steady_clock::time_point::min() + + duration_cast(frame_duration); + // Feed the inputs. for (unsigned card_index = 0; card_index < NUM_BENCHMARK_CARDS; ++card_index) { bmusb::AudioFormat audio_format; @@ -70,12 +74,11 @@ vector process_frame(unsigned frame_num, AudioMixer *mixer) unsigned num_samples = NUM_SAMPLES + (lcgrand() % 9) - 5; bool ok = mixer->add_audio(DeviceSpec{InputSourceType::CAPTURE_CARD, card_index}, card_index == 3 ? samples24 : samples16, num_samples, audio_format, - NUM_SAMPLES * TIMEBASE / OUTPUT_FREQUENCY); + NUM_SAMPLES * TIMEBASE / OUTPUT_FREQUENCY, ts); assert(ok); } - double pts = double(frame_num) * NUM_SAMPLES / OUTPUT_FREQUENCY; - return mixer->get_output(pts, NUM_SAMPLES, ResamplingQueue::ADJUST_RATE); + return mixer->get_output(ts, NUM_SAMPLES, ResamplingQueue::ADJUST_RATE); } void init_mapping(AudioMixer *mixer)