MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / TEST_P

Function TEST_P

tests/unit/test_audio.cpp:43–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41);
42
43TEST_P(AudioTest, TestEncode) {
44 std::thread timer([&] {
45 // Terminate the audio capture after 100 ms
46 std::this_thread::sleep_for(100ms);
47 const auto shutdown_event = m_mail->event<bool>(mail::shutdown);
48 const auto audio_packets = m_mail->queue<packet_t>(mail::audio_packets);
49 shutdown_event->raise(true);
50 audio_packets->stop();
51 });
52 std::thread capture([&] {
53 const auto packets = m_mail->queue<packet_t>(mail::audio_packets);
54 const auto shutdown_event = m_mail->event<bool>(mail::shutdown);
55 while (const auto packet = packets->pop()) {
56 if (shutdown_event->peek()) {
57 break;
58 }
59 if (auto packet_data = packet->second; packet_data.size() == 0) {
60 FAIL() << "Empty packet data";
61 }
62 }
63 });
64 audio::capture(m_mail, m_config, nullptr);
65
66 timer.join();
67 capture.join();
68}

Callers

nothing calls this directly

Calls 7

joinMethod · 0.80
captureFunction · 0.50
raiseMethod · 0.45
stopMethod · 0.45
popMethod · 0.45
peekMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected