Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
stream::client_link_monitor_t Class Referenceexport

Public Types

using clock = std::chrono::steady_clock

Public Member Functions

std::optional< std::chrono::milliseconds > on_message (clock::time_point now) noexcept
void on_periodic_ping () noexcept
 The client sends periodic pings, so its silences mean something.
std::optional< std::chrono::milliseconds > silence_before (clock::time_point now) const noexcept
std::chrono::milliseconds since_last_silence (clock::time_point now) const noexcept
 How long ago the most recent silence ended, relative to now.
std::uint64_t silence_count () const noexcept
std::chrono::milliseconds longest_silence () const noexcept
std::chrono::milliseconds total_silence () const noexcept

Static Public Attributes

static constexpr std::chrono::milliseconds silence_threshold {150}
static constexpr std::chrono::milliseconds attribution_window {200}
 A key-frame request this soon after a silence ended is attributed to it.

Detailed Description

How long a client goes without sending anything on the control connection.

A Moonlight-family client sends a periodic ping every 100 ms besides its input, so a longer silence means its network link, or the client itself, stopped for that long while the host kept streaming. That is invisible in everything the host measures about its own sending, and it is what a client's Wi-Fi scan or power saving looks like from here: the client comes back, finds frames missing, and asks for a key frame.

Nothing is reported until the client has sent a periodic ping, so a client that stays quiet while idle is never mistaken for one that went missing. The last-heard state belongs to the control thread; the totals are atomic so a session can be summarized from whichever thread stops it.

Definition at line 33 of file client_link_monitor.cppm.

Member Typedef Documentation

◆ clock

using stream::client_link_monitor_t::clock = std::chrono::steady_clock

Definition at line 35 of file client_link_monitor.cppm.

Member Function Documentation

◆ longest_silence()

std::chrono::milliseconds stream::client_link_monitor_t::longest_silence ( ) const
inlinenodiscardnoexcept

Definition at line 107 of file client_link_monitor.cppm.

◆ on_message()

std::optional< std::chrono::milliseconds > stream::client_link_monitor_t::on_message ( clock::time_point now)
inlinenoexcept

Record a message from the client.

Returns
The silence this message ended, when it is long enough to report.

Definition at line 52 of file client_link_monitor.cppm.

◆ on_periodic_ping()

void stream::client_link_monitor_t::on_periodic_ping ( )
inlinenoexcept

The client sends periodic pings, so its silences mean something.

Definition at line 81 of file client_link_monitor.cppm.

◆ silence_before()

std::optional< std::chrono::milliseconds > stream::client_link_monitor_t::silence_before ( clock::time_point now) const
inlinenodiscardnoexcept

The silence that ended within attribution_window of now, if any. Called when the client asks for a key frame.

Definition at line 89 of file client_link_monitor.cppm.

◆ silence_count()

std::uint64_t stream::client_link_monitor_t::silence_count ( ) const
inlinenodiscardnoexcept

Definition at line 103 of file client_link_monitor.cppm.

◆ since_last_silence()

std::chrono::milliseconds stream::client_link_monitor_t::since_last_silence ( clock::time_point now) const
inlinenodiscardnoexcept

How long ago the most recent silence ended, relative to now.

Definition at line 97 of file client_link_monitor.cppm.

◆ total_silence()

std::chrono::milliseconds stream::client_link_monitor_t::total_silence ( ) const
inlinenodiscardnoexcept

Definition at line 111 of file client_link_monitor.cppm.

Member Data Documentation

◆ attribution_window

std::chrono::milliseconds stream::client_link_monitor_t::attribution_window {200}
staticconstexpr

A key-frame request this soon after a silence ended is attributed to it.

Definition at line 46 of file client_link_monitor.cppm.

◆ silence_threshold

std::chrono::milliseconds stream::client_link_monitor_t::silence_threshold {150}
staticconstexpr

One and a half periodic-ping intervals. In a real session the gaps between client messages stayed within 90-110 ms and none fell between 110 and 170 ms; each of that session's 14 key-frame requests followed a longer one.

Definition at line 43 of file client_link_monitor.cppm.


The documentation for this class was generated from the following file: