mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
mp4录制新增追踪日志
This commit is contained in:
parent
aac8905619
commit
08299b6652
@ -54,6 +54,7 @@ void MP4Recorder::createFile() {
|
||||
|
||||
try {
|
||||
_muxer = std::make_shared<MP4Muxer>();
|
||||
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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user