解决获取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();
//获取文件大小
struct stat fileData;
stat(full_path_tmp.data(), &fileData);
info.file_size = fileData.st_size;
if (fileData.st_size < 1024) {
auto fp = fopen(full_path_tmp.data(), "rb");
assert(fp);
info.file_size = File::fileSize(fp);
fclose(fp);
if (info.file_size < 1024) {
//录像文件太小,删除之
File::delete_file(full_path_tmp.data());
return;