943596da6d
Loss recovery for the streaming path: - PLI over signaling: the depacketizer now reports damaged frames (DepacketizeResult) and the receiver asks the sender for a keyframe (SessionPli, rate-limited to one per 500 ms). The sender keeps the signaling channel open during the session and honors PLIs through the new thread-safe SenderPipeline::request_keyframe(). Recovery takes one frame time instead of waiting out the GOP. - RtpJitterBuffer: reorders RTP packets by sequence number (16 packets / 60 ms) before the in-order depacketizer, so Wi-Fi reordering is not misread as loss; in-order streams release immediately, and a straggler older than the delivered sequence is discarded. - Hardware H.264 decode probe: DecoderFactory tries h264_v4l2m2m (the VideoCore path on the Pi) with an automatic software fallback and a clear journal line for the chosen path; --swdecode opts out. Validated: PLI end-to-end with a probe that drops a mid-keyframe packet over real UDP (receiver logged the damaged frame and the PLI arrived with the session id); hardware probe fails cleanly and falls back on this desktop; jitter reordering covered by unit tests. meson test 5/5 in both build configurations, valgrind clean.
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "screencast/capture/capture.h"
|
|
#include "screencast/codec/decoder.h"
|
|
#include "screencast/codec/encoder.h"
|
|
#include "screencast/network/transport.h"
|
|
#include "screencast/render/renderer.h"
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
|
|
namespace sc {
|
|
|
|
struct SenderPipelineConfig {
|
|
CaptureTarget capture_target;
|
|
EncoderConfig encoder;
|
|
Endpoint local_rtp_endpoint;
|
|
std::optional<Endpoint> signaling_server;
|
|
// Where encoded RTP packets are sent. Defaults to the local loopback so
|
|
// a sender and receiver on one machine work without any configuration.
|
|
Endpoint peer_rtp_endpoint{"127.0.0.1", 5004};
|
|
};
|
|
|
|
struct ReceiverPipelineConfig {
|
|
DecoderConfig decoder;
|
|
Endpoint local_rtp_endpoint;
|
|
std::optional<Endpoint> peer_signaling;
|
|
RendererConfig renderer;
|
|
// TCP port the signaling server listens on (offers arrive here).
|
|
std::uint16_t signaling_port = 5005;
|
|
};
|
|
|
|
// Sender pipeline: capture → encode → packetize → RTP/UDP.
|
|
class SenderPipeline {
|
|
public:
|
|
explicit SenderPipeline(SenderPipelineConfig config);
|
|
~SenderPipeline();
|
|
|
|
bool start();
|
|
void stop();
|
|
|
|
// Ask the sender to encode its next frame as a keyframe. Thread-safe;
|
|
// used by the PLI feedback path.
|
|
void request_keyframe();
|
|
|
|
private:
|
|
class Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
// Receiver pipeline: RTP/UDP → depacketize → decode → render.
|
|
class ReceiverPipeline {
|
|
public:
|
|
explicit ReceiverPipeline(ReceiverPipelineConfig config);
|
|
~ReceiverPipeline();
|
|
|
|
bool start();
|
|
void stop();
|
|
|
|
private:
|
|
class Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace sc
|