Skip to content

Commit fb3fced

Browse files
committed
for ossrs#179, revert dvr http api. 2.0.128.
1 parent 4505983 commit fb3fced

File tree

10 files changed

+7
-932
lines changed

10 files changed

+7
-932
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ Supported operating systems and hardware:
513513
[#304](https://github.com/winlinvip/simple-rtmp-server/issues/304).
514514
1. Support push RTSP to SRS, read
515515
[#133](https://github.com/winlinvip/simple-rtmp-server/issues/133).
516-
1. Support DVR http api, read
517-
[#179](https://github.com/winlinvip/simple-rtmp-server/issues/179).
518516
1. [no-plan] Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech).
519517
1. [no-plan] Support RTMP 302 redirect [#92](https://github.com/winlinvip/simple-rtmp-server/issues/92).
520518
1. [no-plan] Support multiple processes, for both origin and edge
@@ -552,10 +550,9 @@ Supported operating systems and hardware:
552550
## History
553551

554552
### SRS 2.0 history
555-
556-
* v2.0, 2015-02-24, for [#179](https://github.com/winlinvip/simple-rtmp-server/issues/179), dvr suport vhost/app/stream level control. 2.0.125.
557-
* v2.0, 2015-02-24, for [#304](https://github.com/winlinvip/simple-rtmp-server/issues/304), fix hls bug, write pts/dts error. 2.0.124.
558-
* v2.0, 2015-02-24, fix [#179](https://github.com/winlinvip/simple-rtmp-server/issues/179), support dvr http api. 2.0.123.
553+
.
554+
* v2.0, 2015-03-01, for [#179](https://github.com/winlinvip/simple-rtmp-server/issues/179), revert dvr http api. 2.0.128.
555+
* v2.0, 2015-02-24, for [#304](https://github.com/winlinvip/simple-rtmp-server/issues/304), fix hls bug, write pts/dts error. 2.0.124
559556
* v2.0, 2015-02-19, refine dvr, append file when dvr file exists. 2.0.122.
560557
* v2.0, 2015-02-19, refine pithy print to more easyer to use. 2.0.121.
561558
* v2.0, 2015-02-18, fix [#133](https://github.com/winlinvip/simple-rtmp-server/issues/133), support push rtsp to srs. 2.0.120.

trunk/conf/full.conf

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -288,52 +288,7 @@ vhost dvr.srs.com {
288288
# session reap flv when session end(unpublish).
289289
# segment reap flv when flv duration exceed the specified dvr_duration.
290290
# append always append to flv file, never reap it.
291-
# api reap flv when api required.
292-
# about the api plan, the HTTP api to dvr,
293-
# http url to control dvr, for example, http://dev:1985/api/v1/dvrs
294-
# method=GET
295-
# to query dvrs of server.
296-
# request params, for example ?vhost=__defaultVhost__&&app=live&&stream=livestream, where:
297-
# vhost, <required>, query all dvr of this vhost.
298-
# app, [optinal], query all dvr of this app. query all app if not specified.
299-
# stream, [optional], query specified dvr stream. query all stream if not specified.
300-
# response in json, where:
301-
# {code:0, dvrs: [{path_tmpl:"./[15].[04].[05].[999].flv", path_dvr:"./22.7.43.312.flv",
302-
# vhost:"__defaultVhost", app:"live", stream:"livestream",
303-
# wait_keyframe:true, callback:"http://127.0.0.1:8085/api/v1/dvrs",
304-
# status:"stop"|"start"
305-
# }]}
306-
# method=POST
307-
# to start dvr of specified vhost.
308-
# request should encode in json, specifies the dvr to create, where:
309-
# {path_tmpl:"./[15].[04].[05].[999].flv",
310-
# vhost:"__defaultVhost", app:"live", stream:"livestream",
311-
# wait_keyframe:true, callback:"http://127.0.0.1:8085/api/v1/dvrs"
312-
# }
313-
# @remark, the app and stream is required for POST.
314-
# response in json, where:
315-
# {code:0}
316-
# method=DELETE, to stop dvr
317-
# to stop dvr of specified vhost.
318-
# request params, for example ?vhost=__defaultVhost__, where:
319-
# vhost, stop all dvr of this vhost.
320-
# response in json, where:
321-
# {code:0}
322-
# method=PUT, use as RPC(remote process call).
323-
# reap_segment, the request params in json, where:
324-
# {action:"reap_segment", vhost:"__defaultVhost", app:"live", stream:"livestream",
325-
# path_tmpl:"./[15].[04].[05].[999].flv"
326-
# }
327-
# @remark, the app and stream is optional.
328-
# when reap segment, the callback POST request in json:
329-
# {action:"on_dvr_reap_segment", client_id:100, vhost:"__defaultVhost__",
330-
# app:"live", stream:"livestream", cwd:"/home/winlin/srs", file:"./dvr.flv"
331-
# }
332-
# for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com
333-
# @read https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DVR#http-callback
334-
# @read https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_DVR#http-callback
335291
# default: session
336-
# TODO: FIXME: update wiki for the api plan.
337292
dvr_plan session;
338293
# the dvr output path.
339294
# we supports some variables to generate the filename.
@@ -369,27 +324,20 @@ vhost dvr.srs.com {
369324
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DVR#custom-path
370325
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_EN_DVR#custom-path
371326
# segment,session apply it.
372-
# api apply before api specified the path.
373327
# default: ./objs/nginx/html
374328
dvr_path ./objs/nginx/html;
375329
# the duration for dvr file, reap if exeed, in seconds.
376330
# segment apply it.
377-
# session,api ignore.
331+
# session,append ignore.
378332
# default: 30
379333
dvr_duration 30;
380334
# whether wait keyframe to reap segment,
381335
# if off, reap segment when duration exceed the dvr_duration,
382336
# if on, reap segment when duration exceed and got keyframe.
383337
# segment apply it.
384-
# session,api ignore.
338+
# session,append ignore.
385339
# default: on
386340
dvr_wait_keyframe on;
387-
# whether dvr auto start when publish.
388-
# if off, dvr wait for api to start it.
389-
# api apply it.
390-
# segment,session ignore.
391-
# default: on
392-
dvr_autostart on;
393341
# about the stream monotonically increasing:
394342
# 1. video timestamp is monotonically increasing,
395343
# 2. audio timestamp is monotonically increasing,

trunk/src/app/srs_app_config.cpp

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,6 @@ int SrsConfig::check_config()
14181418
string m = conf->at(j)->name.c_str();
14191419
if (m != "enabled" && m != "dvr_path" && m != "dvr_plan"
14201420
&& m != "dvr_duration" && m != "dvr_wait_keyframe" && m != "time_jitter"
1421-
&& m != "dvr_autostart"
14221421
) {
14231422
ret = ERROR_SYSTEM_CONFIG_INVALID;
14241423
srs_error("unsupported vhost dvr directive %s, ret=%d", m.c_str(), ret);
@@ -1977,41 +1976,6 @@ int SrsConfig::get_stream_caster_rtp_port_max(SrsConfDirective* sc)
19771976
return ::atoi(conf->arg0().c_str());
19781977
}
19791978

1980-
SrsConfDirective* SrsConfig::create_directive(string vhost, string directive, string sub_directive)
1981-
{
1982-
SrsConfDirective* vhost_conf = get_vhost(vhost);
1983-
1984-
if (!vhost_conf) {
1985-
vhost_conf = new SrsConfDirective();
1986-
vhost_conf->name = vhost;
1987-
root->directives.push_back(vhost_conf);
1988-
}
1989-
1990-
if (directive.empty()) {
1991-
return vhost_conf;
1992-
}
1993-
1994-
SrsConfDirective* dir = vhost_conf->get(directive);
1995-
if (!dir) {
1996-
dir = new SrsConfDirective();
1997-
dir->name = directive;
1998-
vhost_conf->directives.push_back(dir);
1999-
}
2000-
2001-
if (sub_directive.empty()) {
2002-
return dir;
2003-
}
2004-
2005-
SrsConfDirective* sdir = dir->get(sub_directive);
2006-
if (!sdir) {
2007-
sdir = new SrsConfDirective();
2008-
sdir->name = sub_directive;
2009-
dir->directives.push_back(sdir);
2010-
}
2011-
2012-
return sdir;
2013-
}
2014-
20151979
SrsConfDirective* SrsConfig::get_vhost(string vhost)
20161980
{
20171981
srs_assert(root);
@@ -2355,13 +2319,6 @@ bool SrsConfig::get_vhost_http_hooks_enabled(string vhost)
23552319
return true;
23562320
}
23572321

2358-
void SrsConfig::set_vhost_http_hooks_enabled(string vhost, bool enabled)
2359-
{
2360-
SrsConfDirective* conf = create_directive(vhost, "http_hooks", "enabled");
2361-
conf->args.clear();
2362-
conf->args.push_back(enabled? "on":"off");
2363-
}
2364-
23652322
SrsConfDirective* SrsConfig::get_vhost_on_connect(string vhost)
23662323
{
23672324
SrsConfDirective* conf = get_vhost_http_hooks(vhost);
@@ -2439,13 +2396,6 @@ SrsConfDirective* SrsConfig::get_vhost_on_dvr(string vhost)
24392396
return conf->get("on_dvr");
24402397
}
24412398

2442-
void SrsConfig::set_vhost_on_dvr(string vhost, string callback)
2443-
{
2444-
SrsConfDirective* conf = create_directive(vhost, "http_hooks", "on_dvr");
2445-
conf->args.clear();
2446-
conf->args.push_back(callback);
2447-
}
2448-
24492399
bool SrsConfig::get_bw_check_enabled(string vhost)
24502400
{
24512401
SrsConfDirective* conf = get_vhost(vhost);
@@ -3359,13 +3309,6 @@ bool SrsConfig::get_dvr_enabled(string vhost)
33593309
return false;
33603310
}
33613311

3362-
void SrsConfig::set_dvr_enabled(string vhost, bool enabled)
3363-
{
3364-
SrsConfDirective* conf = create_directive(vhost, "dvr", "enabled");
3365-
conf->args.clear();
3366-
conf->args.push_back(enabled? "on":"off");
3367-
}
3368-
33693312
string SrsConfig::get_dvr_path(string vhost)
33703313
{
33713314
SrsConfDirective* dvr = get_dvr(vhost);
@@ -3383,13 +3326,6 @@ string SrsConfig::get_dvr_path(string vhost)
33833326
return conf->arg0();
33843327
}
33853328

3386-
void SrsConfig::set_dvr_path(string vhost, string path)
3387-
{
3388-
SrsConfDirective* conf = create_directive(vhost, "dvr", "dvr_path");
3389-
conf->args.clear();
3390-
conf->args.push_back(path);
3391-
}
3392-
33933329
string SrsConfig::get_dvr_plan(string vhost)
33943330
{
33953331
SrsConfDirective* dvr = get_dvr(vhost);
@@ -3407,13 +3343,6 @@ string SrsConfig::get_dvr_plan(string vhost)
34073343
return conf->arg0();
34083344
}
34093345

3410-
void SrsConfig::set_dvr_plan(string vhost, string plan)
3411-
{
3412-
SrsConfDirective* conf = create_directive(vhost, "dvr", "dvr_plan");
3413-
conf->args.clear();
3414-
conf->args.push_back(plan);
3415-
}
3416-
34173346
int SrsConfig::get_dvr_duration(string vhost)
34183347
{
34193348
SrsConfDirective* dvr = get_dvr(vhost);
@@ -3448,30 +3377,6 @@ bool SrsConfig::get_dvr_wait_keyframe(string vhost)
34483377
return false;
34493378
}
34503379

3451-
void SrsConfig::set_dvr_wait_keyframe(string vhost, bool wait_keyframe)
3452-
{
3453-
SrsConfDirective* conf = create_directive(vhost, "dvr", "dvr_wait_keyframe");
3454-
conf->args.clear();
3455-
conf->args.push_back(wait_keyframe? "on":"off");
3456-
}
3457-
3458-
bool SrsConfig::get_dvr_autostart(string vhost)
3459-
{
3460-
SrsConfDirective* dvr = get_dvr(vhost);
3461-
3462-
if (!dvr) {
3463-
return true;
3464-
}
3465-
3466-
SrsConfDirective* conf = dvr->get("dvr_autostart");
3467-
3468-
if (!conf || conf->arg0() != "off") {
3469-
return true;
3470-
}
3471-
3472-
return false;
3473-
}
3474-
34753380
int SrsConfig::get_dvr_time_jitter(string vhost)
34763381
{
34773382
SrsConfDirective* dvr = get_dvr(vhost);

trunk/src/app/srs_app_config.hpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6161
#define SRS_CONF_DEFAULT_DVR_PLAN_SESSION "session"
6262
#define SRS_CONF_DEFAULT_DVR_PLAN_SEGMENT "segment"
6363
#define SRS_CONF_DEFAULT_DVR_PLAN_APPEND "append"
64-
#define SRS_CONF_DEFAULT_DVR_PLAN_API "api"
6564
#define SRS_CONF_DEFAULT_DVR_PLAN SRS_CONF_DEFAULT_DVR_PLAN_SESSION
6665
#define SRS_CONF_DEFAULT_DVR_DURATION 30
6766
#define SRS_CONF_DEFAULT_TIME_JITTER "full"
@@ -452,14 +451,6 @@ class SrsConfig
452451
* get the max udp port for rtp of stream caster rtsp.
453452
*/
454453
virtual int get_stream_caster_rtp_port_max(SrsConfDirective* sc);
455-
private:
456-
/**
457-
* create directive under vhost.
458-
* @param directive, get the directive of vhost. get vhost if directive is empty.
459-
* @param sub_directive, get the sub directive of vhost. get directive if sub-directive is empty.
460-
* @return the vhost(empty directive and sub-directive); the directive(empty sub-directive); the sub-directive.
461-
*/
462-
virtual SrsConfDirective* create_directive(std::string vhost, std::string directive, std::string sub_directive);
463454
// vhost specified section
464455
public:
465456
/**
@@ -596,7 +587,6 @@ class SrsConfig
596587
* @remark, if not enabled, donot callback all http hooks.
597588
*/
598589
virtual bool get_vhost_http_hooks_enabled(std::string vhost);
599-
virtual void set_vhost_http_hooks_enabled(std::string vhost, bool enabled);
600590
/**
601591
* get the on_connect callbacks of vhost.
602592
* @return the on_connect callback directive, the args is the url to callback.
@@ -632,7 +622,6 @@ class SrsConfig
632622
* @return the on_dvr callback directive, the args is the url to callback.
633623
*/
634624
virtual SrsConfDirective* get_vhost_on_dvr(std::string vhost);
635-
virtual void set_vhost_on_dvr(std::string vhost, std::string callback);
636625
// bwct(bandwidth check tool) section
637626
public:
638627
/**
@@ -925,17 +914,14 @@ class SrsConfig
925914
* whether dvr is enabled.
926915
*/
927916
virtual bool get_dvr_enabled(std::string vhost);
928-
virtual void set_dvr_enabled(std::string vhost, bool enabled);
929917
/**
930918
* get the dvr path, the flv file to save in.
931919
*/
932920
virtual std::string get_dvr_path(std::string vhost);
933-
virtual void set_dvr_path(std::string vhost, std::string path);
934921
/**
935922
* get the plan of dvr, how to reap the flv file.
936923
*/
937924
virtual std::string get_dvr_plan(std::string vhost);
938-
virtual void set_dvr_plan(std::string vhost, std::string plan);
939925
/**
940926
* get the duration of dvr flv.
941927
*/
@@ -944,11 +930,6 @@ class SrsConfig
944930
* whether wait keyframe to reap segment.
945931
*/
946932
virtual bool get_dvr_wait_keyframe(std::string vhost);
947-
virtual void set_dvr_wait_keyframe(std::string vhost, bool wait_keyframe);
948-
/**
949-
* whether autostart for dvr. wait api to start dvr if false.
950-
*/
951-
virtual bool get_dvr_autostart(std::string vhost);
952933
/**
953934
* get the time_jitter algorithm for dvr.
954935
*/

0 commit comments

Comments
 (0)