mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
commit
9fd0db55c4
@ -73,15 +73,18 @@ 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();
|
||||||
//获取文件大小
|
|
||||||
info.file_size = File::fileSize(full_path_tmp.data());
|
if(!full_path_tmp.empty()) {
|
||||||
if (info.file_size < 1024) {
|
//获取文件大小
|
||||||
//录像文件太小,删除之
|
info.file_size = File::fileSize(full_path_tmp.data());
|
||||||
File::delete_file(full_path_tmp.data());
|
if (info.file_size < 1024) {
|
||||||
return;
|
//录像文件太小,删除之
|
||||||
|
File::delete_file(full_path_tmp.data());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//临时文件名改成正式文件名,防止mp4未完成时被访问
|
||||||
|
rename(full_path_tmp.data(), full_path.data());
|
||||||
}
|
}
|
||||||
//临时文件名改成正式文件名,防止mp4未完成时被访问
|
|
||||||
rename(full_path_tmp.data(), full_path.data());
|
|
||||||
|
|
||||||
/////record 业务逻辑//////
|
/////record 业务逻辑//////
|
||||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info);
|
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info);
|
||||||
@ -138,4 +141,4 @@ void MP4Recorder::resetTracks() {
|
|||||||
|
|
||||||
} /* namespace mediakit */
|
} /* namespace mediakit */
|
||||||
|
|
||||||
#endif //ENABLE_MP4
|
#endif //ENABLE_MP4
|
||||||
|
Loading…
Reference in New Issue
Block a user