mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge branch 'develop' into 3.0release
This commit is contained in:
commit
dba44c7c3f
4 changed files with 18 additions and 4 deletions
|
@ -1046,6 +1046,7 @@ vhost hls.srs.com {
|
||||||
# [999], replace this const to current millisecond.
|
# [999], replace this const to current millisecond.
|
||||||
# [timestamp],replace this const to current UNIX timestamp in ms.
|
# [timestamp],replace this const to current UNIX timestamp in ms.
|
||||||
# [seq], the sequence number of ts.
|
# [seq], the sequence number of ts.
|
||||||
|
# [duration], replace this const to current ts duration.
|
||||||
# @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path
|
# @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path
|
||||||
# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#hls-config
|
# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#hls-config
|
||||||
# default: [app]/[stream]-[seq].ts
|
# default: [app]/[stream]-[seq].ts
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sstream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SrsFragment::SrsFragment()
|
SrsFragment::SrsFragment()
|
||||||
|
@ -126,11 +127,16 @@ srs_error_t SrsFragment::rename()
|
||||||
|
|
||||||
string full_path = fullpath();
|
string full_path = fullpath();
|
||||||
string tmp_file = tmppath();
|
string tmp_file = tmppath();
|
||||||
|
int tempdur = (int)duration();
|
||||||
|
if (true) {
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << tempdur;
|
||||||
|
full_path = srs_string_replace(full_path, "[duration]", ss.str());
|
||||||
|
}
|
||||||
if (::rename(tmp_file.c_str(), full_path.c_str()) < 0) {
|
if (::rename(tmp_file.c_str(), full_path.c_str()) < 0) {
|
||||||
return srs_error_new(ERROR_SYSTEM_FRAGMENT_RENAME, "rename %s to %s", tmp_file.c_str(), full_path.c_str());
|
return srs_error_new(ERROR_SYSTEM_FRAGMENT_RENAME, "rename %s to %s", tmp_file.c_str(), full_path.c_str());
|
||||||
}
|
}
|
||||||
|
filepath = full_path;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -688,7 +688,14 @@ srs_error_t SrsHlsMuxer::_refresh_m3u8(string m3u8_file)
|
||||||
ss << "#EXTINF:" << segment->duration() / 1000.0 << ", no desc" << SRS_CONSTS_LF;
|
ss << "#EXTINF:" << segment->duration() / 1000.0 << ", no desc" << SRS_CONSTS_LF;
|
||||||
|
|
||||||
// {file name}\n
|
// {file name}\n
|
||||||
ss << segment->uri << SRS_CONSTS_LF;
|
std::string seg_uri = segment->uri;
|
||||||
|
if (true) {
|
||||||
|
std::stringstream stemp;
|
||||||
|
stemp << (int)(segment->duration());
|
||||||
|
seg_uri = srs_string_replace(seg_uri, "[duration]", stemp.str());
|
||||||
|
}
|
||||||
|
//ss << segment->uri << SRS_CONSTS_LF;
|
||||||
|
ss << seg_uri << SRS_CONSTS_LF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write m3u8 to writer.
|
// write m3u8 to writer.
|
||||||
|
|
|
@ -546,7 +546,7 @@ int srs_do_create_dir_recursively(string dir)
|
||||||
{
|
{
|
||||||
int ret = srs_do_create_dir_recursively(dir);
|
int ret = srs_do_create_dir_recursively(dir);
|
||||||
|
|
||||||
if (ret == ERROR_SYSTEM_DIR_EXISTS) {
|
if (ret == ERROR_SYSTEM_DIR_EXISTS || ret == ERROR_SUCCESS) {
|
||||||
return srs_success;
|
return srs_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue