完善判定ffmpeg截图是否为空逻辑

This commit is contained in:
ziyue 2022-02-23 17:06:09 +08:00
parent b2bb37dc5c
commit a3d696d805

View File

@ -1253,9 +1253,8 @@ void installWebApi() {
const HttpSession::KeyValue &headerIn,
const HttpSession::HttpResponseInvoker &invoker) {
StrCaseMap headerOut;
struct stat statbuf = {0};
GET_CONFIG(string, defaultSnap, API::kDefaultSnap);
if (!(stat(snap_path.data(), &statbuf) == 0 && statbuf.st_size != 0) && !defaultSnap.empty()) {
if (!File::fileSize(snap_path.data()) && !defaultSnap.empty()) {
//空文件且设置了预设图,则返回预设图片(也就是FFmpeg生成截图中空档期的默认图片)
const_cast<string&>(snap_path) = File::absolutePath(defaultSnap, "");
headerOut["Content-Type"] = HttpFileManager::getContentType(snap_path.data());