diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index e64ba2be..dae8852e 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -289,6 +289,8 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM return false; } + // Most FFmpeg decoders process input using a "push" model. + // We'll see those fail here if the format is not supported. err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt); if (err < 0) { char errorstring[512]; @@ -297,6 +299,25 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM "Test decode failed: %s", errorstring); return false; } + + AVFrame* frame = av_frame_alloc(); + if (!frame) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Failed to allocate frame"); + return false; + } + + // A few FFmpeg decoders (h264_mmal) process here using a "pull" model. + // Those decoders will fail here if the format is not supported. + err = avcodec_receive_frame(m_VideoDecoderCtx, frame); + 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) &&