|
Hermes 0.7.0
Linux game streaming host
|
Definitions for the streaming protocols. More...
#include <csignal>#include <fstream>#include <future>#include <iomanip>#include <queue>#include <system_error>#include <boost/endian/arithmetic.hpp>#include <openssl/err.h>#include <moonlight-common-c/src/Limelight-internal.h>#include "rswrapper.h"#include "adaptive_fec.h"#include "client_mic_router.h"#include "config.h"#include "crypto.h"#include "display_device.h"#include "globals.h"#include "input.h"#include "logging.h"#include "network.h"#include "platform/common.h"#include "process.h"#include "session_activity_counter.h"#include "stream.h"#include "sync.h"#include "system_tray.h"#include "thread_safe.h"#include "utility.h"#include "video_fec_budget.h"#include "video_loss_monitor.h"import hermes.client_link_monitor;Go to the source code of this file.
Classes | |
| struct | stream::video_short_frame_header_t |
| struct | stream::video_packet_raw_t |
| struct | stream::video_packet_enc_prefix_t |
| struct | stream::audio_packet_t |
| struct | stream::control_header_v2 |
| struct | stream::control_terminate_t |
| struct | stream::control_rumble_t |
| struct | stream::control_rumble_triggers_t |
| struct | stream::control_set_motion_event_t |
| struct | stream::control_set_rgb_led_t |
| struct | stream::control_adaptive_triggers_t |
| struct | stream::control_hdr_mode_t |
| struct | stream::control_encrypted_t |
| struct | stream::audio_fec_packet_t |
| struct | stream::mic_packet_header_t |
| class | stream::control_server_t |
| struct | stream::broadcast_ctx_t |
| struct | stream::session_t |
| struct | stream::fec::fec_t |
Macros | |
| #define | IDX_START_A 0 |
| #define | IDX_START_B 1 |
| #define | IDX_INVALIDATE_REF_FRAMES 2 |
| #define | IDX_LOSS_STATS 3 |
| #define | IDX_INPUT_DATA 5 |
| #define | IDX_RUMBLE_DATA 6 |
| #define | IDX_TERMINATION 7 |
| #define | IDX_PERIODIC_PING 8 |
| #define | IDX_REQUEST_IDR_FRAME 9 |
| #define | IDX_ENCRYPTED 10 |
| #define | IDX_HDR_MODE 11 |
| #define | IDX_RUMBLE_TRIGGER_DATA 12 |
| #define | IDX_SET_MOTION_EVENT 13 |
| #define | IDX_SET_RGB_LED 14 |
| #define | IDX_EXEC_SERVER_CMD 15 |
| #define | IDX_SET_CLIPBOARD 16 |
| #define | IDX_FILE_TRANSFER_NONCE_REQUEST 17 |
| #define | IDX_SET_ADAPTIVE_TRIGGERS 18 |
Typedefs | |
| typedef struct stream::control_encrypted_t * | stream::control_encrypted_p |
| using | stream::audio_aes_t = std::array<char, round_to_pkcs7_padded(MAX_AUDIO_PACKET_SIZE)> |
| using | stream::av_session_id_t = std::variant<asio::ip::address, std::string> |
| using | stream::message_queue_t = std::shared_ptr<safe::queue_t<std::pair<udp::endpoint, std::string>>> |
| using | stream::message_queue_queue_t = std::shared_ptr<safe::queue_t<std::tuple<socket_e, av_session_id_t, message_queue_t>>> |
| using | stream::fec::rs_t |
Enumerations | |
| enum class | stream::socket_e : int { video , audio } |
Functions | |
| constexpr std::size_t | stream::round_to_pkcs7_padded (std::size_t size) |
| void | stream::log_client_silence (session_t &session, std::chrono::milliseconds silence) |
| void | stream::note_recovery_after_silence (session_t &session, std::string_view request) |
| int | stream::start_broadcast (broadcast_ctx_t &ctx) |
| void | stream::end_broadcast (broadcast_ctx_t &ctx) |
| std::vector< uint8_t > | stream::concat_and_insert (uint64_t insert_size, uint64_t slice_size, const std::string_view &data1, const std::string_view &data2) |
| Combines two buffers and inserts new buffers at each slice boundary of the result. | |
| std::vector< uint8_t > | stream::replace (const std::string_view &original, const std::string_view &old, const std::string_view &_new) |
| int | stream::send_feedback_msg (session_t *session, platf::gamepad_feedback_msg_t &msg) |
| Pass gamepad feedback data back to the client. | |
| int | stream::send_hdr_mode (session_t *session, video::hdr_info_t hdr_info) |
| void | stream::send_termination (control_server_t *server, session_t *session) |
| Tell a client its stream ended gracefully, and flush it out. | |
| void | stream::controlBroadcastThread (control_server_t *server) |
| void | stream::recvThread (broadcast_ctx_t &ctx) |
| void | stream::micRecvThread (broadcast_ctx_t &ctx) |
| void | stream::videoBroadcastThread (udp::socket &sock) |
| void | stream::audioBroadcastThread (udp::socket &sock) |
| int | stream::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) |
| void | stream::videoThread (session_t *session) |
| void | stream::audioThread (session_t *session) |
| state_e | stream::session::state (session_t &session) |
| bool | stream::session::send (session_t &session, const std::string_view &payload) |
| std::string | stream::session::uuid (const session_t &session) |
| bool | stream::session::uuid_match (const session_t &session, const std::string_view &uuid) |
| bool | stream::session::isolated (const session_t &session) |
| bool | stream::session::update_device_info (session_t &session, const std::string &name, const crypto::PERM &newPerm) |
| std::string_view | stream::session::termination_reason_str (termination_reason_e reason) |
| termination_reason_e | stream::session::last_termination_reason () |
| termination_stats_t | stream::session::termination_stats () |
| Snapshot of the termination/reconnection stats. | |
| void | stream::session::stop (session_t &session, termination_reason_e reason) |
| void | stream::session::graceful_stop (session_t &session) |
| void | stream::session::join (session_t &session) |
| int | stream::session::start (session_t &session, const std::string &addr_string) |
| std::shared_ptr< session_t > | stream::session::alloc (config_t &config, rtsp_stream::launch_session_t &launch_session) |
Variables | |
| constexpr std::uint8_t | stream::MIC_PACKET_TYPE_OPUS = 0x61 |
| constexpr std::uint32_t | stream::MIC_PACKET_MAGIC = 0x12345678 |
| constexpr std::size_t | stream::MAX_AUDIO_PACKET_SIZE = 1400 |
| constexpr unsigned int | stream::max_logged_client_silences = 50 |
| session_activity_counter_t | stream::session::running_sessions |
| std::atomic_uint | stream::session::shared_running_sessions |
| std::atomic< termination_reason_e > | stream::session::last_termination_reason_v {termination_reason_e::UNKNOWN} |
| std::mutex | stream::session::termination_stats_mutex |
| std::optional< std::chrono::steady_clock::time_point > | stream::session::last_termination_time_v |
| uint64_t | stream::session::total_ended_v {0} |
| uint64_t | stream::session::client_lost_count_v {0} |
Definitions for the streaming protocols.
Definition in file stream.cpp.
| #define IDX_ENCRYPTED 10 |
Definition at line 57 of file stream.cpp.
| #define IDX_EXEC_SERVER_CMD 15 |
Definition at line 62 of file stream.cpp.
| #define IDX_FILE_TRANSFER_NONCE_REQUEST 17 |
Definition at line 64 of file stream.cpp.
| #define IDX_HDR_MODE 11 |
Definition at line 58 of file stream.cpp.
| #define IDX_INPUT_DATA 5 |
Definition at line 52 of file stream.cpp.
| #define IDX_INVALIDATE_REF_FRAMES 2 |
Definition at line 50 of file stream.cpp.
| #define IDX_LOSS_STATS 3 |
Definition at line 51 of file stream.cpp.
| #define IDX_PERIODIC_PING 8 |
Definition at line 55 of file stream.cpp.
| #define IDX_REQUEST_IDR_FRAME 9 |
Definition at line 56 of file stream.cpp.
| #define IDX_RUMBLE_DATA 6 |
Definition at line 53 of file stream.cpp.
| #define IDX_RUMBLE_TRIGGER_DATA 12 |
Definition at line 59 of file stream.cpp.
| #define IDX_SET_ADAPTIVE_TRIGGERS 18 |
Definition at line 65 of file stream.cpp.
| #define IDX_SET_CLIPBOARD 16 |
Definition at line 63 of file stream.cpp.
| #define IDX_SET_MOTION_EVENT 13 |
Definition at line 60 of file stream.cpp.
| #define IDX_SET_RGB_LED 14 |
Definition at line 61 of file stream.cpp.
| #define IDX_START_A 0 |
Definition at line 48 of file stream.cpp.
| #define IDX_START_B 1 |
Definition at line 49 of file stream.cpp.
| #define IDX_TERMINATION 7 |
Definition at line 54 of file stream.cpp.
| using stream::audio_aes_t = std::array<char, round_to_pkcs7_padded(MAX_AUDIO_PACKET_SIZE)> |
Definition at line 271 of file stream.cpp.
| using stream::av_session_id_t = std::variant<asio::ip::address, std::string> |
Definition at line 273 of file stream.cpp.
| using stream::message_queue_queue_t = std::shared_ptr<safe::queue_t<std::tuple<socket_e, av_session_id_t, message_queue_t>>> |
Definition at line 275 of file stream.cpp.
| using stream::message_queue_t = std::shared_ptr<safe::queue_t<std::pair<udp::endpoint, std::string>>> |
Definition at line 274 of file stream.cpp.
| using stream::fec::rs_t |
Definition at line 712 of file stream.cpp.
|
strong |
| Enumerator | |
|---|---|
| video | Video. |
| audio | Audio. |
Definition at line 99 of file stream.cpp.
| std::shared_ptr< session_t > stream::session::alloc | ( | config_t & | config, |
| rtsp_stream::launch_session_t & | launch_session ) |
Definition at line 2597 of file stream.cpp.
| void stream::audioBroadcastThread | ( | udp::socket & | sock | ) |
Definition at line 1859 of file stream.cpp.
| void stream::audioThread | ( | session_t * | session | ) |
Definition at line 2229 of file stream.cpp.
| std::vector< uint8_t > stream::concat_and_insert | ( | uint64_t | insert_size, |
| uint64_t | slice_size, | ||
| const std::string_view & | data1, | ||
| const std::string_view & | data2 ) |
Combines two buffers and inserts new buffers at each slice boundary of the result.
| insert_size | The number of bytes to insert. |
| slice_size | The number of bytes between insertions. |
| data1 | The first data buffer. |
| data2 | The second data buffer. |
Definition at line 828 of file stream.cpp.
| void stream::controlBroadcastThread | ( | control_server_t * | server | ) |
Definition at line 1046 of file stream.cpp.
| void stream::end_broadcast | ( | broadcast_ctx_t & | ctx | ) |
Definition at line 2090 of file stream.cpp.
| void stream::session::graceful_stop | ( | session_t & | session | ) |
Definition at line 2392 of file stream.cpp.
| bool stream::session::isolated | ( | const session_t & | session | ) |
Definition at line 2270 of file stream.cpp.
| void stream::session::join | ( | session_t & | session | ) |
Definition at line 2431 of file stream.cpp.
| termination_reason_e stream::session::last_termination_reason | ( | ) |
Definition at line 2322 of file stream.cpp.
| void stream::log_client_silence | ( | session_t & | session, |
| std::chrono::milliseconds | silence ) |
Definition at line 493 of file stream.cpp.
| void stream::micRecvThread | ( | broadcast_ctx_t & | ctx | ) |
Definition at line 1467 of file stream.cpp.
| void stream::note_recovery_after_silence | ( | session_t & | session, |
| std::string_view | request ) |
Say so when a recovery request follows a silence: the frames sent while the client was unreachable are the ones it is asking to replace.
Definition at line 507 of file stream.cpp.
| int stream::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 ) |
Definition at line 2143 of file stream.cpp.
| void stream::recvThread | ( | broadcast_ctx_t & | ctx | ) |
Definition at line 1371 of file stream.cpp.
| std::vector< uint8_t > stream::replace | ( | const std::string_view & | original, |
| const std::string_view & | old, | ||
| const std::string_view & | _new ) |
Definition at line 866 of file stream.cpp.
|
constexpr |
Definition at line 265 of file stream.cpp.
|
inline |
Definition at line 2258 of file stream.cpp.
| int stream::send_feedback_msg | ( | session_t * | session, |
| platf::gamepad_feedback_msg_t & | msg ) |
Pass gamepad feedback data back to the client.
| session | The session object. |
| msg | The message to pass. |
Definition at line 889 of file stream.cpp.
| int stream::send_hdr_mode | ( | session_t * | session, |
| video::hdr_info_t | hdr_info ) |
Definition at line 994 of file stream.cpp.
| void stream::send_termination | ( | control_server_t * | server, |
| session_t * | session ) |
Tell a client its stream ended gracefully, and flush it out.
Runs on the control thread, which owns the session's control cipher and ENet peer. The flush makes sure the message leaves before a disconnect discards whatever is still queued.
Definition at line 1030 of file stream.cpp.
| int stream::session::start | ( | session_t & | session, |
| const std::string & | addr_string ) |
Definition at line 2504 of file stream.cpp.
| int stream::start_broadcast | ( | broadcast_ctx_t & | ctx | ) |
Definition at line 1978 of file stream.cpp.
| state_e stream::session::state | ( | session_t & | session | ) |
Definition at line 2254 of file stream.cpp.
| void stream::session::stop | ( | session_t & | session, |
| termination_reason_e | reason ) |
Definition at line 2341 of file stream.cpp.
| std::string_view stream::session::termination_reason_str | ( | termination_reason_e | reason | ) |
Definition at line 2302 of file stream.cpp.
| termination_stats_t stream::session::termination_stats | ( | ) |
Snapshot of the termination/reconnection stats.
Definition at line 2326 of file stream.cpp.
| bool stream::session::update_device_info | ( | session_t & | session, |
| const std::string & | name, | ||
| const crypto::PERM & | newPerm ) |
Definition at line 2274 of file stream.cpp.
| std::string stream::session::uuid | ( | const session_t & | session | ) |
Definition at line 2262 of file stream.cpp.
| bool stream::session::uuid_match | ( | const session_t & | session, |
| const std::string_view & | uuid ) |
Definition at line 2266 of file stream.cpp.
| void stream::videoBroadcastThread | ( | udp::socket & | sock | ) |
Definition at line 1521 of file stream.cpp.
| void stream::videoThread | ( | session_t * | session | ) |
Definition at line 2205 of file stream.cpp.
| uint64_t stream::session::client_lost_count_v {0} |
Definition at line 2300 of file stream.cpp.
| std::atomic<termination_reason_e> stream::session::last_termination_reason_v {termination_reason_e::UNKNOWN} |
Definition at line 2293 of file stream.cpp.
| std::optional<std::chrono::steady_clock::time_point> stream::session::last_termination_time_v |
Definition at line 2298 of file stream.cpp.
|
constexpr |
Definition at line 269 of file stream.cpp.
|
constexpr |
Definition at line 491 of file stream.cpp.
|
constexpr |
Definition at line 261 of file stream.cpp.
|
constexpr |
Definition at line 260 of file stream.cpp.
| session_activity_counter_t stream::session::running_sessions |
Definition at line 2251 of file stream.cpp.
| std::atomic_uint stream::session::shared_running_sessions |
Definition at line 2252 of file stream.cpp.
| std::mutex stream::session::termination_stats_mutex |
Definition at line 2297 of file stream.cpp.
| uint64_t stream::session::total_ended_v {0} |
Definition at line 2299 of file stream.cpp.