From 08299b66521fc25b8461a85e6c1d677913c9ee32 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Tue, 8 Aug 2023 14:24:45 +0800 Subject: [PATCH] =?UTF-8?q?mp4=E5=BD=95=E5=88=B6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Record/MP4Recorder.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 4784fcda..ade1d519 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -54,6 +54,7 @@ void MP4Recorder::createFile() { try { _muxer = std::make_shared(); + TraceL << "Open tmp mp4 file: " << full_path_tmp; _muxer->openMP4(full_path_tmp); for (auto &track :_tracks) { //添加track @@ -71,10 +72,13 @@ void MP4Recorder::asyncClose() { auto full_path_tmp = _full_path_tmp; auto full_path = _full_path; auto info = _info; + TraceL << "Start close tmp mp4 file: " << full_path_tmp; WorkThreadPool::Instance().getExecutor()->async([muxer, full_path_tmp, full_path, info]() mutable { info.time_len = muxer->getDuration() / 1000.0f; // 关闭mp4可能非常耗时,所以要放在后台线程执行 + TraceL << "Closing tmp mp4 file: " << full_path_tmp; muxer->closeMP4(); + TraceL << "Closed tmp mp4 file: " << full_path_tmp; if (!full_path_tmp.empty()) { // 获取文件大小 info.file_size = File::fileSize(full_path_tmp.data()); @@ -86,6 +90,7 @@ void MP4Recorder::asyncClose() { // 临时文件名改成正式文件名,防止mp4未完成时被访问 rename(full_path_tmp.data(), full_path.data()); } + TraceL << "Emit mp4 record event: " << full_path; //触发mp4录制切片生成事件 NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info); });