feat(app): add PLI feedback, jitter reordering, and hardware decode
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.
This commit is contained in:
@@ -93,6 +93,27 @@ int main() {
|
||||
check(answer.session_id == "test-session-0001", "session id echoes");
|
||||
check(answer.rtp_endpoint.port == advertised_rtp_port, "rtp port in answer");
|
||||
|
||||
// PLI: the receiver side asks for a keyframe mid-session; the client
|
||||
// must receive it with the session id intact.
|
||||
std::promise<sc::SessionPli> pli_promise;
|
||||
auto pli_future = pli_promise.get_future();
|
||||
std::atomic<bool> pli_seen{false};
|
||||
client->on_message([&](const sc::SignalingMessage& message) {
|
||||
if (const sc::SessionPli* pli = std::get_if<sc::SessionPli>(&message)) {
|
||||
if (!pli_seen.exchange(true)) {
|
||||
pli_promise.set_value(*pli);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sc::SessionPli pli;
|
||||
pli.session_id = "test-session-0001";
|
||||
server->send(pli);
|
||||
|
||||
check(pli_future.wait_for(std::chrono::seconds(5)) == std::future_status::ready, "pli received");
|
||||
const sc::SessionPli received_pli = pli_future.get();
|
||||
check(received_pli.session_id == "test-session-0001", "pli session id echoes");
|
||||
|
||||
client->disconnect();
|
||||
server->disconnect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user