c++ – FFmpeg hevc rtsp stream decoding with frame loss

I need to decode my rtsp stream. When i`m using default HEVC and have some corrupted frames, my screen looks like this: Corrupted frame using HEVC, Grey image.
But instead of this, I want to have a corrupted picture with pixels issue, like this: Same corrupted frame, but using HEVC_QSV.

m_codec = avcodec_find_decoder(m_videoCodecParameters->codec_id);

if (!m_codec)
{
    qCritical() << "Cannot find decoder.";
    cleanUp(RtspStream::StreamStatus::Failed);
    return;
}
m_videoCodecContext = avcodec_alloc_context3(m_codec);

avcodec_parameters_to_context(m_videoCodecContext, m_videoCodecParameters);

m_videoCodecContext->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
m_videoCodecContext->err_recognition |= AV_EF_IGNORE_ERR;
m_videoCodecContext->flags |= AV_CODEC_FLAG2_SHOW_ALL;
m_videoCodecContext->flags |= AV_CODEC_FLAG_LOW_DELAY;

if (avcodec_open2(m_videoCodecContext, m_codec, nullptr) < 0)
{
    qCritical() << "Cannot call avcodec_open2.";
    cleanUp(RtspStream::StreamStatus::Failed);
    return;
}

Can I modify somehow something in my ffmpeg codec settings/contex to solve this problem.
P.S. I notice that while using HEVC and missing frames, i get
[hevc @ 000001892a68dc00] Could not find ref with POC 18 errors, but while using HEVC_QSV i do not.

Read more here: Source link