mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
HLS: Support reload HLS asynchronously. v5.0.172 v6.0.67 (#3782)
When reloading HLS, it directly operates unpublish and publish. At this time, if HLS is pushed, an exception may occur. The reason is that these two coroutines operated on the HLS object at the same time, causing a null pointer. Solution: Use asynchronous reload. During reload, only set variables and let the message processing coroutine implement the reload. --------- Co-authored-by: Haibo Chen <495810242@qq.com> Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
parent
6babf01de2
commit
b5347e19f7
7 changed files with 112 additions and 61 deletions
|
@ -275,8 +275,14 @@ private:
|
|||
SrsHlsController* controller;
|
||||
private:
|
||||
SrsRequest* req;
|
||||
// Whether the HLS is enabled.
|
||||
bool enabled;
|
||||
// Whether the HLS stream is able to be disposed.
|
||||
bool disposable;
|
||||
// Whether requires HLS to do reload asynchronously.
|
||||
bool async_reload_;
|
||||
bool reloading_;
|
||||
// To detect heartbeat and dipose it if configured.
|
||||
srs_utime_t last_update_time;
|
||||
private:
|
||||
// If the diff=dts-previous_audio_dts is about 23,
|
||||
|
@ -293,6 +299,11 @@ private:
|
|||
public:
|
||||
SrsHls();
|
||||
virtual ~SrsHls();
|
||||
public:
|
||||
virtual void async_reload();
|
||||
private:
|
||||
srs_error_t reload();
|
||||
srs_error_t do_reload(int *reloading, int *reloaded, int *refreshed);
|
||||
public:
|
||||
virtual void dispose();
|
||||
virtual srs_error_t cycle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue