Fixed:Media task do not finished bug.

This commit is contained in:
Fancy code 2024-07-20 19:22:15 +08:00
parent 1a06ed0494
commit 11203a87c5
2 changed files with 8 additions and 2 deletions

View File

@ -192,6 +192,7 @@ void MediaHandle::FrameHandle(void)
HandleListFrame();
}
}
LogInfo("FrameHandle exit.\n");
}
/**
* @brief Processing audio and video streams may take a long time. This is not allowed to block the MediaHandle thread,
@ -217,7 +218,13 @@ void inline MediaHandle::HandleListFrame(void)
leftFrameCount = mFrameList.size();
} while (leftFrameCount > 0);
if (mStreamHandle->HandleFinished()) {
/**
* @brief A single media stream processing task is completed. The media stream processing thread and the media
* task waiting thread are released.
*/
mTaskRuning = false;
mCvTaskHandle.notify_one();
mCvFrameHandle.notify_one();
}
}
CameraTaskType MediaHandle::TaskTypeConvert(const MediaTaskType &type)

View File

@ -128,7 +128,7 @@ bool FfmpegThumbnail::CreateThumbnail(const std::string &outputFile, const void
}
void FfmpegThumbnail::GetDecodeDataCallback(AVFrame *frame)
{
LogInfo("GetDecodeDataCallback frame->width = %d, frame->height=%d\n", frame->width, frame->height);
LogInfo("Decode frame->width = %d, frame->height=%d\n", frame->width, frame->height);
AVFrame *thumbnailFrame = av_frame_alloc();
thumbnailFrame->format = AV_PIX_FMT_YUV420P;
thumbnailFrame->width = mTargetWidth;
@ -162,7 +162,6 @@ void FfmpegThumbnail::GetDecodeDataCallback(AVFrame *frame)
}
void FfmpegThumbnail::GetEncodeDataCallback(AVPacket *pkt, const std::string &fileName)
{
LogInfo("GetEncodeDataCallback, save thumbnail file %s\n", fileName.c_str());
SaveThumbnailFile(fileName, pkt->data, pkt->size);
}
bool FfmpegThumbnail::SaveThumbnailFile(const std::string &fileName, const void *data, const size_t &size)