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

Function controlBroadcastThread

src/stream.cpp:930–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

928 }
929
930 void controlBroadcastThread(control_server_t *server) {
931 server->map(packetTypes[IDX_PERIODIC_PING], [](session_t *session, const std::string_view &payload) {
932 BOOST_LOG(verbose) << "type [IDX_PERIODIC_PING]"sv;
933 });
934
935 server->map(packetTypes[IDX_START_A], [&](session_t *session, const std::string_view &payload) {
936 BOOST_LOG(debug) << "type [IDX_START_A]"sv;
937 });
938
939 server->map(packetTypes[IDX_START_B], [&](session_t *session, const std::string_view &payload) {
940 BOOST_LOG(debug) << "type [IDX_START_B]"sv;
941 });
942
943 server->map(packetTypes[IDX_LOSS_STATS], [&](session_t *session, const std::string_view &payload) {
944 int32_t *stats = (int32_t *) payload.data();
945 auto count = stats[0];
946 std::chrono::milliseconds t {stats[1]};
947
948 auto lastGoodFrame = stats[3];
949
950 BOOST_LOG(verbose)
951 << "type [IDX_LOSS_STATS]"sv << std::endl
952 << "---begin stats---" << std::endl
953 << "loss count since last report [" << count << ']' << std::endl
954 << "time in milli since last report [" << t.count() << ']' << std::endl
955 << "last good frame [" << lastGoodFrame << ']' << std::endl
956 << "---end stats---";
957 });
958
959 server->map(packetTypes[IDX_REQUEST_IDR_FRAME], [&](session_t *session, const std::string_view &payload) {
960 BOOST_LOG(debug) << "type [IDX_REQUEST_IDR_FRAME]"sv;
961
962 session->video.idr_events->raise(true);
963 });
964
965 server->map(packetTypes[IDX_INVALIDATE_REF_FRAMES], [&](session_t *session, const std::string_view &payload) {
966 auto frames = (std::int64_t *) payload.data();
967 auto firstFrame = frames[0];
968 auto lastFrame = frames[1];
969
970 BOOST_LOG(debug)
971 << "type [IDX_INVALIDATE_REF_FRAMES]"sv << std::endl
972 << "firstFrame [" << firstFrame << ']' << std::endl
973 << "lastFrame [" << lastFrame << ']';
974
975 session->video.invalidate_ref_frames_events->raise(std::make_pair(firstFrame, lastFrame));
976 });
977
978 server->map(packetTypes[IDX_INPUT_DATA], [&](session_t *session, const std::string_view &payload) {
979 BOOST_LOG(debug) << "type [IDX_INPUT_DATA]"sv;
980
981 auto tagged_cipher_length = util::endian::big(*(int32_t *) payload.data());
982 std::string_view tagged_cipher {payload.data() + sizeof(tagged_cipher_length), (size_t) tagged_cipher_length};
983
984 std::vector<uint8_t> plaintext;
985
986 auto &cipher = session->control.cipher;
987 auto &iv = session->control.legacy_input_enc_iv;

Callers

nothing calls this directly

Calls 15

bigFunction · 0.85
stopFunction · 0.85
passthroughFunction · 0.85
moveFunction · 0.85
find_working_directoryFunction · 0.85
littleFunction · 0.85
send_feedback_msgFunction · 0.85
send_hdr_modeFunction · 0.85
encode_controlFunction · 0.85
viewFunction · 0.85
countMethod · 0.80
decryptMethod · 0.80

Tested by

no test coverage detected