radio: keep drain diagnostics at burst boundaries and test queued PCM
This commit is contained in:
1 parent
f054f9c8d9
commit
d149bad5fc
2 files changed
+10
-6
No files matched your search
@@ -303,8 +303,10 @@ static void test_vad_receive_guard(UTUN_INSTANCE* instance) {
|
||||
std::array<int16_t, 3072> speech; speech.fill(1200);
|
||||
uint8_t opus[256]; int len = opus_codec_encode(encoder, speech.data(), 960, opus, sizeof(opus)); REQUIRE(len > 0);
|
||||
opus_codec_encoder_destroy(encoder);
|
||||
auto receive = [&](uint64_t source, int fin) {
|
||||
radio_audio_on_frame(instance, 7, source, 1, fin ? 1 : 0, fin, fin ? nullptr : opus, fin ? 0 : len, nullptr);
|
||||
auto receive = [&](uint64_t source, int fin, uint16_t first = 0) {
|
||||
if (fin) radio_audio_on_frame(instance, 7, source, 1, first + 8, 1, nullptr, 0, nullptr);
|
||||
else for (int i = 0; i < 8; ++i)
|
||||
radio_audio_on_frame(instance, 7, source, 1, first + i, 0, opus, len, nullptr);
|
||||
};
|
||||
auto feed = [&] { REQUIRE(radio_audio_feed_pcm(7, speech.data(), speech.size()) == 0); };
|
||||
uint64_t pulled = 0;
|
||||
@@ -325,7 +327,7 @@ static void test_vad_receive_guard(UTUN_INSTANCE* instance) {
|
||||
test_time += 3000; feed(); REQUIRE(!radio_audio_transmitting() && vad_windows == before);
|
||||
receive(42, 1); drain(); radio_audio_playback_progress(7, pulled, 0);
|
||||
test_time += 3000; feed(); REQUIRE(!radio_audio_transmitting()); // Второй пир всё ещё говорит.
|
||||
receive(43, 1); drain();
|
||||
receive(43, 0, 8); receive(43, 1, 8); drain();
|
||||
test_time += 10000; feed(); REQUIRE(!radio_audio_transmitting()); // PCM ещё не дошёл до выхода.
|
||||
radio_audio_playback_progress(7, pulled, 500); // Desktop: последние 50мс ещё в устройстве.
|
||||
test_time += 2499; feed(); REQUIRE(!radio_audio_transmitting() && vad_windows == before);
|
||||
|
||||
Reference in new issue
Block a user