Fixed:app get thumbnail file bug.
This commit is contained in:
parent
0e6ab49076
commit
d556078a7e
|
@ -174,7 +174,7 @@ StatusCode AppMonitor::GetThumbnail(AppGetThumbnail ¶m)
|
|||
// param.mThumbnail = "./34a396526922a33e97906920dbfef2a5.jpg";
|
||||
const std::string webServerDocumentRoot = IAppManager::GetInstance()->GetFilesSavingRootPath();
|
||||
const std::string thumbnailFile = MediaTask::GetThumbnailNameByTargetName(param.mFile);
|
||||
param.mThumbnail = RemovePrefix(thumbnailFile, webServerDocumentRoot);
|
||||
param.mThumbnail = thumbnailFile;
|
||||
return CreateStatusCode(STATUS_CODE_OK);
|
||||
}
|
||||
SdCardStatus AppMonitor::SdCardStatusConvert(const StorageEvent &event)
|
||||
|
|
|
@ -99,12 +99,19 @@ bool SdCardHandleState::SdCardEventHandle(VStateMachineData *msg)
|
|||
mFileNeedToSave.reset();
|
||||
}
|
||||
mSdCardStatus = data->mData;
|
||||
/**
|
||||
* @brief The file management uses a database. When the SD card is inserted or removed, the card's file data needs
|
||||
* to be reinitialized.
|
||||
*/
|
||||
if (StorageEvent::SD_CARD_INSERT == mSdCardStatus) {
|
||||
IFilesManager::GetInstance()->Init();
|
||||
std::shared_ptr<VMissionData> message =
|
||||
std::make_shared<VMissionData>(static_cast<MissionEvent>(InternalStateEvent::CHECK_UPGRADE_FILE));
|
||||
MissionStateMachine::GetInstance()->SendStateMessage(message);
|
||||
}
|
||||
else {
|
||||
IFilesManager::GetInstance()->UnInit();
|
||||
}
|
||||
SetSdCardLedsStatus(mSdCardStatus);
|
||||
return EXECUTED;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,10 @@ void FfmpegThumbnail::GetDecodeDataCallback(AVFrame *frame)
|
|||
goto END;
|
||||
}
|
||||
system("echo 1 > /proc/sys/vm/drop_caches");
|
||||
// Perform pixel format conversion.
|
||||
/**
|
||||
* @brief Perform pixel format conversion.
|
||||
* NOTE: This function will crash when the chip does not have enough memory.
|
||||
*/
|
||||
sws_scale(mSwsCtx, frame->data, frame->linesize, 0, frame->height, thumbnailFrame->data, thumbnailFrame->linesize);
|
||||
|
||||
if (mEncoder) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
// #include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -103,9 +104,14 @@ static void get_thumbnail_handle(const char *thumbnailUrl, void *context)
|
|||
unsigned char *buffer = nullptr;
|
||||
size_t bytesRead = 0;
|
||||
long int fsize = 0;
|
||||
file = fopen(thumbnailUrl, "rb");
|
||||
constexpr int BUFFER_SIZE = 256;
|
||||
char filePath[BUFFER_SIZE] = {0};
|
||||
// const std::string url = thumbnailUrl;
|
||||
// const std::string thumbnailFile = GOAHEAD_DOCUMENTS_PATH + url;
|
||||
snprintf(filePath, BUFFER_SIZE - 1, GOAHEAD_DOCUMENTS_PATH "%s", thumbnailUrl);
|
||||
file = fopen(filePath, "rb");
|
||||
if (file == nullptr) {
|
||||
LogError("Open picture failed[%s].\n", thumbnailUrl);
|
||||
LogError("Open picture failed[%s].\n", filePath);
|
||||
goto END;
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
|
|
Loading…
Reference in New Issue
Block a user