diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index da06432d7..45b075238 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -82,7 +82,7 @@ void SrsHlsSegment::config_cipher(unsigned char* key,unsigned char* iv) fw->config_cipher(key, iv); } -SrsDvrAsyncCallOnHls::SrsDvrAsyncCallOnHls(int c, SrsRequest* r, string p, string t, string m, string mu, int s, double d) +SrsDvrAsyncCallOnHls::SrsDvrAsyncCallOnHls(int c, SrsRequest* r, string p, string t, string m, string mu, int s, srs_utime_t d) { req = r->copy(); cid = c; @@ -595,7 +595,7 @@ srs_error_t SrsHlsMuxer::segment_close() if (srsu2msi(current->duration()) >= SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS && (int)srsu2msi(current->duration()) <= max_td * 2 * 1000) { // use async to call the http hooks, for it will cause thread switch. if ((err = async->execute(new SrsDvrAsyncCallOnHls(_srs_context->get_id(), req, current->fullpath(), - current->uri, m3u8, m3u8_url, current->sequence_no, srsu2msi(current->duration()) / 1000.0))) != srs_success) { + current->uri, m3u8, m3u8_url, current->sequence_no, current->duration()))) != srs_success) { return srs_error_wrap(err, "segment close"); } diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index f6529b0b7..2f4cb546c 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -91,10 +91,10 @@ private: std::string m3u8_url; int seq_no; SrsRequest* req; - double duration; + srs_utime_t duration; public: // TODO: FIXME: Use TBN 1000. - SrsDvrAsyncCallOnHls(int c, SrsRequest* r, std::string p, std::string t, std::string m, std::string mu, int s, double d); + SrsDvrAsyncCallOnHls(int c, SrsRequest* r, std::string p, std::string t, std::string m, std::string mu, int s, srs_utime_t d); virtual ~SrsDvrAsyncCallOnHls(); public: virtual srs_error_t call(); diff --git a/trunk/src/app/srs_app_http_hooks.cpp b/trunk/src/app/srs_app_http_hooks.cpp index d58be2829..f78400403 100644 --- a/trunk/src/app/srs_app_http_hooks.cpp +++ b/trunk/src/app/srs_app_http_hooks.cpp @@ -301,7 +301,7 @@ srs_error_t SrsHttpHooks::on_dvr(int cid, string url, SrsRequest* req, string fi return err; } -srs_error_t SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string file, string ts_url, string m3u8, string m3u8_url, int sn, double duration) +srs_error_t SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string file, string ts_url, string m3u8, string m3u8_url, int sn, srs_utime_t duration) { srs_error_t err = srs_success; @@ -324,7 +324,7 @@ srs_error_t SrsHttpHooks::on_hls(int cid, string url, SrsRequest* req, string fi obj->set("app", SrsJsonAny::str(req->app.c_str())); obj->set("stream", SrsJsonAny::str(req->stream.c_str())); obj->set("param", SrsJsonAny::str(req->param.c_str())); - obj->set("duration", SrsJsonAny::number(duration)); + obj->set("duration", SrsJsonAny::number(srsu2ms(duration)/1000.0)); obj->set("cwd", SrsJsonAny::str(cwd.c_str())); obj->set("file", SrsJsonAny::str(file.c_str())); obj->set("url", SrsJsonAny::str(ts_url.c_str())); diff --git a/trunk/src/app/srs_app_http_hooks.hpp b/trunk/src/app/srs_app_http_hooks.hpp index 08dee7e3e..0dfb0f3c9 100644 --- a/trunk/src/app/srs_app_http_hooks.hpp +++ b/trunk/src/app/srs_app_http_hooks.hpp @@ -99,11 +99,11 @@ public: * @param m3u8 the m3u8 file path, can be relative or absolute path. * @param m3u8_url the m3u8 url, which is used for the http mount path. * @param sn the seq_no, the sequence number of ts in hls/m3u8. - * @param duration the segment duration in seconds. + * @param duration the segment duration in srs_utime_t. * @param cid the source connection cid, for the on_dvr is async call. */ static srs_error_t on_hls(int cid, std::string url, SrsRequest* req, std::string file, std::string ts_url, - std::string m3u8, std::string m3u8_url, int sn, double duration); + std::string m3u8, std::string m3u8_url, int sn, srs_utime_t duration); /** * when hls reap segment, callback. * @param url the api server url, to process the event.