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

Function end_broadcast

src/stream.cpp:1815–1847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1813 }
1814
1815 void end_broadcast(broadcast_ctx_t &ctx) {
1816 auto broadcast_shutdown_event = mail::man->event<bool>(mail::broadcast_shutdown);
1817
1818 broadcast_shutdown_event->raise(true);
1819
1820 auto video_packets = mail::man->queue<video::packet_t>(mail::video_packets);
1821 auto audio_packets = mail::man->queue<audio::packet_t>(mail::audio_packets);
1822
1823 // Minimize delay stopping video/audio threads
1824 video_packets->stop();
1825 audio_packets->stop();
1826
1827 ctx.message_queue_queue->stop();
1828 ctx.io_context.stop();
1829
1830 ctx.video_sock.close();
1831 ctx.audio_sock.close();
1832
1833 video_packets.reset();
1834 audio_packets.reset();
1835
1836 BOOST_LOG(debug) << "Waiting for main listening thread to end..."sv;
1837 ctx.recv_thread.join();
1838 BOOST_LOG(debug) << "Waiting for main video thread to end..."sv;
1839 ctx.video_thread.join();
1840 BOOST_LOG(debug) << "Waiting for main audio thread to end..."sv;
1841 ctx.audio_thread.join();
1842 BOOST_LOG(debug) << "Waiting for main control thread to end..."sv;
1843 ctx.control_thread.join();
1844 BOOST_LOG(debug) << "All broadcasting threads ended"sv;
1845
1846 broadcast_shutdown_event->reset();
1847 }
1848
1849 int recv_ping(session_t *session, decltype(broadcast)::ptr_t ref, socket_e type, std::string_view expected_payload, udp::endpoint &peer, std::chrono::milliseconds timeout) {
1850 auto messages = std::make_shared<message_queue_t::element_type>(30);

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
raiseMethod · 0.45
stopMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected