Skip to content

Commit 898d947

Browse files
leandredesmaretzDragon-kanji
authored andcommitted
fix(stream): handle frame loss before FEC telemetry
Signed-off-by: leandredesmaretz <leandre@eshot.io>
1 parent dfc474d commit 898d947

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

docs/configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,10 +1405,10 @@ editing the `conf` file in a text editor. Use the examples as reference.
14051405
<td colspan="2">
14061406
Allow supported Moonlight sessions to reduce the video bitrate during sustained network loss. Runtime
14071407
bitrate changes are currently supported by the Windows native NVENC backend. Recovery is gradual and
1408-
requires both a quiet period without new loss pressure and a fresh, healthy ENet RTT sample from Moonlight's
1409-
reliable control ping; the absence of FEC reports alone never permits an increase. The controller never
1410-
exceeds the bitrate requested by Moonlight or the configured `max_bitrate` ceiling. Unsupported clients and
1411-
encoders continue to use their fixed effective bitrate.
1408+
requires both a quiet period without new loss pressure and a fresh, healthy ENet RTT sample produced by a
1409+
reliable acknowledgement from Moonlight; the absence of FEC reports alone never permits an increase. The
1410+
controller never exceeds the bitrate requested by Moonlight or the configured `max_bitrate` ceiling.
1411+
Unsupported clients and encoders continue to use their fixed effective bitrate.
14121412
</td>
14131413
</tr>
14141414
<tr>

src/adaptive_bitrate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ namespace stream::adaptive_bitrate {
148148

149149
if (snapshot.fec_reports != 0) {
150150
telemetry_seen_ = true;
151-
} else if (!telemetry_seen_) {
151+
} else if (!telemetry_seen_ && snapshot.frame_loss_requests == 0) {
152152
return;
153153
}
154154

src_assets/common/assets/web/public/assets/locale/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"adapter_name_desc_windows": "Manually specify a GPU to use for capture. If unset, the GPU is chosen automatically. We strongly recommend leaving this field blank to use automatic GPU selection! Note: This GPU must have a display connected and powered on. The appropriate values can be found using the following command:",
114114
"adapter_name_placeholder_windows": "Radeon RX 580 Series",
115115
"adaptive_bitrate": "Adaptive Bitrate",
116-
"adaptive_bitrate_desc": "Allow supported Moonlight sessions using the Windows native NVENC encoder to reduce bitrate during sustained network loss. Recovery is gradual and requires a fresh, healthy ENet RTT sample from Moonlight's reliable control ping.",
116+
"adaptive_bitrate_desc": "Allow supported Moonlight sessions using the Windows native NVENC encoder to reduce bitrate during sustained network loss. Recovery is gradual and requires a fresh, healthy ENet RTT sample produced by a reliable acknowledgement from Moonlight.",
117117
"add": "Add",
118118
"address_family": "Address Family",
119119
"address_family_both": "IPv4+IPv6",

tests/unit/test_adaptive_bitrate.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,14 @@ TEST(AdaptiveBitrateControllerTest, DoesNotDecreaseForFecRecoveryWithoutLatencyC
291291
EXPECT_EQ(controller.target_kbps(), 25'000U);
292292
}
293293

294-
TEST(AdaptiveBitrateControllerTest, RepeatedFrameLossRequestsUseSevereDecreasePath) {
294+
TEST(AdaptiveBitrateControllerTest, RepeatedFrameLossRequestsBeforeFecTelemetryUseSevereDecreasePath) {
295295
const adaptive::time_point_t start {};
296296
adaptive::controller_t controller;
297297
activate(controller, start);
298298

299-
controller.observe(make_snapshot(1, 10'000, 0, 0), start + 100ms);
300-
auto first_loss_request = make_snapshot(2, 0, 0, 0, 20, 2, 1);
299+
auto first_loss_request = make_snapshot(1, 0, 0, 0, 20, 2, 1);
301300
first_loss_request.fec_reports = 0;
302-
auto second_loss_request = make_snapshot(3, 0, 0, 0, 20, 2, 1);
301+
auto second_loss_request = make_snapshot(2, 0, 0, 0, 20, 2, 1);
303302
second_loss_request.fec_reports = 0;
304303
controller.observe(first_loss_request, start + 500ms);
305304
controller.observe(second_loss_request, start + 1s);

0 commit comments

Comments
 (0)