Skip to content

Commit

Permalink
Fixed bug a freeze when try export without ffmpeg.
Browse files Browse the repository at this point in the history
  • Loading branch information
hidefuku committed Mar 28, 2017
1 parent ffd5f76 commit d2a7c8d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/ctrl/Exporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ bool Exporter::FFMpeg::finish(const std::function<bool()>& aWaiter)

while (!mProcess->waitForFinished(kMSec))
{
if (!aWaiter() || mFinished) break;
if (!aWaiter() || mFinished || mErrorOccurred) break;
}

auto exitStatus = mProcess->exitStatus();
//qDebug() << "exit status" << exitStatus;
//qDebug() << "exit code" << mFFMpeg->exitCode();
//qDebug() << "exit code" << mProcess->exitCode();

mProcess.reset();
return (exitStatus == QProcess::NormalExit);
Expand Down Expand Up @@ -452,6 +452,14 @@ Exporter::Result Exporter::execute()
}
}

if (mFFMpeg.errorOccurred())
{
mLog = "FFmpeg error occurred.\n" + mFFMpeg.errorString();
return mFFMpeg.errorCode() == QProcess::FailedToStart ?
Result(ResultCode_FFMpegFailedToStart, mLog) :
Result(ResultCode_FFMpegError, mLog);
}

return finish();
}

Expand Down Expand Up @@ -521,7 +529,10 @@ bool Exporter::updateTime(core::TimeInfo& aDst)

bool Exporter::update()
{
if (!mExporting) return false;
if (!mExporting)
{
return false;
}

const int currentIndex = mIndex;

Expand Down Expand Up @@ -608,7 +619,10 @@ bool Exporter::update()
updateLog();

// export
exportImage(outImage, currentIndex);
if (!exportImage(outImage, currentIndex))
{
return false;
}
}

return true;
Expand Down

0 comments on commit d2a7c8d

Please sign in to comment.