Always enable DVR

pull/763/head
winlin 8 years ago
parent b0789c54e4
commit 7fd221ef63

@ -16,7 +16,6 @@ help=no
################################################################
# feature options
SRS_HDS=RESERVED
SRS_DVR=RESERVED
SRS_NGINX=RESERVED
SRS_SSL=RESERVED
SRS_FFMPEG_TOOL=RESERVED
@ -47,6 +46,7 @@ SRS_HTTP_SERVER=YES
SRS_HTTP_API=YES
SRS_HTTP_CORE=YES
SRS_HLS=YES
SRS_DVR=YES
#
################################################################
# libraries
@ -116,8 +116,7 @@ Options:
-h, --help print this message
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
--with-hds enable hds streaming, mux RTMP to f4m/f4v files.
--with-dvr enable dvr, mux RTMP to flv files.
--with-hds enable hds streaming, mux RTMP to F4M/F4V files.
--with-nginx enable delivery HTTP stream with nginx.
--with-stream-caster enable stream caster to serve other stream over other protocol.
--with-kafka enable srs kafka producer to report to kafka.
@ -139,7 +138,6 @@ Options:
--without-ssl disable rtmp complex handshake.
--without-hds disable hds, the adobe http dynamic streaming.
--without-dvr disable dvr, donot support record RTMP stream to flv.
--without-nginx disable delivery HTTP stream with nginx.
--without-stream-caster disable stream caster, only listen and serve RTMP/HTTP.
--without-kafka disable the srs kafka producer.
@ -184,10 +182,11 @@ Presets:
--x86-64 alias for --x86-x64.
Always Enabled:
--with-http-api enable http api, to manage SRS by http api.
--with-http-callback enable http hooks, build cherrypy as demo api server.
--with-http-server enable http server to delivery http stream.
--with-hls enable hls streaming, mux RTMP to m3u8/ts files.
--with-http-api enable HTTP API, to communicate with SRS.
--with-http-callback enable HTTP hooks, build cherrypy as demo api server.
--with-http-server enable HTTP server to delivery http stream.
--with-hls enable HLS streaming, mux RTMP to M3U8/TS files.
--with-dvr enable DVR, record RTMP to FLV/MP4 files.
Conflicts:
1. --with-gmc vs --with-gmp:
@ -225,7 +224,6 @@ function parse_user_option() {
--with-ssl) SRS_SSL=YES ;;
--with-hds) SRS_HDS=YES ;;
--with-dvr) SRS_DVR=YES ;;
--with-nginx) SRS_NGINX=YES ;;
--with-ffmpeg) SRS_FFMPEG_TOOL=YES ;;
--with-transcode) SRS_TRANSCODE=YES ;;
@ -247,7 +245,6 @@ function parse_user_option() {
--without-ssl) SRS_SSL=NO ;;
--without-hds) SRS_HDS=NO ;;
--without-dvr) SRS_DVR=NO ;;
--without-nginx) SRS_NGINX=NO ;;
--without-ffmpeg) SRS_FFMPEG_TOOL=NO ;;
--without-transcode) SRS_TRANSCODE=NO ;;
@ -298,10 +295,12 @@ function parse_user_option() {
--with-http-api) SRS_HTTP_API=YES ;;
--with-http-server) SRS_HTTP_SERVER=YES ;;
--with-hls) SRS_HLS=YES ;;
--with-dvr) SRS_DVR=YES ;;
--without-http-callback) SRS_HTTP_CALLBACK=NO ;;
--without-http-api) SRS_HTTP_API=NO ;;
--without-http-server) SRS_HTTP_SERVER=NO ;;
--without-hls) SRS_HLS=NO ;;
--without-dvr) SRS_DVR=NO ;;
*)
echo "$0: error: invalid option \"$option\""
@ -383,7 +382,6 @@ function apply_user_presets() {
# all disabled.
if [ $SRS_DISABLE_ALL = YES ]; then
SRS_HDS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
@ -407,7 +405,6 @@ function apply_user_presets() {
# all enabled.
if [ $SRS_ENABLE_ALL = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=YES
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
@ -431,7 +428,6 @@ function apply_user_presets() {
# only rtmp vp6
if [ $SRS_FAST = YES ]; then
SRS_HDS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
@ -455,7 +451,6 @@ function apply_user_presets() {
# only ssl for RTMP with complex handshake.
if [ $SRS_PURE_RTMP = YES ]; then
SRS_HDS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -479,7 +474,6 @@ function apply_user_presets() {
# if arm specified, set some default to disabled.
if [ $SRS_ARM_UBUNTU12 = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -504,7 +498,6 @@ function apply_user_presets() {
# if mips specified, set some default to disabled.
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -528,7 +521,6 @@ function apply_user_presets() {
# defaults for x86/x64
if [ $SRS_X86_X64 = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -552,7 +544,6 @@ function apply_user_presets() {
# for osx(darwin)
if [ $SRS_OSX = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -576,7 +567,6 @@ function apply_user_presets() {
# if dev specified, open features if possible.
if [ $SRS_DEV = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
@ -600,7 +590,6 @@ function apply_user_presets() {
# if fast dev specified, open main server features.
if [ $SRS_FAST_DEV = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -624,7 +613,6 @@ function apply_user_presets() {
# for srs demo
if [ $SRS_DEMO = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
@ -648,7 +636,6 @@ function apply_user_presets() {
# if raspberry-pi specified, open ssl/hls/static features
if [ $SRS_PI = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=NO
@ -672,7 +659,6 @@ function apply_user_presets() {
# if cubieboard specified, open features except ffmpeg/nginx.
if [ $SRS_CUBIE = YES ]; then
SRS_HDS=YES
SRS_DVR=YES
SRS_NGINX=NO
SRS_SSL=YES
SRS_FFMPEG_TOOL=YES
@ -716,6 +702,7 @@ function apply_user_detail_options() {
if [ $SRS_HTTP_SERVER = NO ]; then SRS_HTTP_SERVER=YES; echo -e "${YELLOW}[WARN] Always enable HTTP server.${BLACK}"; fi
if [ $SRS_HTTP_API = NO ]; then SRS_HTTP_API=YES; echo -e "${YELLOW}[WARN] Always enable HTTP API.${BLACK}"; fi
if [ $SRS_HLS = NO ]; then SRS_HLS=YES; echo -e "${YELLOW}[WARN] Always enable HLS.${BLACK}"; fi
if [ $SRS_DVR = NO ]; then SRS_DVR=YES; echo -e "${YELLOW}[WARN] Always enable DVR.${BLACK}"; fi
# parse the jobs for make
if [[ "" -eq SRS_JOBS ]]; then
@ -732,7 +719,6 @@ function apply_user_detail_options() {
# disable almost all features for export srs-librtmp.
if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
SRS_HDS=NO
SRS_DVR=NO
SRS_NGINX=NO
SRS_SSL=NO
SRS_FFMPEG_TOOL=NO
@ -853,7 +839,6 @@ function check_option_conflicts() {
# check variable neccessary
if [ $SRS_HDS = RESERVED ]; then echo "you must specifies the hds, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi
if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi

@ -4040,11 +4040,9 @@ int SrsConfig::check_config()
for (int i = 0; i < (int)vhosts.size(); i++) {
SrsConfDirective* vhost = vhosts[i];
srs_assert(vhost != NULL);
#ifndef SRS_AUTO_DVR
if (get_dvr_enabled(vhost->arg0())) {
srs_warn("dvr of vhost %s is disabled by configure", vhost->arg0().c_str());
}
#endif
if (get_hls_enabled(vhost->arg0())) {
srs_warn("hls of vhost %s is disabled by configure", vhost->arg0().c_str());
}

@ -23,8 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_dvr.hpp>
#ifdef SRS_AUTO_DVR
#include <fcntl.h>
#include <sstream>
#include <algorithm>
@ -1100,6 +1098,4 @@ int SrsDvr::on_reload_vhost_dvr_apply(string vhost)
return ret;
}
#endif

@ -32,8 +32,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <string>
#include <sstream>
#ifdef SRS_AUTO_DVR
class SrsSource;
class SrsOriginHub;
class SrsRequest;
@ -318,5 +316,3 @@ public:
#endif
#endif

@ -553,11 +553,7 @@ int SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
features->set("callback", SrsJsonAny::boolean(true));
features->set("api", SrsJsonAny::boolean(true));
features->set("httpd", SrsJsonAny::boolean(true));
#ifdef SRS_AUTO_DVR
features->set("dvr", SrsJsonAny::boolean(true));
#else
features->set("dvr", SrsJsonAny::boolean(false));
#endif
#ifdef SRS_AUTO_TRANSCODE
features->set("transcode", SrsJsonAny::boolean(true));
#else

@ -843,9 +843,7 @@ SrsOriginHub::SrsOriginHub(SrsSource* s)
is_active = false;
hls = new SrsHls();
#ifdef SRS_AUTO_DVR
dvr = new SrsDvr();
#endif
#ifdef SRS_AUTO_TRANSCODE
encoder = new SrsEncoder();
#endif
@ -872,9 +870,7 @@ SrsOriginHub::~SrsOriginHub()
srs_freep(ng_exec);
srs_freep(hls);
#ifdef SRS_AUTO_DVR
srs_freep(dvr);
#endif
#ifdef SRS_AUTO_TRANSCODE
srs_freep(encoder);
#endif
@ -893,11 +889,9 @@ int SrsOriginHub::initialize(SrsRequest* r)
return ret;
}
#ifdef SRS_AUTO_DVR
if ((ret = dvr->initialize(this, req)) != ERROR_SUCCESS) {
return ret;
}
#endif
return ret;
}
@ -934,12 +928,10 @@ int SrsOriginHub::on_meta_data(SrsSharedPtrMessage* shared_metadata)
}
}
#ifdef SRS_AUTO_DVR
if ((ret = dvr->on_meta_data(shared_metadata)) != ERROR_SUCCESS) {
srs_error("dvr process onMetaData message failed. ret=%d", ret);
return ret;
}
#endif
return ret;
}
@ -975,7 +967,6 @@ int SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
}
}
#ifdef SRS_AUTO_DVR
if ((ret = dvr->on_audio(msg)) != ERROR_SUCCESS) {
srs_warn("dvr process audio message failed, ignore and disable dvr. ret=%d", ret);
@ -985,7 +976,6 @@ int SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
// ignore.
ret = ERROR_SUCCESS;
}
#endif
#ifdef SRS_AUTO_HDS
if ((ret = hds->on_audio(msg)) != ERROR_SUCCESS) {
@ -1044,7 +1034,6 @@ int SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_sequence_h
}
}
#ifdef SRS_AUTO_DVR
if ((ret = dvr->on_video(msg)) != ERROR_SUCCESS) {
srs_warn("dvr process video message failed, ignore and disable dvr. ret=%d", ret);
@ -1054,7 +1043,6 @@ int SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_sequence_h
// ignore.
ret = ERROR_SUCCESS;
}
#endif
#ifdef SRS_AUTO_HDS
if ((ret = hds->on_video(msg)) != ERROR_SUCCESS) {
@ -1105,12 +1093,10 @@ int SrsOriginHub::on_publish()
return ret;
}
#ifdef SRS_AUTO_DVR
if ((ret = dvr->on_publish(false)) != ERROR_SUCCESS) {
srs_error("start dvr failed. ret=%d", ret);
return ret;
}
#endif
// TODO: FIXME: use initialize to set req.
#ifdef SRS_AUTO_HDS
@ -1143,10 +1129,7 @@ void SrsOriginHub::on_unpublish()
#endif
hls->on_unpublish();
#ifdef SRS_AUTO_DVR
dvr->on_unpublish();
#endif
#ifdef SRS_AUTO_HDS
hds->on_unpublish();
@ -1212,7 +1195,6 @@ int SrsOriginHub::on_dvr_request_sh()
SrsSharedPtrMessage* cache_sh_video = source->meta->vsh();
SrsSharedPtrMessage* cache_sh_audio = source->meta->ash();
#ifdef SRS_AUTO_DVR
// feed the dvr the metadata/sequence header,
// when reload to start dvr, dvr will never get the sequence header in stream,
// use the SrsSource.on_dvr_request_sh to push the sequence header to DVR.
@ -1229,7 +1211,6 @@ int SrsOriginHub::on_dvr_request_sh()
srs_error("dvr process audio sequence header message failed. ret=%d", ret);
return ret;
}
#endif
return ret;
}
@ -1326,7 +1307,6 @@ int SrsOriginHub::on_reload_vhost_dvr(string vhost)
// TODO: FIXME: maybe should ignore when publish already stopped?
#ifdef SRS_AUTO_DVR
// cleanup dvr
dvr->on_unpublish();
@ -1347,7 +1327,6 @@ int SrsOriginHub::on_reload_vhost_dvr(string vhost)
}
srs_trace("vhost %s dvr reload success", vhost.c_str());
#endif
return ret;
}

@ -55,9 +55,7 @@ class SrsNgExec;
class SrsConnection;
class SrsMessageHeader;
class SrsHls;
#ifdef SRS_AUTO_DVR
class SrsDvr;
#endif
#ifdef SRS_AUTO_TRANSCODE
class SrsEncoder;
#endif
@ -425,9 +423,7 @@ private:
// hls handler.
SrsHls* hls;
// dvr handler.
#ifdef SRS_AUTO_DVR
SrsDvr* dvr;
#endif
// transcoding handler.
#ifdef SRS_AUTO_TRANSCODE
SrsEncoder* encoder;

Loading…
Cancel
Save