From cd27e5a9f9677570c1a0580a0aaa081f2e43be8c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 1 Oct 2020 14:55:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E6=84=8F=EF=BC=81hls=20mp4=E5=BD=95?= =?UTF-8?q?=E5=88=B6=E7=9A=84customized=20path=E5=AD=97=E6=AE=B5=E6=94=B9?= =?UTF-8?q?=E6=88=90=E5=BD=95=E5=88=B6=E6=A0=B9=E7=9B=AE=E5=BD=95=20?= =?UTF-8?q?=E7=9B=B8=E5=BD=93=E4=BA=8E=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=ADhls=20mp4=E5=BD=95=E5=88=B6=E6=A0=B9=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Record/Recorder.cpp | 11 ++--------- src/Record/Recorder.h | 6 +++--- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Record/Recorder.cpp b/src/Record/Recorder.cpp index 9f6300f6..b7ccd05f 100644 --- a/src/Record/Recorder.cpp +++ b/src/Record/Recorder.cpp @@ -31,7 +31,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); } @@ -46,15 +46,8 @@ 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 customized_path + "/"+mp4FilePath; - /*开始添加*/ + return File::absolutePath(mp4FilePath, customized_path); } - return File::absolutePath(mp4FilePath, recordPath); } default: diff --git a/src/Record/Recorder.h b/src/Record/Recorder.h index fa6e2ac7..d7ec133f 100644 --- a/src/Record/Recorder.h +++ b/src/Record/Recorder.h @@ -45,7 +45,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 = ""); @@ -56,7 +56,7 @@ public: * @param vhost 虚拟主机 * @param app 应用名 * @param stream_id 流id - * @param customized_path 录像文件保存自定义目录,默认为空则自动生成 + * @param customized_path 录像文件保存自定义根目录,为空则采用配置文件设置 * @return 对象指针,可能为nullptr */ static std::shared_ptr createRecorder(type type, const string &vhost, const string &app, const string &stream_id, const string &customized_path = ""); @@ -77,7 +77,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);