mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
remove flashP2P hss dvr, for it's a can-not-run feature. 0.9.178
This commit is contained in:
parent
83d1e7288c
commit
79c641e8d6
11 changed files with 3 additions and 598 deletions
21
README.md
21
README.md
|
@ -46,9 +46,7 @@ SRS supports [vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/RtmpUr
|
|||
rtmp([encoder push](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryRTMP), client/[edge](https://github.com/winlinvip/simple-rtmp-server/wiki/Edge) pull), [ingester(srs pull)](https://github.com/winlinvip/simple-rtmp-server/wiki/Ingest),
|
||||
[HLS](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS), [HLS audio only](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS#hlsaudioonly), [transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG),
|
||||
[forward](https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG), [http hooks](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback), [http api](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPApi),
|
||||
[http server](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPServer), [dvr](https://github.com/winlinvip/simple-rtmp-server/wiki/DVR), [FlashP2P](https://github.com/winlinvip/simple-rtmp-server/wiki/FlashP2P).
|
||||
|
||||
注意:FlashP2P系统为[chnvideo.com](http://www.chnvideo.com)商业方案,SRS只是支持对接。
|
||||
[http server](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPServer), [dvr](https://github.com/winlinvip/simple-rtmp-server/wiki/DVR).
|
||||
|
||||
Release: [http://winlinvip.github.io/srs.release](http://winlinvip.github.io/srs.release) <br/>
|
||||
Blog: [http://blog.csdn.net/win_lin](http://blog.csdn.net/win_lin) <br/>
|
||||
|
@ -266,7 +264,6 @@ Supported operating systems and hardware:
|
|||
* v1.0, 2014-04-28, support full edge RTMP server. 0.9.79
|
||||
* v1.0, 2014-04-27, support basic edge(play/publish) RTMP server. 0.9.78
|
||||
* v1.0, 2014-04-25, add donation page. 0.9.76
|
||||
* v1.0, 2014-04-24, support live flashP2P(integrated by chnvideo VDN). 0.9.75
|
||||
* v1.0, 2014-04-21, support android app to start srs for internal edge. 0.9.72
|
||||
* v1.0, 2014-04-19, support tool over srs-librtmp to ingest flv/rtmp. 0.9.71
|
||||
* v1.0, 2014-04-17, support dvr(record live to flv file for vod). 0.9.69
|
||||
|
@ -582,22 +579,6 @@ Remark:
|
|||
cli analysis and summary the data, return to user.
|
||||
</pre>
|
||||
|
||||
### Live FlashP2P
|
||||
|
||||
<pre>
|
||||
+--DVR------>-(flv file)
|
||||
+----------+ +-----+ |
|
||||
| encoder +--RTMP-->-+ SRS +-->--+
|
||||
+----------+ +-----+ |
|
||||
| +------------+
|
||||
+---HTTP-->-+ P2P system +
|
||||
callback +------------+
|
||||
</pre>
|
||||
|
||||
Remark: P2P system provides by [chnvideo.com](http://www.chnvideo.com)
|
||||
|
||||
注意:FlashP2P系统为[chnvideo.com](http://www.chnvideo.com)商业方案,SRS只是支持对接。
|
||||
|
||||
### Bandwidth Test Workflow
|
||||
|
||||
<pre>
|
||||
|
|
|
@ -179,8 +179,6 @@ vhost dvr.srs.com {
|
|||
# dvr RTMP stream to file,
|
||||
# start to record to file when encoder publish,
|
||||
# reap flv according by specified dvr_plan.
|
||||
# http callbacks:
|
||||
# @see http callback on_dvr_hss_reap_flv on http_hooks section.
|
||||
dvr {
|
||||
# whether enabled dvr features
|
||||
# default: off
|
||||
|
@ -200,7 +198,6 @@ vhost dvr.srs.com {
|
|||
# the dvr plan. canbe:
|
||||
# session reap flv when session end(unpublish).
|
||||
# segment reap flv when flv duration exceed the specified dvr_duration.
|
||||
# hss reap flv required by bravo(chnvideo.com) p2p system.
|
||||
# default: session
|
||||
dvr_plan session;
|
||||
# the param for plan(segment), in seconds.
|
||||
|
@ -405,38 +402,6 @@ vhost hooks.callback.srs.com {
|
|||
# support multiple api hooks, format:
|
||||
# on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
|
||||
on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
|
||||
#
|
||||
# for dvr(dvr_plan is hss).
|
||||
# when dvr got flv header, call the hook,
|
||||
# the request in the POST data string is a object encode by json:
|
||||
# {
|
||||
# "action": "on_dvr_hss_reap_flv_header",
|
||||
# "vhost": "video.test.com", "app": "live",
|
||||
# "stream": "livestream",
|
||||
# "segment": {
|
||||
# "cwd": "/usr/local/srs",
|
||||
# "path": "./objs/nginx/html/live/livestream.header.flv"
|
||||
# }
|
||||
# }
|
||||
# when dvr reap flv file, call the hook,
|
||||
# the request in the POST data string is a object encode by json:
|
||||
# {
|
||||
# "action": "on_dvr_hss_reap_flv",
|
||||
# "vhost": "video.test.com", "app": "live",
|
||||
# "stream": "livestream",
|
||||
# "segment": {
|
||||
# "cwd": "/usr/local/srs",
|
||||
# "path": "./objs/nginx/html/live/livestream.1398315892865.flv",
|
||||
# "duration": 1001, "offset":0,
|
||||
# "has_keyframe": true, "pts":1398315895958
|
||||
# }
|
||||
# }
|
||||
# if valid, the hook must return HTTP code 200(Stauts OK) and response
|
||||
# an int value specifies the error code(0 corresponding to success):
|
||||
# 0
|
||||
# support multiple api hooks, format:
|
||||
# on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
|
||||
on_dvr_hss_reap_flv http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -325,56 +325,6 @@ class RESTSessions(object):
|
|||
# TODO: process the on_stop event
|
||||
|
||||
return code
|
||||
|
||||
# the rest dvrs, when dvr got keyframe, call this api.
|
||||
class RESTDvrs(object):
|
||||
exposed = True
|
||||
def __init__(self):
|
||||
pass
|
||||
# the dvrs POST api specified in following.
|
||||
#
|
||||
# when dvr got an keyframe, call the hook,
|
||||
# the request in the POST data string is a object encode by json:
|
||||
# {
|
||||
# "action": "on_dvr_keyframe",
|
||||
# "vhost": "video.test.com", "app": "live",
|
||||
# "stream": "livestream"
|
||||
# }
|
||||
#
|
||||
# if valid, the hook must return HTTP code 200(Stauts OK) and response
|
||||
# an int value specifies the error code(0 corresponding to success):
|
||||
# 0
|
||||
def POST(self):
|
||||
enable_crossdomain()
|
||||
|
||||
req = cherrypy.request.body.read()
|
||||
trace("post to sessions, req=%s"%(req))
|
||||
try:
|
||||
json_req = json.loads(req)
|
||||
except Exception, ex:
|
||||
code = Error.system_parse_json
|
||||
trace("parse the request to json failed, req=%s, ex=%s, code=%s"%(req, ex, code))
|
||||
return str(code)
|
||||
|
||||
action = json_req["action"]
|
||||
if action == "on_dvr_keyframe":
|
||||
code = self.__on_dvr_keyframe(json_req)
|
||||
else:
|
||||
code = Errors.request_invalid_action
|
||||
trace("invalid request action: %s, code=%s"%(json_req["action"], code))
|
||||
|
||||
return str(code)
|
||||
|
||||
def __on_dvr_keyframe(self, req):
|
||||
code = Error.success
|
||||
|
||||
trace("srs %s: vhost=%s, app=%s, stream=%s"%(
|
||||
req["action"], req["vhost"], req["app"], req["stream"]
|
||||
))
|
||||
|
||||
# TODO: process the on_dvr_keyframe event
|
||||
|
||||
return code
|
||||
|
||||
global_arm_server_id = os.getpid();
|
||||
class ArmServer:
|
||||
|
@ -1088,7 +1038,6 @@ class V1(object):
|
|||
self.clients = RESTClients()
|
||||
self.streams = RESTStreams()
|
||||
self.sessions = RESTSessions()
|
||||
self.dvrs = RESTDvrs()
|
||||
self.chats = RESTChats()
|
||||
self.servers = RESTServers()
|
||||
self.nodes = RESTNodes()
|
||||
|
|
|
@ -1333,7 +1333,7 @@ int SrsConfig::check_config()
|
|||
for (int j = 0; j < (int)conf0->directives.size(); j++) {
|
||||
string m = conf0->at(j)->name.c_str();
|
||||
if (m != "enabled" && m != "on_connect" && m != "on_close" && m != "on_publish"
|
||||
&& m != "on_unpublish" && m != "on_play" && m != "on_stop" && m != "on_dvr_hss_reap_flv"
|
||||
&& m != "on_unpublish" && m != "on_play" && m != "on_stop"
|
||||
) {
|
||||
ret = ERROR_SYSTEM_CONFIG_INVALID;
|
||||
srs_error("unsupported vhost http_hooks directive %s, ret=%d", m.c_str(), ret);
|
||||
|
@ -2096,17 +2096,6 @@ SrsConfDirective* SrsConfig::get_vhost_on_stop(string vhost)
|
|||
return conf->get("on_stop");
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_vhost_on_dvr_hss_reap_flv(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
|
||||
|
||||
if (!conf) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return conf->get("on_dvr_hss_reap_flv");
|
||||
}
|
||||
|
||||
bool SrsConfig::get_bw_check_enabled(string vhost)
|
||||
{
|
||||
SrsConfDirective* conf = get_vhost(vhost);
|
||||
|
|
|
@ -51,8 +51,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define SRS_CONF_DEFAULT_DVR_PATH "./objs/nginx/html"
|
||||
#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"
|
||||
#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment"
|
||||
// chnvideo hss
|
||||
#define SRS_CONF_DEFAULT_DVR_PLAN_HSS "hss"
|
||||
#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION
|
||||
#define SRS_CONF_DEFAULT_DVR_DURATION 30
|
||||
#define SRS_CONF_DEFAULT_TIME_JITTER "full"
|
||||
|
@ -566,11 +564,6 @@ public:
|
|||
* @return the on_stop callback directive, the args is the url to callback.
|
||||
*/
|
||||
virtual SrsConfDirective* get_vhost_on_stop(std::string vhost);
|
||||
/**
|
||||
* get the on_dvr_hss_reap_flv callbacks of vhost.
|
||||
* @return the on_dvr_hss_reap_flv callback directive, the args is the url to callback.
|
||||
*/
|
||||
virtual SrsConfDirective* get_vhost_on_dvr_hss_reap_flv(std::string vhost);
|
||||
// bwct(bandwidth check tool) section
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -318,12 +318,6 @@ int SrsDvrPlan::flv_close()
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||
if ((ret = on_dvr_hss_reap_flv()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -366,29 +360,6 @@ int SrsDvrPlan::write_flv_header()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrPlan::on_dvr_hss_reap_flv()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||
if (!_srs_config->get_vhost_http_hooks_enabled(_req->vhost)) {
|
||||
// HTTP: on_dvr_hss_reap_flv
|
||||
SrsConfDirective* on_dvr_hss_reap_flv = _srs_config->get_vhost_on_dvr_hss_reap_flv(_req->vhost);
|
||||
if (!on_dvr_hss_reap_flv) {
|
||||
srs_info("ignore the empty http callback: on_dvr_hss_reap_flv");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)on_dvr_hss_reap_flv->args.size(); i++) {
|
||||
std::string url = on_dvr_hss_reap_flv->args.at(i);
|
||||
SrsHttpHooks::on_dvr_hss_reap_flv(url, _req, segment);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SrsDvrPlan* SrsDvrPlan::create_plan(string vhost)
|
||||
{
|
||||
std::string plan = _srs_config->get_dvr_plan(vhost);
|
||||
|
@ -396,8 +367,6 @@ SrsDvrPlan* SrsDvrPlan::create_plan(string vhost)
|
|||
return new SrsDvrSegmentPlan();
|
||||
} else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_SESSION) {
|
||||
return new SrsDvrSessionPlan();
|
||||
} else if (plan == SRS_CONF_DEFAULT_DVR_PLAN_HSS) {
|
||||
return new SrsDvrHssPlan();
|
||||
} else {
|
||||
return new SrsDvrSessionPlan();
|
||||
}
|
||||
|
@ -502,208 +471,6 @@ int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
SrsDvrHssPlan::SrsDvrHssPlan()
|
||||
{
|
||||
segment_duration = -1;
|
||||
expect_reap_time = 0;
|
||||
}
|
||||
|
||||
SrsDvrHssPlan::~SrsDvrHssPlan()
|
||||
{
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::initialize(SrsSource* source, SrsRequest* req)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if ((ret = SrsDvrPlan::initialize(source, req)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: FIXME: support reload
|
||||
segment_duration = _srs_config->get_dvr_duration(req->vhost);
|
||||
// to ms
|
||||
segment_duration *= 1000;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::on_publish()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
// if already opened, continue to dvr.
|
||||
// the segment plan maybe keep running longer than the encoder.
|
||||
// for example, segment running, encoder restart,
|
||||
// the segment plan will just continue going and donot open new segment.
|
||||
if (fs->is_open()) {
|
||||
dvr_enabled = true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = SrsDvrPlan::on_publish()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// expect reap flv time
|
||||
expect_reap_time = segment->stream_starttime + segment_duration;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void SrsDvrHssPlan::on_unpublish()
|
||||
{
|
||||
// support multiple publish.
|
||||
if (!dvr_enabled) {
|
||||
return;
|
||||
}
|
||||
dvr_enabled = false;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::on_meta_data(SrsOnMetaDataPacket* metadata)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
SrsRequest* req = _req;
|
||||
|
||||
// new flv file
|
||||
std::stringstream path;
|
||||
path << _srs_config->get_dvr_path(req->vhost)
|
||||
<< "/" << req->app << "/"
|
||||
<< req->stream << ".header.flv";
|
||||
|
||||
SrsFileWriter fs;
|
||||
if ((ret = fs.open(path.str().c_str())) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
SrsFlvEncoder enc;
|
||||
if ((ret = enc.initialize(&fs)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = enc.write_header()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int size = 0;
|
||||
char* payload = NULL;
|
||||
if ((ret = metadata->encode(size, payload)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
SrsAutoFree(char, payload);
|
||||
|
||||
if ((ret = enc.write_metadata(payload, size)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||
if ((ret = on_dvr_hss_reap_flv_header(path.str())) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::write_flv_header()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::on_dvr_request_sh()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::on_video_keyframe()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
segment->sequence_header_offset = fs->tellg();
|
||||
if ((ret = SrsDvrPlan::on_dvr_request_sh()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t SrsDvrHssPlan::filter_timestamp(int64_t timestamp)
|
||||
{
|
||||
//return timestamp;
|
||||
srs_assert(segment);
|
||||
srs_verbose("filter timestamp from %"PRId64" to %"PRId64, timestamp, segment->stream_starttime + timestamp);
|
||||
return segment->stream_starttime + timestamp;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::on_dvr_hss_reap_flv_header(string path)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifdef SRS_AUTO_HTTP_CALLBACK
|
||||
if (!_srs_config->get_vhost_http_hooks_enabled(_req->vhost)) {
|
||||
// HTTP: on_dvr_hss_reap_flv_header
|
||||
SrsConfDirective* on_dvr_hss_reap_flv = _srs_config->get_vhost_on_dvr_hss_reap_flv(_req->vhost);
|
||||
if (!on_dvr_hss_reap_flv) {
|
||||
srs_info("ignore the empty http callback: on_dvr_hss_reap_flv");
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)on_dvr_hss_reap_flv->args.size(); i++) {
|
||||
std::string url = on_dvr_hss_reap_flv->args.at(i);
|
||||
SrsHttpHooks::on_dvr_hss_reap_flv_header(url, _req, path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SrsDvrHssPlan::update_duration(SrsSharedPtrMessage* msg)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if ((ret = SrsDvrPlan::update_duration(msg)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
srs_assert(segment);
|
||||
|
||||
// if not initialized, ignore reap.
|
||||
if (expect_reap_time <= 0
|
||||
|| segment->stream_starttime <= 0
|
||||
|| segment->stream_duration <= 0
|
||||
) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// reap if exceed atc expect time.
|
||||
if (segment->stream_starttime + segment->stream_duration > expect_reap_time) {
|
||||
srs_verbose("hss reap start=%"PRId64", duration=%"PRId64", expect=%"PRId64
|
||||
", segment(start=%"PRId64", duration=%"PRId64", file=%s",
|
||||
segment->stream_starttime, segment->stream_duration, expect_reap_time,
|
||||
segment->stream_starttime + segment->starttime,
|
||||
segment->duration, segment->path.c_str());
|
||||
|
||||
// update expect reap time
|
||||
expect_reap_time += segment_duration;
|
||||
|
||||
if ((ret = flv_close()) != ERROR_SUCCESS) {
|
||||
segment->reset();
|
||||
return ret;
|
||||
}
|
||||
on_unpublish();
|
||||
|
||||
if ((ret = open_new_segment()) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SrsDvr::SrsDvr(SrsSource* source)
|
||||
{
|
||||
_source = source;
|
||||
|
|
|
@ -137,11 +137,6 @@ protected:
|
|||
virtual int on_dvr_request_sh();
|
||||
virtual int on_video_keyframe();
|
||||
virtual int64_t filter_timestamp(int64_t timestamp);
|
||||
private:
|
||||
/**
|
||||
* when srs reap the flv(close the segment), notice the api.
|
||||
*/
|
||||
virtual int on_dvr_hss_reap_flv();
|
||||
public:
|
||||
static SrsDvrPlan* create_plan(std::string vhost);
|
||||
};
|
||||
|
@ -177,33 +172,6 @@ private:
|
|||
virtual int update_duration(SrsSharedPtrMessage* msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* hss plan: use atc time to reap flv segment
|
||||
*/
|
||||
class SrsDvrHssPlan : public SrsDvrPlan
|
||||
{
|
||||
private:
|
||||
// in config, in ms
|
||||
int segment_duration;
|
||||
int64_t expect_reap_time;
|
||||
public:
|
||||
SrsDvrHssPlan();
|
||||
virtual ~SrsDvrHssPlan();
|
||||
public:
|
||||
virtual int initialize(SrsSource* source, SrsRequest* req);
|
||||
virtual int on_publish();
|
||||
virtual void on_unpublish();
|
||||
virtual int on_meta_data(SrsOnMetaDataPacket* metadata);
|
||||
protected:
|
||||
virtual int write_flv_header();
|
||||
virtual int on_dvr_request_sh();
|
||||
virtual int on_video_keyframe();
|
||||
virtual int64_t filter_timestamp(int64_t timestamp);
|
||||
private:
|
||||
virtual int on_dvr_hss_reap_flv_header(std::string path);
|
||||
virtual int update_duration(SrsSharedPtrMessage* msg);
|
||||
};
|
||||
|
||||
/**
|
||||
* dvr(digital video recorder) to record RTMP stream to flv file.
|
||||
* TODO: FIXME: add utest for it.
|
||||
|
|
|
@ -326,114 +326,4 @@ void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef SRS_AUTO_DVR
|
||||
|
||||
void SrsHttpHooks::on_dvr_hss_reap_flv_header(std::string url, SrsRequest* req, std::string header_file)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_verbose("flv header reap, file=%s", header_file.c_str());
|
||||
|
||||
SrsHttpUri uri;
|
||||
if ((ret = uri.initialize(url)) != ERROR_SUCCESS) {
|
||||
srs_warn("http uri parse on_dvr_hss_reap_flv_header url failed, ignored. "
|
||||
"url=%s, ret=%d", url.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_dvr_hss_reap_flv_header") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_NAME("segment") << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("path", header_file)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
||||
SrsHttpClient http;
|
||||
if ((ret = http.post(&uri, data, res)) != ERROR_SUCCESS) {
|
||||
srs_warn("http post on_dvr_hss_reap_flv_header uri failed, ignored. "
|
||||
"url=%s, request=%s, response=%s, ret=%d",
|
||||
url.c_str(), data.c_str(), res.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.empty() || res != SRS_HTTP_RESPONSE_OK) {
|
||||
ret = ERROR_HTTP_DATA_INVLIAD;
|
||||
srs_warn("http hook on_dvr_hss_reap_flv_header validate failed, ignored. "
|
||||
"res=%s, ret=%d", res.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
srs_info("http hook on_dvr_hss_reap_flv_header success. "
|
||||
"url=%s, request=%s, response=%s, ret=%d",
|
||||
url.c_str(), data.c_str(), res.c_str(), ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void SrsHttpHooks::on_dvr_hss_reap_flv(string url, SrsRequest* req, SrsFlvSegment* segment)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
srs_assert(segment);
|
||||
srs_verbose("flv segment %s, atc_start=%"PRId64", "
|
||||
"has_key=%d, starttime=%"PRId64", duration=%d",
|
||||
segment->path.c_str(), segment->stream_starttime,
|
||||
segment->has_keyframe, segment->starttime, (int)segment->duration);
|
||||
|
||||
SrsHttpUri uri;
|
||||
if ((ret = uri.initialize(url)) != ERROR_SUCCESS) {
|
||||
srs_warn("http uri parse on_dvr_hss_reap_flv url failed, ignored. "
|
||||
"url=%s, ret=%d", url.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_dvr_hss_reap_flv") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_NAME("segment") << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("path", segment->path) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("duration", segment->duration) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("offset", segment->sequence_header_offset) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("has_keyframe", (segment->has_keyframe? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("pts", segment->stream_starttime + segment->starttime)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
||||
SrsHttpClient http;
|
||||
if ((ret = http.post(&uri, data, res)) != ERROR_SUCCESS) {
|
||||
srs_warn("http post on_dvr_hss_reap_flv uri failed, ignored. "
|
||||
"url=%s, request=%s, response=%s, ret=%d",
|
||||
url.c_str(), data.c_str(), res.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.empty() || res != SRS_HTTP_RESPONSE_OK) {
|
||||
ret = ERROR_HTTP_DATA_INVLIAD;
|
||||
srs_warn("http hook on_dvr_hss_reap_flv validate failed, ignored. "
|
||||
"res=%s, ret=%d", res.c_str(), ret);
|
||||
return;
|
||||
}
|
||||
|
||||
srs_info("http hook on_dvr_hss_reap_flv success. "
|
||||
"url=%s, request=%s, response=%s, ret=%d",
|
||||
url.c_str(), data.c_str(), res.c_str(), ret);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -98,23 +98,6 @@ public:
|
|||
* ignore if empty.
|
||||
*/
|
||||
static void on_stop(std::string url, int client_id, std::string ip, SrsRequest* req);
|
||||
#ifdef SRS_AUTO_DVR
|
||||
public:
|
||||
/**
|
||||
* on_dvr_hss_reap_flv_header hook, when dvr write flv file header.
|
||||
* @param url the api server url, to process the event.
|
||||
* ignore if empty.
|
||||
* @param header_file the flv header file.
|
||||
*/
|
||||
static void on_dvr_hss_reap_flv_header(std::string url, SrsRequest* req, std::string header_file);
|
||||
/**
|
||||
* on_dvr_hss_reap_flv hook, when dvr close flv file.
|
||||
* @param url the api server url, to process the event.
|
||||
* ignore if empty.
|
||||
* @param segment the current flv segment.
|
||||
*/
|
||||
static void on_dvr_hss_reap_flv(std::string url, SrsRequest* req, SrsFlvSegment* segment);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// current release version
|
||||
#define VERSION_MAJOR "0"
|
||||
#define VERSION_MINOR "9"
|
||||
#define VERSION_REVISION "177"
|
||||
#define VERSION_REVISION "178"
|
||||
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
|
||||
// server info.
|
||||
#define RTMP_SIG_SRS_KEY "SRS"
|
||||
|
|
|
@ -208,7 +208,6 @@ std::string __full_conf = ""
|
|||
" # start to record to file when encoder publish, \n"
|
||||
" # reap flv according by specified dvr_plan. \n"
|
||||
" # http callbacks: \n"
|
||||
" # @see http callback on_dvr_hss_reap_flv on http_hooks section. \n"
|
||||
" dvr { \n"
|
||||
" # whether enabled dvr features \n"
|
||||
" # default: off \n"
|
||||
|
@ -228,7 +227,6 @@ std::string __full_conf = ""
|
|||
" # the dvr plan. canbe: \n"
|
||||
" # session reap flv when session end(unpublish). \n"
|
||||
" # segment reap flv when flv duration exceed the specified dvr_duration. \n"
|
||||
" # hss reap flv required by bravo(chnvideo.com) p2p system. \n"
|
||||
" # default: session \n"
|
||||
" dvr_plan session; \n"
|
||||
" # the param for plan(segment), in seconds. \n"
|
||||
|
@ -433,38 +431,6 @@ std::string __full_conf = ""
|
|||
" # support multiple api hooks, format: \n"
|
||||
" # on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN \n"
|
||||
" on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; \n"
|
||||
" # \n"
|
||||
" # for dvr(dvr_plan is hss). \n"
|
||||
" # when dvr got flv header, call the hook, \n"
|
||||
" # the request in the POST data string is a object encode by json: \n"
|
||||
" # { \n"
|
||||
" # \"action\": \"on_dvr_hss_reap_flv_header\", \n"
|
||||
" # \"vhost\": \"video.test.com\", \"app\": \"live\", \n"
|
||||
" # \"stream\": \"livestream\", \n"
|
||||
" # \"segment\": { \n"
|
||||
" # \"cwd\": \"/usr/local/srs\", \n"
|
||||
" # \"path\": \"./objs/nginx/html/live/livestream.header.flv\" \n"
|
||||
" # } \n"
|
||||
" # } \n"
|
||||
" # when dvr reap flv file, call the hook, \n"
|
||||
" # the request in the POST data string is a object encode by json: \n"
|
||||
" # { \n"
|
||||
" # \"action\": \"on_dvr_hss_reap_flv\", \n"
|
||||
" # \"vhost\": \"video.test.com\", \"app\": \"live\", \n"
|
||||
" # \"stream\": \"livestream\", \n"
|
||||
" # \"segment\": { \n"
|
||||
" # \"cwd\": \"/usr/local/srs\", \n"
|
||||
" # \"path\": \"./objs/nginx/html/live/livestream.1398315892865.flv\", \n"
|
||||
" # \"duration\": 1001, \"offset\":0, \n"
|
||||
" # \"has_keyframe\": true, \"pts\":1398315895958 \n"
|
||||
" # } \n"
|
||||
" # } \n"
|
||||
" # if valid, the hook must return HTTP code 200(Stauts OK) and response \n"
|
||||
" # an int value specifies the error code(0 corresponding to success): \n"
|
||||
" # 0 \n"
|
||||
" # support multiple api hooks, format: \n"
|
||||
" # on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN \n"
|
||||
" on_dvr_hss_reap_flv http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs; \n"
|
||||
" } \n"
|
||||
"} \n"
|
||||
" \n"
|
||||
|
@ -1098,9 +1064,6 @@ VOID TEST(ConfigTest, CheckMacros)
|
|||
#ifndef SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT
|
||||
EXPECT_TRUE(false);
|
||||
#endif
|
||||
#ifndef SRS_CONF_DEFAULT_DVR_PLAN_HSS
|
||||
EXPECT_TRUE(false);
|
||||
#endif
|
||||
#ifndef SRS_CONF_DEFAULT_DVR_PLAN
|
||||
EXPECT_TRUE(false);
|
||||
#endif
|
||||
|
@ -1917,7 +1880,6 @@ VOID TEST(ConfigMainTest, ParseFullConf)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -1997,7 +1959,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_same_edge)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2077,7 +2038,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_change_edge)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2151,7 +2111,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_dvr)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2225,7 +2184,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_ingest)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2320,7 +2278,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_http)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2397,7 +2354,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_enabled)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2474,7 +2430,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_hls_disabled)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2582,12 +2537,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_http_hooks)
|
|||
EXPECT_STREQ("http://127.0.0.1:8085/api/v1/sessions", callback->arg0().c_str());
|
||||
EXPECT_STREQ("http://localhost:8085/api/v1/sessions", callback->arg1().c_str());
|
||||
}
|
||||
EXPECT_TRUE(NULL != conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
if (true) {
|
||||
SrsConfDirective* callback = conf.get_vhost_on_dvr_hss_reap_flv(vhost);
|
||||
EXPECT_STREQ("http://127.0.0.1:8085/api/v1/dvrs", callback->arg0().c_str());
|
||||
EXPECT_STREQ("http://localhost:8085/api/v1/dvrs", callback->arg1().c_str());
|
||||
}
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2665,7 +2614,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_min_delay)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2758,7 +2706,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_refer_anti_suck)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2841,7 +2788,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_same_vhost)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2920,7 +2866,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_forward_change_vhost)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -2998,7 +2943,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_mirror)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3087,7 +3031,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_crop)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3176,7 +3119,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_logo)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3265,7 +3207,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_audio)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3348,7 +3289,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_vn)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3431,7 +3371,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_copy)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3510,7 +3449,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_all)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3727,7 +3665,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_ffempty)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3816,7 +3753,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_app)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3905,7 +3841,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_transcode_stream)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -3994,7 +3929,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_bandcheck)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_STREQ("35c9b402c12a7246868752e2878f7e0e", conf.get_bw_check_key(vhost).c_str());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -4072,7 +4006,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_chunksize)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -4150,7 +4083,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_jitter)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -4228,7 +4160,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_atc)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -4306,7 +4237,6 @@ VOID TEST(ConfigMainTest, ParseFullConf_removed)
|
|||
EXPECT_TRUE(NULL == conf.get_vhost_on_unpublish(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_play(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_stop(vhost));
|
||||
EXPECT_TRUE(NULL == conf.get_vhost_on_dvr_hss_reap_flv(vhost));
|
||||
EXPECT_FALSE(conf.get_bw_check_enabled(vhost));
|
||||
EXPECT_TRUE(conf.get_bw_check_key(vhost).empty());
|
||||
EXPECT_EQ(30000, conf.get_bw_check_interval_ms(vhost));
|
||||
|
@ -5018,16 +4948,6 @@ VOID TEST(ConfigMainTest, CheckConf_hooks)
|
|||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse(_MIN_OK_CONF"vhost v{http_hooks{on_stops http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{http_hooks{on_dvr_hss_reap_flv http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;}}"));
|
||||
}
|
||||
|
||||
if (true) {
|
||||
MockSrsConfig conf;
|
||||
EXPECT_TRUE(ERROR_SUCCESS != conf.parse(_MIN_OK_CONF"vhost v{http_hooks{on_dvr_hss_reap_flvs http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;}}"));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TEST(ConfigMainTest, CheckConf_gop_cache)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue