mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Live: Fix bug for gop cache limits. v5.0.99 (#3289)
* bugfix: setting srt bridge to rtmp gop cache limit while SrsMpegtsSrtConn::acquire_publish * setting http_stream gop cache limit while SrsHttpStreamServer::hijack * if gop_cache_max_frames_ == 0, don't enable the got cache max frames limit Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
parent
e83fc2388b
commit
a4d9e45545
5 changed files with 15 additions and 2 deletions
|
@ -8,6 +8,7 @@ The changelog for SRS.
|
||||||
|
|
||||||
## SRS 5.0 Changelog
|
## SRS 5.0 Changelog
|
||||||
|
|
||||||
|
* v5.0, 2022-12-01, Live: Fix bug for gop cache limits. v5.0.99
|
||||||
* v5.0, 2022-11-25, SRT: Support transform tlpkdrop to tlpktdrop. 5.0.98
|
* v5.0, 2022-11-25, SRT: Support transform tlpkdrop to tlpktdrop. 5.0.98
|
||||||
* v5.0, 2022-11-25, Config: Add ENV tips for config. 5.0.97
|
* v5.0, 2022-11-25, Config: Add ENV tips for config. 5.0.97
|
||||||
* v5.0, 2022-11-24, For [#299](https://github.com/ossrs/srs/issues/299), DASH: Fix number mode bug to make it run. 5.0.96
|
* v5.0, 2022-11-24, For [#299](https://github.com/ossrs/srs/issues/299), DASH: Fix number mode bug to make it run. 5.0.96
|
||||||
|
|
|
@ -1065,6 +1065,11 @@ srs_error_t SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandle
|
||||||
}
|
}
|
||||||
srs_assert(s != NULL);
|
srs_assert(s != NULL);
|
||||||
|
|
||||||
|
bool enabled_cache = _srs_config->get_gop_cache(r->vhost);
|
||||||
|
int gcmf = _srs_config->get_gop_cache_max_frames(r->vhost);
|
||||||
|
s->set_cache(enabled_cache);
|
||||||
|
s->set_gop_cache_max_frames(gcmf);
|
||||||
|
|
||||||
// create http streaming handler.
|
// create http streaming handler.
|
||||||
if ((err = http_mount(s, r)) != srs_success) {
|
if ((err = http_mount(s, r)) != srs_success) {
|
||||||
return srs_error_wrap(err, "http mount");
|
return srs_error_wrap(err, "http mount");
|
||||||
|
|
|
@ -659,7 +659,7 @@ srs_error_t SrsGopCache::cache(SrsSharedPtrMessage* shared_msg)
|
||||||
gop_cache.push_back(msg->copy());
|
gop_cache.push_back(msg->copy());
|
||||||
|
|
||||||
// Clear gop cache if exceed the max frames.
|
// Clear gop cache if exceed the max frames.
|
||||||
if (gop_cache.size() > (size_t)gop_cache_max_frames_) {
|
if (gop_cache_max_frames_ > 0 && gop_cache.size() > (size_t)gop_cache_max_frames_) {
|
||||||
srs_warn("Gop cache exceed max frames=%d, total=%d, videos=%d, aalvc=%d",
|
srs_warn("Gop cache exceed max frames=%d, total=%d, videos=%d, aalvc=%d",
|
||||||
gop_cache_max_frames_, (int)gop_cache.size(), cached_video_count, audio_after_last_video_count);
|
gop_cache_max_frames_, (int)gop_cache.size(), cached_video_count, audio_after_last_video_count);
|
||||||
clear();
|
clear();
|
||||||
|
|
|
@ -367,6 +367,13 @@ srs_error_t SrsMpegtsSrtConn::acquire_publish()
|
||||||
return srs_error_wrap(err, "create source");
|
return srs_error_wrap(err, "create source");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srs_assert(live_source != NULL);
|
||||||
|
|
||||||
|
bool enabled_cache = _srs_config->get_gop_cache(req_->vhost);
|
||||||
|
int gcmf = _srs_config->get_gop_cache_max_frames(req_->vhost);
|
||||||
|
live_source->set_cache(enabled_cache);
|
||||||
|
live_source->set_gop_cache_max_frames(gcmf);
|
||||||
|
|
||||||
SrsRtmpFromSrtBridge *bridger = new SrsRtmpFromSrtBridge(live_source);
|
SrsRtmpFromSrtBridge *bridger = new SrsRtmpFromSrtBridge(live_source);
|
||||||
if ((err = bridger->initialize(req_)) != srs_success) {
|
if ((err = bridger->initialize(req_)) != srs_success) {
|
||||||
srs_freep(bridger);
|
srs_freep(bridger);
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
|
|
||||||
#define VERSION_MAJOR 5
|
#define VERSION_MAJOR 5
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 98
|
#define VERSION_REVISION 99
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue