This commit is contained in:
2025-08-28 15:13:40 +09:00
parent 6e64d739ac
commit 6404f4176e
3149 changed files with 738551 additions and 335 deletions
+10 -9
View File
@@ -20,9 +20,10 @@ void Preloader::releasePreloadedData() {
preloadFailed_ = false;
}
// 수정됨: std::string path 대신 int fd를 인자로 받음
// [수정] std::string path 대신 int fd를 인자로 받음
void Preloader::startNextPreload(int fd) {
if (dataReady_ || preloadFailed_) {
if (dataReady_) {
LOGI("Preloader is busy with ready data. Ignoring new preload request.");
return;
}
@@ -31,22 +32,22 @@ void Preloader::startNextPreload(int fd) {
return;
}
// 이전에 실패했더라도 새로운 요청이 오면 다시 시도하도록 초기화
preloadFailed_ = false;
// 백그라운드 스레드에서 로딩 작업 수행
std::thread([this, fd]() {
LOGI("Starting preload thread for media with fd: %d", fd);
std::lock_guard<std::mutex> lock(preloadMutex_);
// MediaAsset의 load(fd) 함수 호출
if (nextMedia_.load(fd)) {
MediaAsset tempMedia;
if (tempMedia.load(fd)) {
std::lock_guard<std::mutex> lock(preloadMutex_);
nextMedia_ = std::move(tempMedia);
dataReady_ = true;
LOGI("Preloading finished successfully.");
} else {
LOGE("Preloading failed.");
// --- ⬇️ 실패 로그 추가 ⬇️ ---
LOGE("!!! Preloading FAILED for fd: %d. !!!", fd);
preloadFailed_ = true;
nextMedia_.release();
// 로딩 실패 시 다음 미디어를 요청하여 멈추지 않도록 함
callNextMediaCallback();
}
}).detach();