From 1e6ca18193e6873f9afe92f8dd932036945293aa Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 15 Dec 2021 17:33:28 -0600 Subject: [PATCH] Fix error checking in decode test --- app/streaming/video/ffmpeg.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index a0e297ab..225b971a 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -359,7 +359,7 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, PDECODER char errorstring[512]; av_strerror(err, errorstring, sizeof(errorstring)); SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "Test decode failed: %s", errorstring); + "Test decode failed (avcodec_send_packet): %s", errorstring); return false; } @@ -376,22 +376,24 @@ bool FFmpegVideoDecoder::completeInitialization(const AVCodec* decoder, PDECODER } } + if (err < 0) { + char errorstring[512]; + av_strerror(err, errorstring, sizeof(errorstring)); + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Test decode failed (avcodec_receive_frame): %s", errorstring); + av_frame_free(&frame); + return false; + } + // Allow the renderer to do any validation it wants on this frame if (!m_FrontendRenderer->testRenderFrame(frame)) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "Render test failed"); + "Test decode failed (testRenderFrame)"); av_frame_free(&frame); return false; } av_frame_free(&frame); - if (err < 0) { - char errorstring[512]; - av_strerror(err, errorstring, sizeof(errorstring)); - SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, - "Test decode failed: %s", errorstring); - return false; - } } else { if ((params->videoFormat & VIDEO_FORMAT_MASK_H264) &&