diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 3e08b9e94..8ad0d826a 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -6882,9 +6882,9 @@ bool SrsConfig::get_vhost_http_remux_enabled(string vhost) return SRS_CONF_PERFER_FALSE(conf->arg0()); } -double SrsConfig::get_vhost_http_remux_fast_cache(string vhost) +srs_utime_t SrsConfig::get_vhost_http_remux_fast_cache(string vhost) { - static double DEFAULT = 0; + static srs_utime_t DEFAULT = 0; SrsConfDirective* conf = get_vhost(vhost); if (!conf) { @@ -6901,7 +6901,7 @@ double SrsConfig::get_vhost_http_remux_fast_cache(string vhost) return DEFAULT; } - return ::atof(conf->arg0().c_str()); + return srs_utime_t(::atof(conf->arg0().c_str()) * SRS_UTIME_SECONDS); } string SrsConfig::get_vhost_http_remux_mount(string vhost) diff --git a/trunk/src/app/srs_app_config.hpp b/trunk/src/app/srs_app_config.hpp index d45a1b4c6..be985a00a 100644 --- a/trunk/src/app/srs_app_config.hpp +++ b/trunk/src/app/srs_app_config.hpp @@ -1404,7 +1404,7 @@ public: /** * get the fast cache duration for http audio live stream. */ - virtual double get_vhost_http_remux_fast_cache(std::string vhost); + virtual srs_utime_t get_vhost_http_remux_fast_cache(std::string vhost); /** * get the http flv live stream mount point for vhost. * used to generate the flv stream mount path. diff --git a/trunk/src/app/srs_app_http_stream.cpp b/trunk/src/app/srs_app_http_stream.cpp index af8fb1153..3e5551131 100755 --- a/trunk/src/app/srs_app_http_stream.cpp +++ b/trunk/src/app/srs_app_http_stream.cpp @@ -64,7 +64,7 @@ SrsBufferCache::SrsBufferCache(SrsSource* s, SrsRequest* r) trd = new SrsSTCoroutine("http-stream", this); // TODO: FIXME: support reload. - fast_cache = srs_utime_t(_srs_config->get_vhost_http_remux_fast_cache(req->vhost) * SRS_UTIME_SECONDS); + fast_cache = _srs_config->get_vhost_http_remux_fast_cache(req->vhost); } SrsBufferCache::~SrsBufferCache() diff --git a/trunk/src/utest/srs_utest_config.cpp b/trunk/src/utest/srs_utest_config.cpp index 8dc37b3d2..4f40459fe 100644 --- a/trunk/src/utest/srs_utest_config.cpp +++ b/trunk/src/utest/srs_utest_config.cpp @@ -1898,6 +1898,14 @@ VOID TEST(ConfigUnitTest, CheckDefaultValuesVhost) EXPECT_EQ(100 * SRS_UTIME_SECONDS, conf.get_queue_length("v")); EXPECT_EQ(10 * SRS_UTIME_MILLISECONDS, conf.get_send_min_interval("v")); } + + if (true) { + EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF)); + EXPECT_EQ(0, conf.get_vhost_http_remux_fast_cache("")); + + EXPECT_TRUE(ERROR_SUCCESS == conf.parse(_MIN_OK_CONF"vhost v{http_remux{fast_cache 10;}}")); + EXPECT_EQ(10 * SRS_UTIME_SECONDS, conf.get_vhost_http_remux_fast_cache("v")); + } } VOID TEST(ConfigUnitTest, CheckDefaultValuesGlobal)