解决获取mp4录像文件大小不准的问题:#1173

This commit is contained in:
ziyue 2021-10-20 18:14:20 +08:00
parent b4327b9b18
commit a25e1d6021

View File

@ -74,10 +74,12 @@ void MP4Recorder::asyncClose() {
muxer->closeMP4(); muxer->closeMP4();
//获取文件大小 //获取文件大小
struct stat fileData; auto fp = fopen(full_path_tmp.data(), "rb");
stat(full_path_tmp.data(), &fileData); assert(fp);
info.file_size = fileData.st_size; info.file_size = File::fileSize(fp);
if (fileData.st_size < 1024) { fclose(fp);
if (info.file_size < 1024) {
//录像文件太小,删除之 //录像文件太小,删除之
File::delete_file(full_path_tmp.data()); File::delete_file(full_path_tmp.data());
return; return;