mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
parent
90b5ed2202
commit
6bb11a72d0
4 changed files with 13 additions and 12 deletions
|
@ -8,6 +8,7 @@ The changelog for SRS.
|
|||
|
||||
## SRS 4.0 Changelog
|
||||
|
||||
* v4.0, 2021-09-04, For [#2282](https://github.com/ossrs/srs/pull/2282), [#2181](https://github.com/ossrs/srs/issues/2181), Move DVR async worker from SrsDvrPlan to global.
|
||||
* v4.0, 2021-09-04, For [#2282](https://github.com/ossrs/srs/pull/2282), [#2181](https://github.com/ossrs/srs/issues/2181), Remove reload for dvr_apply. 4.0.160
|
||||
* v4.0, 2021-08-28, RTC: Merge [#1859](https://github.com/ossrs/srs/pull/1859), Enhancement: Add param and stream to on_connect. 4.0.159
|
||||
* v4.0, 2021-08-27, RTC: Merge [#2544](https://github.com/ossrs/srs/pull/2544), Support for multiple SPS/PPS, then pick the first one. 4.0.158
|
||||
|
|
|
@ -566,6 +566,8 @@ string SrsDvrAsyncCallOnDvr::to_string()
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
extern SrsAsyncCallWorker* _srs_dvr_async;
|
||||
|
||||
SrsDvrPlan::SrsDvrPlan()
|
||||
{
|
||||
req = NULL;
|
||||
|
@ -573,13 +575,11 @@ SrsDvrPlan::SrsDvrPlan()
|
|||
|
||||
dvr_enabled = false;
|
||||
segment = NULL;
|
||||
async = new SrsAsyncCallWorker();
|
||||
}
|
||||
|
||||
SrsDvrPlan::~SrsDvrPlan()
|
||||
{
|
||||
srs_freep(segment);
|
||||
srs_freep(async);
|
||||
}
|
||||
|
||||
srs_error_t SrsDvrPlan::initialize(SrsOriginHub* h, SrsDvrSegmenter* s, SrsRequest* r)
|
||||
|
@ -599,18 +599,11 @@ srs_error_t SrsDvrPlan::initialize(SrsOriginHub* h, SrsDvrSegmenter* s, SrsReque
|
|||
|
||||
srs_error_t SrsDvrPlan::on_publish()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
if ((err = async->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "async");
|
||||
}
|
||||
|
||||
return err;
|
||||
return srs_success;
|
||||
}
|
||||
|
||||
void SrsDvrPlan::on_unpublish()
|
||||
{
|
||||
async->stop();
|
||||
}
|
||||
|
||||
srs_error_t SrsDvrPlan::on_meta_data(SrsSharedPtrMessage* shared_metadata)
|
||||
|
@ -663,7 +656,7 @@ srs_error_t SrsDvrPlan::on_reap_segment()
|
|||
SrsFragment* fragment = segment->current();
|
||||
string fullpath = fragment->fullpath();
|
||||
|
||||
if ((err = async->execute(new SrsDvrAsyncCallOnDvr(cid, req, fullpath))) != srs_success) {
|
||||
if ((err = _srs_dvr_async->execute(new SrsDvrAsyncCallOnDvr(cid, req, fullpath))) != srs_success) {
|
||||
return srs_error_wrap(err, "reap segment");
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,6 @@ public:
|
|||
protected:
|
||||
SrsOriginHub* hub;
|
||||
SrsDvrSegmenter* segment;
|
||||
SrsAsyncCallWorker* async;
|
||||
bool dvr_enabled;
|
||||
public:
|
||||
SrsDvrPlan();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <srs_app_pithy_print.hpp>
|
||||
#include <srs_app_rtc_server.hpp>
|
||||
#include <srs_app_log.hpp>
|
||||
#include <srs_app_async_call.hpp>
|
||||
|
||||
#ifdef SRS_RTC
|
||||
#include <srs_app_rtc_dtls.hpp>
|
||||
|
@ -268,6 +269,7 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval)
|
|||
}
|
||||
|
||||
SrsCircuitBreaker* _srs_circuit_breaker = NULL;
|
||||
SrsAsyncCallWorker* _srs_dvr_async = NULL;
|
||||
|
||||
srs_error_t srs_thread_initialize()
|
||||
{
|
||||
|
@ -408,6 +410,12 @@ srs_error_t srs_thread_initialize()
|
|||
_srs_pps_objs_rothers = new SrsPps();
|
||||
#endif
|
||||
|
||||
// Create global async worker for DVR.
|
||||
_srs_dvr_async = new SrsAsyncCallWorker();
|
||||
if ((err = _srs_dvr_async->start()) != srs_success) {
|
||||
return srs_error_wrap(err, "dvr async");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue