From a25e1d6021c48c783038dcd92b29d260a12cd47f Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Wed, 20 Oct 2021 18:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=8E=B7=E5=8F=96mp4?= =?UTF-8?q?=E5=BD=95=E5=83=8F=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E4=B8=8D?= =?UTF-8?q?=E5=87=86=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9A#1173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Record/MP4Recorder.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 10d76130..8838abc6 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -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;