Compare commits

...

2 Commits

Author SHA1 Message Date
ibranch7
56fe66da7c
修复http文件下载指定目录时mmap导致崩溃的bug (#4213)
Some checks are pending
Android / build (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Docker / build (push) Waiting to run
Linux / build (push) Waiting to run
macOS / build (push) Waiting to run
Windows / build (push) Waiting to run
在`HttpBody.cpp`中,`getSharedMmap`函数直接尝试对所有路径进行mmap操作,没有进行文件类型检查
2025-04-09 21:35:28 +08:00
xiongguangjie
026e74d624
修复addFFmpegSource接口线程检测失败相关bug (#4225 #4233) 2025-04-09 21:33:12 +08:00
2 changed files with 13 additions and 2 deletions

View File

@ -341,10 +341,14 @@ void FFmpegSource::onGetMediaSource(const MediaSource::Ptr &src) {
setDelegate(listener);
muxer->setDelegate(shared_from_this());
if (_enable_hls) {
src->setupRecord(Recorder::type_hls, true, "", 0);
src->getOwnerPoller()->async([=]() mutable {
src->setupRecord(Recorder::type_hls, true, "", 0);
});
}
if (_enable_mp4) {
src->setupRecord(Recorder::type_mp4, true, "", 0);
src->getOwnerPoller()->async([=]() mutable {
src->setupRecord(Recorder::type_mp4, true, "", 0);
});
}
}
}

View File

@ -194,6 +194,13 @@ static std::shared_ptr<char> getSharedMmap(const string &file_path, int64_t &fil
}
HttpFileBody::HttpFileBody(const string &file_path, bool use_mmap) {
// 判断是否为目录避免对目录进行mmap操作导致程序崩溃。
if (File::is_dir(file_path)) {
_read_to = -1;
return;
}
if (use_mmap ) {
_map_addr = getSharedMmap(file_path, _read_to);
}