Fixed:record file name bug.
This commit is contained in:
parent
c88dbe1ecf
commit
8a34d9e8be
|
@ -32,6 +32,7 @@ MediaTask::MediaTask(const MediaTaskType &type, const InternalStateEvent &bindEv
|
||||||
: mType(type), mBindEvent(bindEvent), mIniator(iniator), mSerialNumber(serialNumber), mSavePath(savePath)
|
: mType(type), mBindEvent(bindEvent), mIniator(iniator), mSerialNumber(serialNumber), mSavePath(savePath)
|
||||||
{
|
{
|
||||||
mResponseData.reset();
|
mResponseData.reset();
|
||||||
|
mTargetName.clear();
|
||||||
}
|
}
|
||||||
unsigned int MediaTask::GetTaskTimeOutMs(void)
|
unsigned int MediaTask::GetTaskTimeOutMs(void)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +40,9 @@ unsigned int MediaTask::GetTaskTimeOutMs(void)
|
||||||
}
|
}
|
||||||
std::string MediaTask::GetTargetNameForSaving(void)
|
std::string MediaTask::GetTargetNameForSaving(void)
|
||||||
{
|
{
|
||||||
|
if (!mTargetName.empty()) {
|
||||||
|
return mTargetName;
|
||||||
|
}
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
time_t t_now = std::chrono::system_clock::to_time_t(now);
|
time_t t_now = std::chrono::system_clock::to_time_t(now);
|
||||||
struct tm tm_now = *std::localtime(&t_now);
|
struct tm tm_now = *std::localtime(&t_now);
|
||||||
|
@ -50,6 +54,8 @@ std::string MediaTask::GetTargetNameForSaving(void)
|
||||||
std::ostringstream pathStream;
|
std::ostringstream pathStream;
|
||||||
pathStream << mSavePath << std::setw(2) << std::setfill('0') << hour << std::setw(2) << std::setfill('0') << minute
|
pathStream << mSavePath << std::setw(2) << std::setfill('0') << hour << std::setw(2) << std::setfill('0') << minute
|
||||||
<< std::setw(2) << std::setfill('0') << second << ".mp4";
|
<< std::setw(2) << std::setfill('0') << second << ".mp4";
|
||||||
|
mTargetName = pathStream.str();
|
||||||
|
LogInfo("GetTargetNameForSaving: %s\n", pathStream.str().c_str());
|
||||||
return pathStream.str();
|
return pathStream.str();
|
||||||
}
|
}
|
||||||
void MediaTask::Response(const std::vector<MediaTaskResponse> &response)
|
void MediaTask::Response(const std::vector<MediaTaskResponse> &response)
|
||||||
|
|
|
@ -49,5 +49,6 @@ private:
|
||||||
const std::string mSavePath;
|
const std::string mSavePath;
|
||||||
bool mFinished = false;
|
bool mFinished = false;
|
||||||
std::shared_ptr<MediaTaskResponse> mResponseData;
|
std::shared_ptr<MediaTaskResponse> mResponseData;
|
||||||
|
std::string mTargetName;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user