6#include <QtCore/QElapsedTimer>
7#include <QtCore/QObject>
8#include <QtCore/QString>
9#include <QtCore/QTimer>
82 std::chrono::milliseconds
uptime()
const;
112 QTimer _reconnectTimer;
114 bool _haltedPermanently =
false;
116 bool _sessionStreamed =
false;
117 int _streamedSessions = 0;
118 QElapsedTimer _sinceStreaming;
119 QString _lastFailure;
Retry delays that start at an initial value and grow by a factor per attempt, up to a cap.
static constexpr ExponentialBackoff kDefaultBackoff
@ Resumable
Turned on while halted after a failure that wasn't permanent: the halt is lifted.
bool reconnectPending() const
A failure's backoff is running; reconnectDue() ends it.
int reconnects() const
For VideoStreamStats::reconnects: sessions that streamed since startOver(), less the first.
void sessionStreaming()
The session delivers. The first call per session counts it as streamed.
void sessionStarted()
A new session runs.
FailureOutcome sessionFailed(const QString &message, Failure failure, bool autoReconnect)
void reconnectDue()
A failure's backoff has passed, or reconnectNow() cut it short: the receiver starts the next session.
StreamSupervisor(QObject *parent=nullptr, ExponentialBackoff backoff=kDefaultBackoff)
void stop()
The stream isn't wanted (anymore): Idle, without a reconnect.
Failure
Whether another session could fare better than the one that failed.
@ Permanent
It can't: an unsupported stream, a missing plugin.
@ Transient
It may, so reconnecting is worth it.
const QString & lastFailure() const
The failure the stream halted or reconnects after.
int reconnectAttempts() const
Failures backed off from since the backoff last started over.
@ Halted
Given up after a failure, until startOver() or autoReconnect resumes it.
@ Reconnecting
After a failure, until the session that replaces it starts.
@ Streaming
The session delivers.
@ Connecting
A session runs, without data yet.
@ Idle
Not streaming and not about to: not asked to, or before the first session.
std::chrono::milliseconds uptime() const
For VideoStreamStats::uptimeMs: since the current session started streaming; zero while it isn't.
AutoReconnectChange autoReconnectChanged(bool autoReconnect)
The config's autoReconnect became autoReconnect.
VideoReceiver::State state() const
void stateChanged(VideoReceiver::State state)
std::chrono::milliseconds reconnectDelay
Until reconnectDue(), when not halted.