AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963)

This commit is contained in:
OSSRS-AI 2025-10-26 20:17:32 -04:00 committed by winlin
parent 547b0c0ed5
commit 3dc7b405ca
5 changed files with 11 additions and 3 deletions

View File

@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v7-changes"></a>
## SRS 7.0 Changelog
* v7.0, 2025-10-27, AI: HTTP-FLV: Enforce minimum 10ms sleep to prevent CPU busy-wait when mw_latency=0. v7.0.110 (#3963)
* v7.0, 2025-10-26, AI: Edge: Fix stream names with dots being incorrectly truncated in source URL generation. v7.0.109 (#4011)
* v7.0, 2025-10-26, AI: HTTPS: Handle SSL_ERROR_ZERO_RETURN as graceful connection closure. v7.0.108 (#4036)
* v7.0, 2025-10-26, AI: API: Add clients field to on_play/on_stop webhooks and total field to HTTP API. v7.0.107 (#4147)

View File

@ -851,6 +851,13 @@ srs_error_t SrsLiveStream::do_serve_http(SrsLiveSource *source, ISrsLiveConsumer
}
srs_utime_t mw_sleep = config_->get_mw_sleep(req_->vhost_);
// For HTTP FLV, we must wait for some milliseconds to avoid the spin.
// See https://github.com/ossrs/srs/issues/3963 for more details.
if (mw_sleep == 0) {
mw_sleep = 10 * SRS_UTIME_MILLISECONDS;
}
srs_trace("FLV %s, encoder=%s, mw_sleep=%dms, cache=%d, msgs=%d, dinm=%d, guess_av=%d/%d/%d",
entry_->pattern.c_str(), enc_desc.c_str(), srsu2msi(mw_sleep), enc->has_cache(), msgs.max_, drop_if_not_match,
has_audio, has_video, guess_has_av);

View File

@ -9,6 +9,6 @@
#define VERSION_MAJOR 7
#define VERSION_MINOR 0
#define VERSION_REVISION 109
#define VERSION_REVISION 110
#endif

View File

@ -5009,7 +5009,7 @@ VOID TEST(ProtocolKbpsTest, StreamIdentifyWithDotsInName_Issue4011)
// Case 3: Different streams with same prefix should be different
std::string backup1 = srs_net_url_encode_sid("", "live", "test.backup.stream");
std::string backup2 = srs_net_url_encode_sid("", "live", "test.backup.stream2");
EXPECT_STRNE(backup1.c_str(), backup2.c_str()); // Should be different
EXPECT_STRNE(backup1.c_str(), backup2.c_str()); // Should be different
// Case 4: The intended behavior - stripping ONLY known extensions
// These should work correctly (strip .flv and .m3u8)

View File

@ -184,7 +184,7 @@ VOID TEST(BasicWorkflowHttpConnTest, ManuallyVerifyForHttpStream)
live_stream->hooks_ = mock_hooks.get();
// Do not wait for utest, consume messages immediately. Remove this when HTTP stream use cond signal.
mock_config->mw_sleep_ = 0;
mock_config->mw_sleep_ = 100; // 0.1ms
mock_entry->enabled = true;
mock_entry->pattern = "/live/livestream.flv";