正在显示
17 个修改的文件
包含
26 行增加
和
556 行删除
| @@ -345,6 +345,7 @@ Remark: | @@ -345,6 +345,7 @@ Remark: | ||
| 345 | 345 | ||
| 346 | ## History | 346 | ## History |
| 347 | 347 | ||
| 348 | +* v2.0, 2016-12-15, for #513, remove hls ram from srs2 to srs3+. 2.0.224 | ||
| 348 | * <strong>v2.0, 2016-12-13, [2.0 beta3(2.0.223)][r2.0b3] released. 86685 lines.</strong> | 349 | * <strong>v2.0, 2016-12-13, [2.0 beta3(2.0.223)][r2.0b3] released. 86685 lines.</strong> |
| 349 | * v2.0, 2016-12-13, fix #713, disable the source cleanup. 2.0.223 | 350 | * v2.0, 2016-12-13, fix #713, disable the source cleanup. 2.0.223 |
| 350 | * v2.0, 2016-12-13, fix #713, refine source to avoid critical fetch and create. 2.0.222 | 351 | * v2.0, 2016-12-13, fix #713, refine source to avoid critical fetch and create. 2.0.222 |
| @@ -558,12 +558,6 @@ vhost with-hls.srs.com { | @@ -558,12 +558,6 @@ vhost with-hls.srs.com { | ||
| 558 | # @see https://github.com/ossrs/srs/issues/264 | 558 | # @see https://github.com/ossrs/srs/issues/264 |
| 559 | # default: continue | 559 | # default: continue |
| 560 | hls_on_error continue; | 560 | hls_on_error continue; |
| 561 | - # the hls storage: disk, ram or both. | ||
| 562 | - # disk, to write hls m3u8/ts to disk. | ||
| 563 | - # ram, serve m3u8/ts in memory, which use embeded http server to delivery. | ||
| 564 | - # both, disk and ram. | ||
| 565 | - # default: disk | ||
| 566 | - hls_storage disk; | ||
| 567 | # the hls output path. | 561 | # the hls output path. |
| 568 | # the m3u8 file is configed by hls_path/hls_m3u8_file, the default is: | 562 | # the m3u8 file is configed by hls_path/hls_m3u8_file, the default is: |
| 569 | # ./objs/nginx/html/[app]/[stream].m3u8 | 563 | # ./objs/nginx/html/[app]/[stream].m3u8 |
| @@ -610,13 +604,6 @@ vhost with-hls.srs.com { | @@ -610,13 +604,6 @@ vhost with-hls.srs.com { | ||
| 610 | # ... | 604 | # ... |
| 611 | # optional, default to empty string. | 605 | # optional, default to empty string. |
| 612 | hls_entry_prefix http://your-server; | 606 | hls_entry_prefix http://your-server; |
| 613 | - # the hls mount for hls_storage ram, | ||
| 614 | - # which use srs embeded http server to delivery HLS, | ||
| 615 | - # where the mount specifies the HTTP url to mount. | ||
| 616 | - # @see the mount of http_remux. | ||
| 617 | - # @remark the hls_mount must endswith .m3u8. | ||
| 618 | - # default: [vhost]/[app]/[stream].m3u8 | ||
| 619 | - hls_mount [vhost]/[app]/[stream].m3u8; | ||
| 620 | # the default audio codec of hls. | 607 | # the default audio codec of hls. |
| 621 | # when codec changed, write the PAT/PMT table, but maybe ok util next ts. | 608 | # when codec changed, write the PAT/PMT table, but maybe ok util next ts. |
| 622 | # so user can set the default codec for mp3. | 609 | # so user can set the default codec for mp3. |
trunk/conf/ram.hls.conf
已删除
100644 → 0
| 1 | -# the config for srs to delivery hls | ||
| 2 | -# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHLS | ||
| 3 | -# @see full.conf for detail config. | ||
| 4 | - | ||
| 5 | -listen 1935; | ||
| 6 | -max_connections 1000; | ||
| 7 | -http_server { | ||
| 8 | - enabled on; | ||
| 9 | - listen 8080; | ||
| 10 | - dir ./objs/nginx/html; | ||
| 11 | -} | ||
| 12 | -vhost __defaultVhost__ { | ||
| 13 | - hls { | ||
| 14 | - enabled on; | ||
| 15 | - hls_fragment 10; | ||
| 16 | - hls_window 60; | ||
| 17 | - hls_storage ram; | ||
| 18 | - hls_mount /[app]/[stream].m3u8; | ||
| 19 | - } | ||
| 20 | -} |
| @@ -82,8 +82,6 @@ const char* _srs_version = "XCORE-"RTMP_SIG_SRS_SERVER; | @@ -82,8 +82,6 @@ const char* _srs_version = "XCORE-"RTMP_SIG_SRS_SERVER; | ||
| 82 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" | 82 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR_DISCONNECT "disconnect" |
| 83 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue" | 83 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR_CONTINUE "continue" |
| 84 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE | 84 | #define SRS_CONF_DEFAULT_HLS_ON_ERROR SRS_CONF_DEFAULT_HLS_ON_ERROR_IGNORE |
| 85 | -#define SRS_CONF_DEFAULT_HLS_STORAGE "disk" | ||
| 86 | -#define SRS_CONF_DEFAULT_HLS_MOUNT "[vhost]/[app]/[stream].m3u8" | ||
| 87 | #define SRS_CONF_DEFAULT_HLS_ACODEC "aac" | 85 | #define SRS_CONF_DEFAULT_HLS_ACODEC "aac" |
| 88 | #define SRS_CONF_DEFAULT_HLS_VCODEC "h264" | 86 | #define SRS_CONF_DEFAULT_HLS_VCODEC "h264" |
| 89 | #define SRS_CONF_DEFAULT_HLS_CLEANUP true | 87 | #define SRS_CONF_DEFAULT_HLS_CLEANUP true |
| @@ -1906,6 +1904,11 @@ int SrsConfig::check_config() | @@ -1906,6 +1904,11 @@ int SrsConfig::check_config() | ||
| 1906 | srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret); | 1904 | srs_error("unsupported vhost hls directive %s, ret=%d", m.c_str(), ret); |
| 1907 | return ret; | 1905 | return ret; |
| 1908 | } | 1906 | } |
| 1907 | + | ||
| 1908 | + // TODO: FIXME: remove it in future. | ||
| 1909 | + if (m == "hls_storage" || m == "hls_mount") { | ||
| 1910 | + srs_warn("HLS RAM is removed from SRS2 to SRS3+, please read https://github.com/ossrs/srs/issues/513."); | ||
| 1911 | + } | ||
| 1909 | } | 1912 | } |
| 1910 | } else if (n == "http_hooks") { | 1913 | } else if (n == "http_hooks") { |
| 1911 | for (int j = 0; j < (int)conf->directives.size(); j++) { | 1914 | for (int j = 0; j < (int)conf->directives.size(); j++) { |
| @@ -3793,40 +3796,6 @@ string SrsConfig::get_hls_on_error(string vhost) | @@ -3793,40 +3796,6 @@ string SrsConfig::get_hls_on_error(string vhost) | ||
| 3793 | return conf->arg0(); | 3796 | return conf->arg0(); |
| 3794 | } | 3797 | } |
| 3795 | 3798 | ||
| 3796 | -string SrsConfig::get_hls_storage(string vhost) | ||
| 3797 | -{ | ||
| 3798 | - SrsConfDirective* hls = get_hls(vhost); | ||
| 3799 | - | ||
| 3800 | - if (!hls) { | ||
| 3801 | - return SRS_CONF_DEFAULT_HLS_STORAGE; | ||
| 3802 | - } | ||
| 3803 | - | ||
| 3804 | - SrsConfDirective* conf = hls->get("hls_storage"); | ||
| 3805 | - | ||
| 3806 | - if (!conf) { | ||
| 3807 | - return SRS_CONF_DEFAULT_HLS_STORAGE; | ||
| 3808 | - } | ||
| 3809 | - | ||
| 3810 | - return conf->arg0(); | ||
| 3811 | -} | ||
| 3812 | - | ||
| 3813 | -string SrsConfig::get_hls_mount(string vhost) | ||
| 3814 | -{ | ||
| 3815 | - SrsConfDirective* hls = get_hls(vhost); | ||
| 3816 | - | ||
| 3817 | - if (!hls) { | ||
| 3818 | - return SRS_CONF_DEFAULT_HLS_MOUNT; | ||
| 3819 | - } | ||
| 3820 | - | ||
| 3821 | - SrsConfDirective* conf = hls->get("hls_mount"); | ||
| 3822 | - | ||
| 3823 | - if (!conf) { | ||
| 3824 | - return SRS_CONF_DEFAULT_HLS_MOUNT; | ||
| 3825 | - } | ||
| 3826 | - | ||
| 3827 | - return conf->arg0(); | ||
| 3828 | -} | ||
| 3829 | - | ||
| 3830 | string SrsConfig::get_hls_acodec(string vhost) | 3799 | string SrsConfig::get_hls_acodec(string vhost) |
| 3831 | { | 3800 | { |
| 3832 | SrsConfDirective* hls = get_hls(vhost); | 3801 | SrsConfDirective* hls = get_hls(vhost); |
| @@ -915,14 +915,6 @@ public: | @@ -915,14 +915,6 @@ public: | ||
| 915 | */ | 915 | */ |
| 916 | virtual std::string get_hls_on_error(std::string vhost); | 916 | virtual std::string get_hls_on_error(std::string vhost); |
| 917 | /** | 917 | /** |
| 918 | - * get the HLS storage type. | ||
| 919 | - */ | ||
| 920 | - virtual std::string get_hls_storage(std::string vhost); | ||
| 921 | - /** | ||
| 922 | - * get the HLS mount url for HTTP server. | ||
| 923 | - */ | ||
| 924 | - virtual std::string get_hls_mount(std::string vhost); | ||
| 925 | - /** | ||
| 926 | * get the HLS default audio codec. | 918 | * get the HLS default audio codec. |
| 927 | */ | 919 | */ |
| 928 | virtual std::string get_hls_acodec(std::string vhost); | 920 | virtual std::string get_hls_acodec(std::string vhost); |
| @@ -61,14 +61,6 @@ using namespace std; | @@ -61,14 +61,6 @@ using namespace std; | ||
| 61 | // reset the piece id when deviation overflow this. | 61 | // reset the piece id when deviation overflow this. |
| 62 | #define SRS_JUMP_WHEN_PIECE_DEVIATION 20 | 62 | #define SRS_JUMP_WHEN_PIECE_DEVIATION 20 |
| 63 | 63 | ||
| 64 | -ISrsHlsHandler::ISrsHlsHandler() | ||
| 65 | -{ | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -ISrsHlsHandler::~ISrsHlsHandler() | ||
| 69 | -{ | ||
| 70 | -} | ||
| 71 | - | ||
| 72 | /** | 64 | /** |
| 73 | * * the HLS section, only available when HLS enabled. | 65 | * * the HLS section, only available when HLS enabled. |
| 74 | * */ | 66 | * */ |
| @@ -294,7 +286,6 @@ string SrsDvrAsyncCallOnHlsNotify::to_string() | @@ -294,7 +286,6 @@ string SrsDvrAsyncCallOnHlsNotify::to_string() | ||
| 294 | SrsHlsMuxer::SrsHlsMuxer() | 286 | SrsHlsMuxer::SrsHlsMuxer() |
| 295 | { | 287 | { |
| 296 | req = NULL; | 288 | req = NULL; |
| 297 | - handler = NULL; | ||
| 298 | hls_fragment = hls_window = 0; | 289 | hls_fragment = hls_window = 0; |
| 299 | hls_aof_ratio = 1.0; | 290 | hls_aof_ratio = 1.0; |
| 300 | deviation_ts = 0; | 291 | deviation_ts = 0; |
| @@ -384,12 +375,10 @@ int SrsHlsMuxer::deviation() | @@ -384,12 +375,10 @@ int SrsHlsMuxer::deviation() | ||
| 384 | return deviation_ts; | 375 | return deviation_ts; |
| 385 | } | 376 | } |
| 386 | 377 | ||
| 387 | -int SrsHlsMuxer::initialize(ISrsHlsHandler* h) | 378 | +int SrsHlsMuxer::initialize() |
| 388 | { | 379 | { |
| 389 | int ret = ERROR_SUCCESS; | 380 | int ret = ERROR_SUCCESS; |
| 390 | 381 | ||
| 391 | - handler = h; | ||
| 392 | - | ||
| 393 | if ((ret = async->start()) != ERROR_SUCCESS) { | 382 | if ((ret = async->start()) != ERROR_SUCCESS) { |
| 394 | return ret; | 383 | return ret; |
| 395 | } | 384 | } |
| @@ -425,19 +414,10 @@ int SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix, | @@ -425,19 +414,10 @@ int SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix, | ||
| 425 | 414 | ||
| 426 | // when update config, reset the history target duration. | 415 | // when update config, reset the history target duration. |
| 427 | max_td = (int)(fragment * _srs_config->get_hls_td_ratio(r->vhost)); | 416 | max_td = (int)(fragment * _srs_config->get_hls_td_ratio(r->vhost)); |
| 428 | - | ||
| 429 | - std::string storage = _srs_config->get_hls_storage(r->vhost); | ||
| 430 | - if (storage == "ram") { | ||
| 431 | - should_write_cache = true; | ||
| 432 | - should_write_file = false; | ||
| 433 | - } else if (storage == "disk") { | ||
| 434 | - should_write_cache = false; | ||
| 435 | - should_write_file = true; | ||
| 436 | - } else { | ||
| 437 | - srs_assert(storage == "both"); | ||
| 438 | - should_write_cache = true; | ||
| 439 | - should_write_file = true; | ||
| 440 | - } | 417 | + |
| 418 | + // TODO: FIXME: refine better for SRS2 only support disk. | ||
| 419 | + should_write_cache = false; | ||
| 420 | + should_write_file = true; | ||
| 441 | 421 | ||
| 442 | // create m3u8 dir once. | 422 | // create m3u8 dir once. |
| 443 | m3u8_dir = srs_path_dirname(m3u8); | 423 | m3u8_dir = srs_path_dirname(m3u8); |
| @@ -755,13 +735,6 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -755,13 +735,6 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
| 755 | srs_info("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, | 735 | srs_info("%s reap ts segment, sequence_no=%d, uri=%s, duration=%.2f, start=%"PRId64, |
| 756 | log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration, | 736 | log_desc.c_str(), current->sequence_no, current->uri.c_str(), current->duration, |
| 757 | current->segment_start_dts); | 737 | current->segment_start_dts); |
| 758 | - | ||
| 759 | - // notify handler for update ts. | ||
| 760 | - srs_assert(current->writer); | ||
| 761 | - if (handler && (ret = handler->on_update_ts(req, current->uri, current->writer->cache())) != ERROR_SUCCESS) { | ||
| 762 | - srs_error("notify handler for update ts failed. ret=%d", ret); | ||
| 763 | - return ret; | ||
| 764 | - } | ||
| 765 | 738 | ||
| 766 | // close the muxer of finished segment. | 739 | // close the muxer of finished segment. |
| 767 | srs_freep(current->muxer); | 740 | srs_freep(current->muxer); |
| @@ -829,13 +802,6 @@ int SrsHlsMuxer::segment_close(string log_desc) | @@ -829,13 +802,6 @@ int SrsHlsMuxer::segment_close(string log_desc) | ||
| 829 | } | 802 | } |
| 830 | } | 803 | } |
| 831 | 804 | ||
| 832 | - if (should_write_cache) { | ||
| 833 | - if ((ret = handler->on_remove_ts(req, segment->uri)) != ERROR_SUCCESS) { | ||
| 834 | - srs_warn("remove the ts from ram hls failed. ret=%d", ret); | ||
| 835 | - return ret; | ||
| 836 | - } | ||
| 837 | - } | ||
| 838 | - | ||
| 839 | srs_freep(segment); | 805 | srs_freep(segment); |
| 840 | } | 806 | } |
| 841 | segment_to_remove.clear(); | 807 | segment_to_remove.clear(); |
| @@ -957,12 +923,6 @@ int SrsHlsMuxer::_refresh_m3u8(string m3u8_file) | @@ -957,12 +923,6 @@ int SrsHlsMuxer::_refresh_m3u8(string m3u8_file) | ||
| 957 | return ret; | 923 | return ret; |
| 958 | } | 924 | } |
| 959 | srs_info("write m3u8 %s success.", m3u8_file.c_str()); | 925 | srs_info("write m3u8 %s success.", m3u8_file.c_str()); |
| 960 | - | ||
| 961 | - // notify handler for update m3u8. | ||
| 962 | - if (handler && (ret = handler->on_update_m3u8(req, writer.cache())) != ERROR_SUCCESS) { | ||
| 963 | - srs_error("notify handler for update m3u8 failed. ret=%d", ret); | ||
| 964 | - return ret; | ||
| 965 | - } | ||
| 966 | 926 | ||
| 967 | return ret; | 927 | return ret; |
| 968 | } | 928 | } |
| @@ -1171,7 +1131,6 @@ SrsHls::SrsHls() | @@ -1171,7 +1131,6 @@ SrsHls::SrsHls() | ||
| 1171 | { | 1131 | { |
| 1172 | _req = NULL; | 1132 | _req = NULL; |
| 1173 | source = NULL; | 1133 | source = NULL; |
| 1174 | - handler = NULL; | ||
| 1175 | 1134 | ||
| 1176 | hls_enabled = false; | 1135 | hls_enabled = false; |
| 1177 | hls_can_dispose = false; | 1136 | hls_can_dispose = false; |
| @@ -1244,14 +1203,13 @@ int SrsHls::cycle() | @@ -1244,14 +1203,13 @@ int SrsHls::cycle() | ||
| 1244 | return ret; | 1203 | return ret; |
| 1245 | } | 1204 | } |
| 1246 | 1205 | ||
| 1247 | -int SrsHls::initialize(SrsSource* s, ISrsHlsHandler* h) | 1206 | +int SrsHls::initialize(SrsSource* s) |
| 1248 | { | 1207 | { |
| 1249 | int ret = ERROR_SUCCESS; | 1208 | int ret = ERROR_SUCCESS; |
| 1250 | 1209 | ||
| 1251 | source = s; | 1210 | source = s; |
| 1252 | - handler = h; | ||
| 1253 | 1211 | ||
| 1254 | - if ((ret = muxer->initialize(h)) != ERROR_SUCCESS) { | 1212 | + if ((ret = muxer->initialize()) != ERROR_SUCCESS) { |
| 1255 | return ret; | 1213 | return ret; |
| 1256 | } | 1214 | } |
| 1257 | 1215 |
| @@ -54,39 +54,6 @@ class SrsTsCache; | @@ -54,39 +54,6 @@ class SrsTsCache; | ||
| 54 | class SrsTsContext; | 54 | class SrsTsContext; |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | -* the handler for hls event. | ||
| 58 | -* for example, we use memory only hls for | ||
| 59 | -*/ | ||
| 60 | -class ISrsHlsHandler | ||
| 61 | -{ | ||
| 62 | -public: | ||
| 63 | - ISrsHlsHandler(); | ||
| 64 | - virtual ~ISrsHlsHandler(); | ||
| 65 | -public: | ||
| 66 | - /** | ||
| 67 | - * when publish stream | ||
| 68 | - */ | ||
| 69 | - virtual int on_hls_publish(SrsRequest* req) = 0; | ||
| 70 | - /** | ||
| 71 | - * when update the m3u8 file. | ||
| 72 | - */ | ||
| 73 | - virtual int on_update_m3u8(SrsRequest* r, std::string m3u8) = 0; | ||
| 74 | - /** | ||
| 75 | - * when reap new ts file. | ||
| 76 | - */ | ||
| 77 | - virtual int on_update_ts(SrsRequest* r, std::string uri, std::string ts) = 0; | ||
| 78 | - /** | ||
| 79 | - * when remove the specified ts file, | ||
| 80 | - * for the hls to remove the expired ts not in hls window. | ||
| 81 | - */ | ||
| 82 | - virtual int on_remove_ts(SrsRequest* r, std::string uri) = 0; | ||
| 83 | - /** | ||
| 84 | - * when unpublish stream | ||
| 85 | - */ | ||
| 86 | - virtual int on_hls_unpublish(SrsRequest* req) = 0; | ||
| 87 | -}; | ||
| 88 | - | ||
| 89 | -/** | ||
| 90 | * * the HLS section, only available when HLS enabled. | 57 | * * the HLS section, only available when HLS enabled. |
| 91 | * */ | 58 | * */ |
| 92 | #ifdef SRS_AUTO_HLS | 59 | #ifdef SRS_AUTO_HLS |
| @@ -239,8 +206,7 @@ private: | @@ -239,8 +206,7 @@ private: | ||
| 239 | std::string m3u8; | 206 | std::string m3u8; |
| 240 | std::string m3u8_url; | 207 | std::string m3u8_url; |
| 241 | private: | 208 | private: |
| 242 | - ISrsHlsHandler* handler; | ||
| 243 | - // TODO: FIXME: supports reload. | 209 | + // TODO: FIXME: remove it. |
| 244 | bool should_write_cache; | 210 | bool should_write_cache; |
| 245 | bool should_write_file; | 211 | bool should_write_file; |
| 246 | private: | 212 | private: |
| @@ -277,7 +243,7 @@ public: | @@ -277,7 +243,7 @@ public: | ||
| 277 | /** | 243 | /** |
| 278 | * initialize the hls muxer. | 244 | * initialize the hls muxer. |
| 279 | */ | 245 | */ |
| 280 | - virtual int initialize(ISrsHlsHandler* h); | 246 | + virtual int initialize(); |
| 281 | /** | 247 | /** |
| 282 | * when publish, update the config for muxer. | 248 | * when publish, update the config for muxer. |
| 283 | */ | 249 | */ |
| @@ -390,7 +356,6 @@ class SrsHls | @@ -390,7 +356,6 @@ class SrsHls | ||
| 390 | private: | 356 | private: |
| 391 | SrsHlsMuxer* muxer; | 357 | SrsHlsMuxer* muxer; |
| 392 | SrsHlsCache* hls_cache; | 358 | SrsHlsCache* hls_cache; |
| 393 | - ISrsHlsHandler* handler; | ||
| 394 | private: | 359 | private: |
| 395 | SrsRequest* _req; | 360 | SrsRequest* _req; |
| 396 | bool hls_enabled; | 361 | bool hls_enabled; |
| @@ -426,7 +391,7 @@ public: | @@ -426,7 +391,7 @@ public: | ||
| 426 | /** | 391 | /** |
| 427 | * initialize the hls by handler and source. | 392 | * initialize the hls by handler and source. |
| 428 | */ | 393 | */ |
| 429 | - virtual int initialize(SrsSource* s, ISrsHlsHandler* h); | 394 | + virtual int initialize(SrsSource* s); |
| 430 | /** | 395 | /** |
| 431 | * publish stream event, continue to write the m3u8, | 396 | * publish stream event, continue to write the m3u8, |
| 432 | * for the muxer object not destroyed. | 397 | * for the muxer object not destroyed. |
| @@ -1382,30 +1382,5 @@ void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r) | @@ -1382,30 +1382,5 @@ void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r) | ||
| 1382 | http_stream->http_unmount(s, r); | 1382 | http_stream->http_unmount(s, r); |
| 1383 | } | 1383 | } |
| 1384 | 1384 | ||
| 1385 | -int SrsHttpServer::mount_hls(SrsRequest* r) | ||
| 1386 | -{ | ||
| 1387 | - return http_stream->mount_hls(r); | ||
| 1388 | -} | ||
| 1389 | - | ||
| 1390 | -int SrsHttpServer::hls_update_m3u8(SrsRequest* r, std::string m3u8) | ||
| 1391 | -{ | ||
| 1392 | - return http_stream->hls_update_m3u8(r, m3u8); | ||
| 1393 | -} | ||
| 1394 | - | ||
| 1395 | -int SrsHttpServer::hls_update_ts(SrsRequest* r, std::string uri, std::string ts) | ||
| 1396 | -{ | ||
| 1397 | - return http_stream->hls_update_ts(r, uri, ts); | ||
| 1398 | -} | ||
| 1399 | - | ||
| 1400 | -int SrsHttpServer::hls_remove_ts(SrsRequest* r, std::string uri) | ||
| 1401 | -{ | ||
| 1402 | - return http_stream->hls_remove_ts(r, uri); | ||
| 1403 | -} | ||
| 1404 | - | ||
| 1405 | -void SrsHttpServer::unmount_hls(SrsRequest* r) | ||
| 1406 | -{ | ||
| 1407 | - http_stream->unmount_hls(r); | ||
| 1408 | -} | ||
| 1409 | - | ||
| 1410 | #endif | 1385 | #endif |
| 1411 | 1386 |
| @@ -446,13 +446,6 @@ public: | @@ -446,13 +446,6 @@ public: | ||
| 446 | public: | 446 | public: |
| 447 | virtual int http_mount(SrsSource* s, SrsRequest* r); | 447 | virtual int http_mount(SrsSource* s, SrsRequest* r); |
| 448 | virtual void http_unmount(SrsSource* s, SrsRequest* r); | 448 | virtual void http_unmount(SrsSource* s, SrsRequest* r); |
| 449 | -// hls stream | ||
| 450 | -public: | ||
| 451 | - virtual int mount_hls(SrsRequest* r); | ||
| 452 | - virtual int hls_update_m3u8(SrsRequest* r, std::string m3u8); | ||
| 453 | - virtual int hls_update_ts(SrsRequest* r, std::string uri, std::string ts); | ||
| 454 | - virtual int hls_remove_ts(SrsRequest* r, std::string uri); | ||
| 455 | - virtual void unmount_hls(SrsRequest* r); | ||
| 456 | }; | 449 | }; |
| 457 | 450 | ||
| 458 | #endif | 451 | #endif |
| @@ -760,22 +760,6 @@ SrsHttpStreamServer::~SrsHttpStreamServer() | @@ -760,22 +760,6 @@ SrsHttpStreamServer::~SrsHttpStreamServer() | ||
| 760 | } | 760 | } |
| 761 | sflvs.clear(); | 761 | sflvs.clear(); |
| 762 | } | 762 | } |
| 763 | - if (true) { | ||
| 764 | - std::map<std::string, SrsHlsEntry*>::iterator it; | ||
| 765 | - for (it = thls.begin(); it != thls.end(); ++it) { | ||
| 766 | - SrsHlsEntry* entry = it->second; | ||
| 767 | - srs_freep(entry); | ||
| 768 | - } | ||
| 769 | - thls.clear(); | ||
| 770 | - } | ||
| 771 | - if (true) { | ||
| 772 | - std::map<std::string, SrsHlsEntry*>::iterator it; | ||
| 773 | - for (it = shls.begin(); it != shls.end(); ++it) { | ||
| 774 | - SrsHlsEntry* entry = it->second; | ||
| 775 | - srs_freep(entry); | ||
| 776 | - } | ||
| 777 | - shls.clear(); | ||
| 778 | - } | ||
| 779 | } | 763 | } |
| 780 | 764 | ||
| 781 | int SrsHttpStreamServer::initialize() | 765 | int SrsHttpStreamServer::initialize() |
| @@ -787,11 +771,6 @@ int SrsHttpStreamServer::initialize() | @@ -787,11 +771,6 @@ int SrsHttpStreamServer::initialize() | ||
| 787 | return ret; | 771 | return ret; |
| 788 | } | 772 | } |
| 789 | 773 | ||
| 790 | - // remux rtmp to hls live streaming | ||
| 791 | - if ((ret = initialize_hls_streaming()) != ERROR_SUCCESS) { | ||
| 792 | - return ret; | ||
| 793 | - } | ||
| 794 | - | ||
| 795 | return ret; | 774 | return ret; |
| 796 | } | 775 | } |
| 797 | 776 | ||
| @@ -957,190 +936,6 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost) | @@ -957,190 +936,6 @@ int SrsHttpStreamServer::on_reload_vhost_http_remux_updated(string vhost) | ||
| 957 | return ret; | 936 | return ret; |
| 958 | } | 937 | } |
| 959 | 938 | ||
| 960 | -int SrsHttpStreamServer::mount_hls(SrsRequest* r) | ||
| 961 | -{ | ||
| 962 | - int ret = ERROR_SUCCESS; | ||
| 963 | - | ||
| 964 | - std::string sid = r->get_stream_url(); | ||
| 965 | - | ||
| 966 | - if (shls.find(sid) == shls.end()) { | ||
| 967 | - srs_info("ignore mount hls stream for disabled"); | ||
| 968 | - return ret; | ||
| 969 | - } | ||
| 970 | - | ||
| 971 | - SrsHlsEntry* entry = shls[sid]; | ||
| 972 | - | ||
| 973 | - // TODO: FIXME: supports reload. | ||
| 974 | - std::map<std::string, ISrsHttpHandler*>::iterator it; | ||
| 975 | - for (it = entry->streams.begin(); it != entry->streams.end(); ++it) { | ||
| 976 | - ISrsHttpHandler* stream = it->second; | ||
| 977 | - stream->entry->enabled = true; | ||
| 978 | - } | ||
| 979 | - | ||
| 980 | - return ret; | ||
| 981 | -} | ||
| 982 | - | ||
| 983 | -int SrsHttpStreamServer::hls_update_m3u8(SrsRequest* r, string m3u8) | ||
| 984 | -{ | ||
| 985 | - int ret = ERROR_SUCCESS; | ||
| 986 | - | ||
| 987 | - std::string mount; | ||
| 988 | - | ||
| 989 | - std::string sid = r->get_stream_url(); | ||
| 990 | - SrsHlsEntry* entry = NULL; | ||
| 991 | - | ||
| 992 | - // create stream from template when not found. | ||
| 993 | - if (shls.find(sid) == shls.end()) { | ||
| 994 | - if (thls.find(r->vhost) == thls.end()) { | ||
| 995 | - srs_info("ignore mount hls stream for disabled"); | ||
| 996 | - return ret; | ||
| 997 | - } | ||
| 998 | - | ||
| 999 | - SrsHlsEntry* tmpl = thls[r->vhost]; | ||
| 1000 | - srs_assert(tmpl); | ||
| 1001 | - | ||
| 1002 | - entry = new SrsHlsEntry(); | ||
| 1003 | - mount = tmpl->mount; | ||
| 1004 | - | ||
| 1005 | - // replace the vhost variable | ||
| 1006 | - mount = srs_string_replace(mount, "[vhost]", r->vhost); | ||
| 1007 | - mount = srs_string_replace(mount, "[app]", r->app); | ||
| 1008 | - mount = srs_string_replace(mount, "[stream]", r->stream); | ||
| 1009 | - | ||
| 1010 | - // remove the default vhost mount | ||
| 1011 | - mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/"); | ||
| 1012 | - | ||
| 1013 | - entry->tmpl = tmpl; | ||
| 1014 | - entry->mount = mount; | ||
| 1015 | - shls[sid] = entry; | ||
| 1016 | - | ||
| 1017 | - if (entry->streams.find(mount) == entry->streams.end()) { | ||
| 1018 | - ISrsHttpHandler* he = new SrsHlsM3u8Stream(); | ||
| 1019 | - entry->streams[mount] = he; | ||
| 1020 | - | ||
| 1021 | - if ((ret = mux.handle(mount, he)) != ERROR_SUCCESS) { | ||
| 1022 | - srs_error("handle mount=%s failed. ret=%d", mount.c_str(), ret); | ||
| 1023 | - return ret; | ||
| 1024 | - } | ||
| 1025 | - } | ||
| 1026 | - } else { | ||
| 1027 | - entry = shls[sid]; | ||
| 1028 | - } | ||
| 1029 | - | ||
| 1030 | - mount = entry->mount; | ||
| 1031 | - | ||
| 1032 | - // update the m3u8 stream. | ||
| 1033 | - SrsHlsM3u8Stream* hms = dynamic_cast<SrsHlsM3u8Stream*>(entry->streams[mount]); | ||
| 1034 | - if (hms) { | ||
| 1035 | - hms->set_m3u8(m3u8); | ||
| 1036 | - } | ||
| 1037 | - srs_trace("hls update m3u8 ok, mount=%s", mount.c_str()); | ||
| 1038 | - | ||
| 1039 | - return ret; | ||
| 1040 | -} | ||
| 1041 | - | ||
| 1042 | -int SrsHttpStreamServer::hls_update_ts(SrsRequest* r, string uri, string ts) | ||
| 1043 | -{ | ||
| 1044 | - int ret = ERROR_SUCCESS; | ||
| 1045 | - | ||
| 1046 | - std::string sid = r->get_stream_url(); | ||
| 1047 | - | ||
| 1048 | - // when no hls mounted, init with empty m3u8. | ||
| 1049 | - if (shls.find(sid) == shls.end()) { | ||
| 1050 | - if ((ret = hls_update_m3u8(r, "")) != ERROR_SUCCESS) { | ||
| 1051 | - return ret; | ||
| 1052 | - } | ||
| 1053 | - } | ||
| 1054 | - | ||
| 1055 | - // find again, ignore if not exits. | ||
| 1056 | - if (shls.find(sid) == shls.end()) { | ||
| 1057 | - return ret; | ||
| 1058 | - } | ||
| 1059 | - | ||
| 1060 | - SrsHlsEntry* entry = shls[sid]; | ||
| 1061 | - srs_assert(entry); | ||
| 1062 | - srs_assert(entry->tmpl); | ||
| 1063 | - | ||
| 1064 | - std::string mount = hls_mount_generate(r, uri, entry->tmpl->mount); | ||
| 1065 | - | ||
| 1066 | - if (entry->streams.find(mount) == entry->streams.end()) { | ||
| 1067 | - ISrsHttpHandler* he = new SrsHlsTsStream(); | ||
| 1068 | - entry->streams[mount] = he; | ||
| 1069 | - | ||
| 1070 | - if ((ret = mux.handle(mount, he)) != ERROR_SUCCESS) { | ||
| 1071 | - srs_error("handle mount=%s failed. ret=%d", mount.c_str(), ret); | ||
| 1072 | - return ret; | ||
| 1073 | - } | ||
| 1074 | - } | ||
| 1075 | - | ||
| 1076 | - // update the ts stream. | ||
| 1077 | - SrsHlsTsStream* hts = dynamic_cast<SrsHlsTsStream*>(entry->streams[mount]); | ||
| 1078 | - if (hts) { | ||
| 1079 | - hts->set_ts(ts); | ||
| 1080 | - } | ||
| 1081 | - srs_trace("hls update ts ok, mount=%s", mount.c_str()); | ||
| 1082 | - | ||
| 1083 | - return ret; | ||
| 1084 | -} | ||
| 1085 | - | ||
| 1086 | -int SrsHttpStreamServer::hls_remove_ts(SrsRequest* r, string uri) | ||
| 1087 | -{ | ||
| 1088 | - int ret = ERROR_SUCCESS; | ||
| 1089 | - | ||
| 1090 | - std::string sid = r->get_stream_url(); | ||
| 1091 | - | ||
| 1092 | - // when no hls mounted, ignore. | ||
| 1093 | - if (shls.find(sid) == shls.end()) { | ||
| 1094 | - return ret; | ||
| 1095 | - } | ||
| 1096 | - | ||
| 1097 | - SrsHlsEntry* entry = shls[sid]; | ||
| 1098 | - srs_assert(entry); | ||
| 1099 | - srs_assert(entry->tmpl); | ||
| 1100 | - | ||
| 1101 | - std::string mount = hls_mount_generate(r, uri, entry->tmpl->mount); | ||
| 1102 | - | ||
| 1103 | - // ignore when no ts mounted. | ||
| 1104 | - if (entry->streams.find(mount) == entry->streams.end()) { | ||
| 1105 | - return ret; | ||
| 1106 | - } | ||
| 1107 | - | ||
| 1108 | - // update the ts stream. | ||
| 1109 | - SrsHlsTsStream* hts = dynamic_cast<SrsHlsTsStream*>(entry->streams[mount]); | ||
| 1110 | - if (hts) { | ||
| 1111 | - hts->set_ts(""); | ||
| 1112 | - // TODO: FIXME: unmount and remove the http handler. | ||
| 1113 | - } | ||
| 1114 | - srs_trace("hls remove ts ok, mount=%s", mount.c_str()); | ||
| 1115 | - | ||
| 1116 | - return ret; | ||
| 1117 | -} | ||
| 1118 | - | ||
| 1119 | -void SrsHttpStreamServer::unmount_hls(SrsRequest* r) | ||
| 1120 | -{ | ||
| 1121 | - std::string sid = r->get_stream_url(); | ||
| 1122 | - | ||
| 1123 | - if (shls.find(sid) == shls.end()) { | ||
| 1124 | - srs_info("ignore unmount hls stream for disabled"); | ||
| 1125 | - return; | ||
| 1126 | - } | ||
| 1127 | - | ||
| 1128 | - SrsHlsEntry* entry = shls[sid]; | ||
| 1129 | - | ||
| 1130 | - std::map<std::string, ISrsHttpHandler*>::iterator it; | ||
| 1131 | - for (it = entry->streams.begin(); it != entry->streams.end(); ++it) { | ||
| 1132 | - ISrsHttpHandler* stream = it->second; | ||
| 1133 | - stream->entry->enabled = false; | ||
| 1134 | - } | ||
| 1135 | -} | ||
| 1136 | - | ||
| 1137 | -int SrsHttpStreamServer::on_reload_vhost_hls(string vhost) | ||
| 1138 | -{ | ||
| 1139 | - int ret = ERROR_SUCCESS; | ||
| 1140 | - // TODO: FIXME: implements it. | ||
| 1141 | - return ret; | ||
| 1142 | -} | ||
| 1143 | - | ||
| 1144 | int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) | 939 | int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) |
| 1145 | { | 940 | { |
| 1146 | int ret = ERROR_SUCCESS; | 941 | int ret = ERROR_SUCCESS; |
| @@ -1229,7 +1024,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) | @@ -1229,7 +1024,7 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph) | ||
| 1229 | } | 1024 | } |
| 1230 | 1025 | ||
| 1231 | SrsSource* s = NULL; | 1026 | SrsSource* s = NULL; |
| 1232 | - if ((ret = SrsSource::fetch_or_create(r, server, server, &s)) != ERROR_SUCCESS) { | 1027 | + if ((ret = SrsSource::fetch_or_create(r, server, &s)) != ERROR_SUCCESS) { |
| 1233 | return ret; | 1028 | return ret; |
| 1234 | } | 1029 | } |
| 1235 | srs_assert(s != NULL); | 1030 | srs_assert(s != NULL); |
| @@ -1295,62 +1090,5 @@ int SrsHttpStreamServer::initialize_flv_entry(std::string vhost) | @@ -1295,62 +1090,5 @@ int SrsHttpStreamServer::initialize_flv_entry(std::string vhost) | ||
| 1295 | return ret; | 1090 | return ret; |
| 1296 | } | 1091 | } |
| 1297 | 1092 | ||
| 1298 | -int SrsHttpStreamServer::initialize_hls_streaming() | ||
| 1299 | -{ | ||
| 1300 | - int ret = ERROR_SUCCESS; | ||
| 1301 | - | ||
| 1302 | - // http hls live stream mount for each vhost. | ||
| 1303 | - SrsConfDirective* root = _srs_config->get_root(); | ||
| 1304 | - for (int i = 0; i < (int)root->directives.size(); i++) { | ||
| 1305 | - SrsConfDirective* conf = root->at(i); | ||
| 1306 | - | ||
| 1307 | - if (!conf->is_vhost()) { | ||
| 1308 | - continue; | ||
| 1309 | - } | ||
| 1310 | - | ||
| 1311 | - std::string vhost = conf->arg0(); | ||
| 1312 | - if (!_srs_config->get_hls_enabled(vhost)) { | ||
| 1313 | - continue; | ||
| 1314 | - } | ||
| 1315 | - | ||
| 1316 | - std::string storage = _srs_config->get_hls_storage(vhost); | ||
| 1317 | - if (storage != "ram" && storage != "both") { | ||
| 1318 | - continue; | ||
| 1319 | - } | ||
| 1320 | - | ||
| 1321 | - SrsHlsEntry* entry = new SrsHlsEntry(); | ||
| 1322 | - entry->mount = _srs_config->get_hls_mount(vhost); | ||
| 1323 | - thls[vhost] = entry; | ||
| 1324 | - srs_trace("http hls live stream, vhost=%s, mount=%s", | ||
| 1325 | - vhost.c_str(), entry->mount.c_str()); | ||
| 1326 | - } | ||
| 1327 | - | ||
| 1328 | - return ret; | ||
| 1329 | -} | ||
| 1330 | - | ||
| 1331 | -string SrsHttpStreamServer::hls_mount_generate(SrsRequest* r, string uri, string tmpl) | ||
| 1332 | -{ | ||
| 1333 | - std::string mount = tmpl; | ||
| 1334 | - | ||
| 1335 | - // the ts is relative from the m3u8, the same start dir. | ||
| 1336 | - size_t pos = string::npos; | ||
| 1337 | - if ((pos = mount.rfind("/")) != string::npos) { | ||
| 1338 | - mount = mount.substr(0, pos); | ||
| 1339 | - } | ||
| 1340 | - | ||
| 1341 | - // replace the vhost variable | ||
| 1342 | - mount = srs_string_replace(mount, "[vhost]", r->vhost); | ||
| 1343 | - mount = srs_string_replace(mount, "[app]", r->app); | ||
| 1344 | - | ||
| 1345 | - // remove the default vhost mount | ||
| 1346 | - mount = srs_string_replace(mount, SRS_CONSTS_RTMP_DEFAULT_VHOST"/", "/"); | ||
| 1347 | - | ||
| 1348 | - // mount with ts. | ||
| 1349 | - mount += "/"; | ||
| 1350 | - mount += uri; | ||
| 1351 | - | ||
| 1352 | - return mount; | ||
| 1353 | -} | ||
| 1354 | - | ||
| 1355 | #endif | 1093 | #endif |
| 1356 | 1094 |
| @@ -334,10 +334,6 @@ public: | @@ -334,10 +334,6 @@ public: | ||
| 334 | std::map<std::string, SrsLiveEntry*> tflvs; | 334 | std::map<std::string, SrsLiveEntry*> tflvs; |
| 335 | // the http live streaming streams, crote by template. | 335 | // the http live streaming streams, crote by template. |
| 336 | std::map<std::string, SrsLiveEntry*> sflvs; | 336 | std::map<std::string, SrsLiveEntry*> sflvs; |
| 337 | - // the hls live streaming template, to create streams. | ||
| 338 | - std::map<std::string, SrsHlsEntry*> thls; | ||
| 339 | - // the hls live streaming streams, crote by template. | ||
| 340 | - std::map<std::string, SrsHlsEntry*> shls; | ||
| 341 | public: | 337 | public: |
| 342 | SrsHttpStreamServer(SrsServer* svr); | 338 | SrsHttpStreamServer(SrsServer* svr); |
| 343 | virtual ~SrsHttpStreamServer(); | 339 | virtual ~SrsHttpStreamServer(); |
| @@ -347,26 +343,16 @@ public: | @@ -347,26 +343,16 @@ public: | ||
| 347 | public: | 343 | public: |
| 348 | virtual int http_mount(SrsSource* s, SrsRequest* r); | 344 | virtual int http_mount(SrsSource* s, SrsRequest* r); |
| 349 | virtual void http_unmount(SrsSource* s, SrsRequest* r); | 345 | virtual void http_unmount(SrsSource* s, SrsRequest* r); |
| 350 | -// hls stream | ||
| 351 | -public: | ||
| 352 | - virtual int mount_hls(SrsRequest* r); | ||
| 353 | - virtual int hls_update_m3u8(SrsRequest* r, std::string m3u8); | ||
| 354 | - virtual int hls_update_ts(SrsRequest* r, std::string uri, std::string ts); | ||
| 355 | - virtual int hls_remove_ts(SrsRequest* r, std::string uri); | ||
| 356 | - virtual void unmount_hls(SrsRequest* r); | ||
| 357 | // interface ISrsReloadHandler. | 346 | // interface ISrsReloadHandler. |
| 358 | public: | 347 | public: |
| 359 | virtual int on_reload_vhost_added(std::string vhost); | 348 | virtual int on_reload_vhost_added(std::string vhost); |
| 360 | virtual int on_reload_vhost_http_remux_updated(std::string vhost); | 349 | virtual int on_reload_vhost_http_remux_updated(std::string vhost); |
| 361 | - virtual int on_reload_vhost_hls(std::string vhost); | ||
| 362 | // interface ISrsHttpMatchHijacker | 350 | // interface ISrsHttpMatchHijacker |
| 363 | public: | 351 | public: |
| 364 | virtual int hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph); | 352 | virtual int hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph); |
| 365 | private: | 353 | private: |
| 366 | virtual int initialize_flv_streaming(); | 354 | virtual int initialize_flv_streaming(); |
| 367 | virtual int initialize_flv_entry(std::string vhost); | 355 | virtual int initialize_flv_entry(std::string vhost); |
| 368 | - virtual int initialize_hls_streaming(); | ||
| 369 | - virtual std::string hls_mount_generate(SrsRequest* r, std::string uri, std::string tmpl); | ||
| 370 | }; | 356 | }; |
| 371 | 357 | ||
| 372 | #endif | 358 | #endif |
| @@ -487,7 +487,7 @@ int SrsRtmpConn::stream_service_cycle() | @@ -487,7 +487,7 @@ int SrsRtmpConn::stream_service_cycle() | ||
| 487 | 487 | ||
| 488 | // find a source to serve. | 488 | // find a source to serve. |
| 489 | SrsSource* source = NULL; | 489 | SrsSource* source = NULL; |
| 490 | - if ((ret = SrsSource::fetch_or_create(req, server, server, &source)) != ERROR_SUCCESS) { | 490 | + if ((ret = SrsSource::fetch_or_create(req, server, &source)) != ERROR_SUCCESS) { |
| 491 | return ret; | 491 | return ret; |
| 492 | } | 492 | } |
| 493 | srs_assert(source != NULL); | 493 | srs_assert(source != NULL); |
| @@ -1441,67 +1441,3 @@ void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r) | @@ -1441,67 +1441,3 @@ void SrsServer::on_unpublish(SrsSource* s, SrsRequest* r) | ||
| 1441 | #endif | 1441 | #endif |
| 1442 | } | 1442 | } |
| 1443 | 1443 | ||
| 1444 | -int SrsServer::on_hls_publish(SrsRequest* r) | ||
| 1445 | -{ | ||
| 1446 | - int ret = ERROR_SUCCESS; | ||
| 1447 | - | ||
| 1448 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 1449 | - if ((ret = http_server->mount_hls(r)) != ERROR_SUCCESS) { | ||
| 1450 | - return ret; | ||
| 1451 | - } | ||
| 1452 | -#endif | ||
| 1453 | - | ||
| 1454 | - return ret; | ||
| 1455 | -} | ||
| 1456 | - | ||
| 1457 | -int SrsServer::on_update_m3u8(SrsRequest* r, string m3u8) | ||
| 1458 | -{ | ||
| 1459 | - int ret = ERROR_SUCCESS; | ||
| 1460 | - | ||
| 1461 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 1462 | - if ((ret = http_server->hls_update_m3u8(r, m3u8)) != ERROR_SUCCESS) { | ||
| 1463 | - return ret; | ||
| 1464 | - } | ||
| 1465 | -#endif | ||
| 1466 | - | ||
| 1467 | - return ret; | ||
| 1468 | -} | ||
| 1469 | - | ||
| 1470 | -int SrsServer::on_update_ts(SrsRequest* r, string uri, string ts) | ||
| 1471 | -{ | ||
| 1472 | - int ret = ERROR_SUCCESS; | ||
| 1473 | - | ||
| 1474 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 1475 | - if ((ret = http_server->hls_update_ts(r, uri, ts)) != ERROR_SUCCESS) { | ||
| 1476 | - return ret; | ||
| 1477 | - } | ||
| 1478 | -#endif | ||
| 1479 | - | ||
| 1480 | - return ret; | ||
| 1481 | -} | ||
| 1482 | - | ||
| 1483 | - | ||
| 1484 | -int SrsServer::on_remove_ts(SrsRequest* r, string uri) | ||
| 1485 | -{ | ||
| 1486 | - int ret = ERROR_SUCCESS; | ||
| 1487 | - | ||
| 1488 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 1489 | - if ((ret = http_server->hls_remove_ts(r, uri)) != ERROR_SUCCESS) { | ||
| 1490 | - return ret; | ||
| 1491 | - } | ||
| 1492 | -#endif | ||
| 1493 | - | ||
| 1494 | - return ret; | ||
| 1495 | -} | ||
| 1496 | - | ||
| 1497 | -int SrsServer::on_hls_unpublish(SrsRequest* r) | ||
| 1498 | -{ | ||
| 1499 | - int ret = ERROR_SUCCESS; | ||
| 1500 | - | ||
| 1501 | -#ifdef SRS_AUTO_HTTP_SERVER | ||
| 1502 | - http_server->unmount_hls(r); | ||
| 1503 | -#endif | ||
| 1504 | - | ||
| 1505 | - return ret; | ||
| 1506 | -} | ||
| 1507 | - |
| @@ -230,7 +230,7 @@ public: | @@ -230,7 +230,7 @@ public: | ||
| 230 | * start connection service thread, destroy client. | 230 | * start connection service thread, destroy client. |
| 231 | */ | 231 | */ |
| 232 | class SrsServer : virtual public ISrsReloadHandler | 232 | class SrsServer : virtual public ISrsReloadHandler |
| 233 | - , virtual public ISrsSourceHandler, virtual public ISrsHlsHandler | 233 | + , virtual public ISrsSourceHandler |
| 234 | , virtual public IConnectionManager | 234 | , virtual public IConnectionManager |
| 235 | { | 235 | { |
| 236 | private: | 236 | private: |
| @@ -377,13 +377,6 @@ public: | @@ -377,13 +377,6 @@ public: | ||
| 377 | public: | 377 | public: |
| 378 | virtual int on_publish(SrsSource* s, SrsRequest* r); | 378 | virtual int on_publish(SrsSource* s, SrsRequest* r); |
| 379 | virtual void on_unpublish(SrsSource* s, SrsRequest* r); | 379 | virtual void on_unpublish(SrsSource* s, SrsRequest* r); |
| 380 | -// interface ISrsHlsHandler | ||
| 381 | -public: | ||
| 382 | - virtual int on_hls_publish(SrsRequest* r); | ||
| 383 | - virtual int on_update_m3u8(SrsRequest* r, std::string m3u8); | ||
| 384 | - virtual int on_update_ts(SrsRequest* r, std::string uri, std::string ts); | ||
| 385 | - virtual int on_remove_ts(SrsRequest* r, std::string uri); | ||
| 386 | - virtual int on_hls_unpublish(SrsRequest* r); | ||
| 387 | }; | 380 | }; |
| 388 | 381 | ||
| 389 | #endif | 382 | #endif |
| @@ -731,7 +731,7 @@ ISrsSourceHandler::~ISrsSourceHandler() | @@ -731,7 +731,7 @@ ISrsSourceHandler::~ISrsSourceHandler() | ||
| 731 | 731 | ||
| 732 | std::map<std::string, SrsSource*> SrsSource::pool; | 732 | std::map<std::string, SrsSource*> SrsSource::pool; |
| 733 | 733 | ||
| 734 | -int SrsSource::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh, SrsSource** pps) | 734 | +int SrsSource::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps) |
| 735 | { | 735 | { |
| 736 | int ret = ERROR_SUCCESS; | 736 | int ret = ERROR_SUCCESS; |
| 737 | 737 | ||
| @@ -748,7 +748,7 @@ int SrsSource::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandl | @@ -748,7 +748,7 @@ int SrsSource::fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandl | ||
| 748 | srs_assert (pool.find(stream_url) == pool.end()); | 748 | srs_assert (pool.find(stream_url) == pool.end()); |
| 749 | 749 | ||
| 750 | source = new SrsSource(); | 750 | source = new SrsSource(); |
| 751 | - if ((ret = source->initialize(r, h, hh)) != ERROR_SUCCESS) { | 751 | + if ((ret = source->initialize(r, h)) != ERROR_SUCCESS) { |
| 752 | srs_freep(source); | 752 | srs_freep(source); |
| 753 | return ret; | 753 | return ret; |
| 754 | } | 754 | } |
| @@ -1053,12 +1053,11 @@ bool SrsSource::expired() | @@ -1053,12 +1053,11 @@ bool SrsSource::expired() | ||
| 1053 | return false; | 1053 | return false; |
| 1054 | } | 1054 | } |
| 1055 | 1055 | ||
| 1056 | -int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh) | 1056 | +int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h) |
| 1057 | { | 1057 | { |
| 1058 | int ret = ERROR_SUCCESS; | 1058 | int ret = ERROR_SUCCESS; |
| 1059 | 1059 | ||
| 1060 | srs_assert(h); | 1060 | srs_assert(h); |
| 1061 | - srs_assert(hh); | ||
| 1062 | srs_assert(!_req); | 1061 | srs_assert(!_req); |
| 1063 | 1062 | ||
| 1064 | handler = h; | 1063 | handler = h; |
| @@ -1066,7 +1065,7 @@ int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* h | @@ -1066,7 +1065,7 @@ int SrsSource::initialize(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* h | ||
| 1066 | atc = _srs_config->get_atc(_req->vhost); | 1065 | atc = _srs_config->get_atc(_req->vhost); |
| 1067 | 1066 | ||
| 1068 | #ifdef SRS_AUTO_HLS | 1067 | #ifdef SRS_AUTO_HLS |
| 1069 | - if ((ret = hls->initialize(this, hh)) != ERROR_SUCCESS) { | 1068 | + if ((ret = hls->initialize(this)) != ERROR_SUCCESS) { |
| 1070 | return ret; | 1069 | return ret; |
| 1071 | } | 1070 | } |
| 1072 | #endif | 1071 | #endif |
| @@ -62,7 +62,6 @@ class SrsDvr; | @@ -62,7 +62,6 @@ class SrsDvr; | ||
| 62 | class SrsEncoder; | 62 | class SrsEncoder; |
| 63 | #endif | 63 | #endif |
| 64 | class SrsStream; | 64 | class SrsStream; |
| 65 | -class ISrsHlsHandler; | ||
| 66 | #ifdef SRS_AUTO_HDS | 65 | #ifdef SRS_AUTO_HDS |
| 67 | class SrsHds; | 66 | class SrsHds; |
| 68 | #endif | 67 | #endif |
| @@ -421,10 +420,9 @@ public: | @@ -421,10 +420,9 @@ public: | ||
| 421 | * create source when fetch from cache failed. | 420 | * create source when fetch from cache failed. |
| 422 | * @param r the client request. | 421 | * @param r the client request. |
| 423 | * @param h the event handler for source. | 422 | * @param h the event handler for source. |
| 424 | - * @param hh the event handler for hls. | ||
| 425 | * @param pps the matched source, if success never be NULL. | 423 | * @param pps the matched source, if success never be NULL. |
| 426 | */ | 424 | */ |
| 427 | - static int fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh, SrsSource** pps); | 425 | + static int fetch_or_create(SrsRequest* r, ISrsSourceHandler* h, SrsSource** pps); |
| 428 | private: | 426 | private: |
| 429 | /** | 427 | /** |
| 430 | * get the exists source, NULL when not exists. | 428 | * get the exists source, NULL when not exists. |
| @@ -526,7 +524,7 @@ public: | @@ -526,7 +524,7 @@ public: | ||
| 526 | /** | 524 | /** |
| 527 | * initialize the hls with handlers. | 525 | * initialize the hls with handlers. |
| 528 | */ | 526 | */ |
| 529 | - virtual int initialize(SrsRequest* r, ISrsSourceHandler* h, ISrsHlsHandler* hh); | 527 | + virtual int initialize(SrsRequest* r, ISrsSourceHandler* h); |
| 530 | // interface ISrsReloadHandler | 528 | // interface ISrsReloadHandler |
| 531 | public: | 529 | public: |
| 532 | virtual int on_reload_vhost_atc(std::string vhost); | 530 | virtual int on_reload_vhost_atc(std::string vhost); |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR 2 | 32 | #define VERSION_MAJOR 2 |
| 33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
| 34 | -#define VERSION_REVISION 223 | 34 | +#define VERSION_REVISION 224 |
| 35 | 35 | ||
| 36 | // generated by configure, only macros. | 36 | // generated by configure, only macros. |
| 37 | #include <srs_auto_headers.hpp> | 37 | #include <srs_auto_headers.hpp> |
-
请 注册 或 登录 后发表评论