mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine on_hls duration in time unit
This commit is contained in:
parent
5f3d09c8a0
commit
980c32aee6
4 changed files with 8 additions and 8 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue