aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/host1x/ffmpeg/ffmpeg.cpp
diff options
context:
space:
mode:
authorMaranBr <maranbr@outlook.com>2025-10-02 00:15:14 +0200
committercrueter <crueter@eden-emu.dev>2025-10-02 00:15:14 +0200
commit326865cba2641f693d8500506594c387259dfc11 (patch)
tree372fbe72d05f7aba859917ac673f0360dbbcb5ee /src/video_core/host1x/ffmpeg/ffmpeg.cpp
parent76b5d6778ec6245979a9f6963616d7fadb814d76 (diff)
[host1x] Improve FFmpeg error handling (#2643)
This improves the FFmpeg error handling. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2643 Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
Diffstat (limited to 'src/video_core/host1x/ffmpeg/ffmpeg.cpp')
-rw-r--r--src/video_core/host1x/ffmpeg/ffmpeg.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/video_core/host1x/ffmpeg/ffmpeg.cpp b/src/video_core/host1x/ffmpeg/ffmpeg.cpp
index 536a01fcc8..bbbbe615ce 100644
--- a/src/video_core/host1x/ffmpeg/ffmpeg.cpp
+++ b/src/video_core/host1x/ffmpeg/ffmpeg.cpp
@@ -233,7 +233,7 @@ bool DecoderContext::OpenContext(const Decoder& decoder) {
}
bool DecoderContext::SendPacket(const Packet& packet) {
- if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0 && ret != AVERROR_EOF) {
+ if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
LOG_ERROR(HW_GPU, "avcodec_send_packet error: {}", AVError(ret));
return false;
}
@@ -242,31 +242,31 @@ bool DecoderContext::SendPacket(const Packet& packet) {
}
std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
- auto ReceiveImpl = [&](AVFrame* frame) -> bool {
- if (const int ret = avcodec_receive_frame(m_codec_context, frame); ret < 0 && ret != AVERROR_EOF) {
+ auto ReceiveImpl = [&](AVFrame* frame) -> int {
+ const int ret = avcodec_receive_frame(m_codec_context, frame);
+ if (ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
LOG_ERROR(HW_GPU, "avcodec_receive_frame error: {}", AVError(ret));
- return false;
}
- return true;
+ return ret;
};
std::shared_ptr<Frame> intermediate_frame = std::make_shared<Frame>();
- if (!ReceiveImpl(intermediate_frame->GetFrame())) {
+ if (ReceiveImpl(intermediate_frame->GetFrame()) < 0) {
return {};
}
- m_temp_frame = std::make_shared<Frame>();
+ m_final_frame = std::make_shared<Frame>();
if (m_codec_context->hw_device_ctx) {
- m_temp_frame->SetFormat(PreferredGpuFormat);
- if (int ret = av_hwframe_transfer_data(m_temp_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
+ m_final_frame->SetFormat(PreferredGpuFormat);
+ if (const int ret = av_hwframe_transfer_data(m_final_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
return {};
}
} else {
- m_temp_frame = std::move(intermediate_frame);
+ m_final_frame = std::move(intermediate_frame);
}
- return std::move(m_temp_frame);
+ return std::move(m_final_frame);
}
void DecodeApi::Reset() {