mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
Update MP4Recorder.cpp
fix #1679 _muxer->openMP4 创建非法的文件夹会失败抛出异常 所以_full_path_tmp等都是空字符串 delete_file的时候 就会从此盘符的""(full_path_tmp)目录挨个删除了。 复现建议新建个盘符...
This commit is contained in:
parent
ca66858da2
commit
1c5380eead
@ -73,6 +73,8 @@ void MP4Recorder::asyncClose() {
|
|||||||
info.time_len = (float) (::time(NULL) - info.start_time);
|
info.time_len = (float) (::time(NULL) - info.start_time);
|
||||||
//关闭mp4非常耗时,所以要放在后台线程执行
|
//关闭mp4非常耗时,所以要放在后台线程执行
|
||||||
muxer->closeMP4();
|
muxer->closeMP4();
|
||||||
|
|
||||||
|
if(!full_path_tmp.empty()) {
|
||||||
//获取文件大小
|
//获取文件大小
|
||||||
info.file_size = File::fileSize(full_path_tmp.data());
|
info.file_size = File::fileSize(full_path_tmp.data());
|
||||||
if (info.file_size < 1024) {
|
if (info.file_size < 1024) {
|
||||||
@ -82,6 +84,7 @@ void MP4Recorder::asyncClose() {
|
|||||||
}
|
}
|
||||||
//临时文件名改成正式文件名,防止mp4未完成时被访问
|
//临时文件名改成正式文件名,防止mp4未完成时被访问
|
||||||
rename(full_path_tmp.data(), full_path.data());
|
rename(full_path_tmp.data(), full_path.data());
|
||||||
|
}
|
||||||
|
|
||||||
/////record 业务逻辑//////
|
/////record 业务逻辑//////
|
||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info);
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info);
|
||||||
|
Loading…
Reference in New Issue
Block a user