1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Live: Limit cached max frames by gop_cache_max_frames (#3236)

* add gop_cache_max_frames

* Live: Limit cached max frames by gop_cache_max_frames. v5.0.93

Co-authored-by: wanglei <wanglei@unicloud.com>
Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
stone 2022-11-22 12:31:45 +08:00 committed by GitHub
parent 4ada0bc629
commit ec76512e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 7 deletions

View file

@ -228,6 +228,10 @@ private:
// The client will wait for the next keyframe for h264,
// and will be black-screen.
bool enable_gop_cache;
// to limit the max gop cache frames
// without this limit, if ingest stream always has no IDR frame
// it will cause srs run out of memory
int gop_cache_max_frames_;
// The video frame count, avoid cache for pure audio stream.
int cached_video_count;
// when user disabled video when publishing, and gop cache enalbed,
@ -251,6 +255,7 @@ public:
virtual void dispose();
// To enable or disable the gop cache.
virtual void set(bool v);
virtual void set_gop_cache_max_frames(int v);
virtual bool enabled();
// only for h264 codec
// 1. cache the gop when got h264 video packet.
@ -589,6 +594,7 @@ public:
virtual srs_error_t consumer_dumps(SrsLiveConsumer* consumer, bool ds = true, bool dm = true, bool dg = true);
virtual void on_consumer_destroy(SrsLiveConsumer* consumer);
virtual void set_cache(bool enabled);
virtual void set_gop_cache_max_frames(int v);
virtual SrsRtmpJitterAlgorithm jitter();
public:
// For edge, when publish edge stream, check the state