Merge remote-tracking branch 'upstream/master' into master

This commit is contained in:
monktan
2020-10-09 09:41:43 +08:00
22 changed files with 307 additions and 113 deletions

View File

@@ -105,6 +105,9 @@ void HlsMakerImp::onWriteSegment(const char *data, int len) {
if (_file) {
fwrite(data, len, 1, _file.get());
}
if (_media_src) {
_media_src->onSegmentSize(len);
}
}
void HlsMakerImp::onWriteHls(const char *data, int len) {

View File

@@ -79,6 +79,10 @@ public:
_list_cb.emplace_back(std::move(cb));
}
void onSegmentSize(uint64_t bytes) {
_speed += bytes;
}
private:
bool _is_regist = false;
RingType::Ptr _ring;

View File

@@ -32,7 +32,7 @@ string Recorder::getRecordPath(Recorder::type type, const string &vhost, const s
}
//Here we use the customized file path.
if (!customized_path.empty()) {
m3u8FilePath = customized_path + "/hls.m3u8";
return File::absolutePath(m3u8FilePath, customized_path);
}
return File::absolutePath(m3u8FilePath, hlsPath);
}
@@ -47,7 +47,7 @@ string Recorder::getRecordPath(Recorder::type type, const string &vhost, const s
}
//Here we use the customized file path.
if (!customized_path.empty()) {
mp4FilePath = customized_path + "/";
return File::absolutePath(mp4FilePath, customized_path);
}
return File::absolutePath(mp4FilePath, recordPath);
}

View File

@@ -47,7 +47,7 @@ public:
* @param vhost 虚拟主机
* @param app 应用名
* @param stream_id 流id
* @param customized_path 录像文件保存自定义目录,默认为空则自动生成
* @param customized_path 录像文件保存自定义目录,为空则采用配置文件设置
* @return 录制文件绝对路径
*/
static string getRecordPath(type type, const string &vhost, const string &app, const string &stream_id,const string &customized_path = "");
@@ -58,7 +58,7 @@ public:
* @param vhost 虚拟主机
* @param app 应用名
* @param stream_id 流id
* @param customized_path 录像文件保存自定义目录,默认为空则自动生成
* @param customized_path 录像文件保存自定义目录,为空则采用配置文件设置
* @return 对象指针可能为nullptr
*/
static std::shared_ptr<MediaSinkInterface> createRecorder(type type, const string &vhost, const string &app, const string &stream_id, const string &customized_path = "");
@@ -79,7 +79,7 @@ public:
* @param vhost 虚拟主机
* @param app 应用名
* @param stream_id 流id
* @param customized_path 录像文件保存自定义目录,默认为空则自动生成
* @param customized_path 录像文件保存自定义目录,为空则采用配置文件设置
* @return 成功与否
*/
static bool startRecord(type type, const string &vhost, const string &app, const string &stream_id,const string &customized_path);