AMF icon indicating copy to clipboard operation
AMF copied to clipboard

[Bug]: Decoding a certain HEVC stream fails to decode without recovering from AMF_DECODER_NO_FREE_SURFACES error

Open nick-velichko opened this issue 3 weeks ago • 2 comments

Describe the bug We have an HEVC file (elementary) that hangs after decoding circa 5000-6000 frames by SampleDecoder.exe. I checked on the debugger and found that decoder->SubmitInput() returns AMF_DECODER_NO_FREE_SURFACES after some progress, but m_pDecoder->QueryOutput() in PollingThread::Run() returns AMF_OK, but data == NULL and decoding does not proceed.

To Reproduce The file is quite big (~90MB) and can be downloaded from here: https://files.cinegy.com/index.php/s/4FDknhI4fR1WdSF Just run it with SampleDecoder.exe and it will hang after a while.

Setup (please complete the following information):

  • OS: Windows 10 / Windows 11
  • Driver Version: 32.0.12033.1030 from 27-Nov-2024
  • GPU : AMD Radeon 610M, but we also checked other AMD cards - all hang
  • Which component has the issue: Decoder

Debug Log (please upload or paste):

2025-12-15 17:11:43.446     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::SubmitInput()
2025-12-15 17:11:43.446     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::QueryOutput()
2025-12-15 17:11:43.446     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.446     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::SubmitInput() : format (P010), memory (DX11), width (1920), height (1080)
2025-12-15 17:11:43.446     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::QueryOutput()
2025-12-15 17:11:43.446     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.446     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::SubmitInput()
2025-12-15 17:11:43.446     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::QueryOutput()
2025-12-15 17:11:43.460     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.460     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::SubmitInput() : format (P010), memory (DX11), width (1920), height (1080)
2025-12-15 17:11:43.460     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.460     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::QueryOutput()
2025-12-15 17:11:43.465     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::SubmitInput()
2025-12-15 17:11:43.465     75FC [AMFVideoStreamParserImpl]   Debug: AMFVideoStreamParserImpl::QueryOutput()
2025-12-15 17:11:43.465     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.465     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::SubmitInput() : format (P010), memory (DX11), width (1920), height (1080)
2025-12-15 17:11:43.475     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.475     2248 [AMFVideoConverterImpl]   Debug: AMFVideoConverterImpl::QueryOutput()
2025-12-15 17:11:43.476     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.493     75FC +1
2025-12-15 17:11:43.493     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.508     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.508     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.524     2248 +1
2025-12-15 17:11:43.524     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.540     75FC +1
2025-12-15 17:11:43.540     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.556     2248 +1
2025-12-15 17:11:43.556     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.572     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.588     2248 +1
2025-12-15 17:11:43.588     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.605     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.605     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.621     75FC +1
2025-12-15 17:11:43.621     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.636     2248 +1
2025-12-15 17:11:43.636     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.645     75FC +1
2025-12-15 17:11:43.645     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.647     2248 +1
2025-12-15 17:11:43.647     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.662     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.677     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.680     75FC +1
2025-12-15 17:11:43.680     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.694     2248 +1
2025-12-15 17:11:43.694     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.710     75FC +1
2025-12-15 17:11:43.710     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.726     2248 +1
2025-12-15 17:11:43.726     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.742     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.757     2248 +1
2025-12-15 17:11:43.757     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.773     75FC +1
2025-12-15 17:11:43.773     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.779     2248 +1
2025-12-15 17:11:43.779     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.789     75FC +1
2025-12-15 17:11:43.789     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.791     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.807     75FC +1
2025-12-15 17:11:43.807     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.822     2248 +1
2025-12-15 17:11:43.822     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.838     75FC +1
2025-12-15 17:11:43.838     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.846     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.846     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.861     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.861     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.866     2248 +1
2025-12-15 17:11:43.866     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.868     75FC +1
2025-12-15 17:11:43.868     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.883     2248 +1
2025-12-15 17:11:43.883     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.898     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.898     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.913     75FC +1
2025-12-15 17:11:43.913     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.916     2248 +1
2025-12-15 17:11:43.916     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.929     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.945     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.947     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.962     2248 +1
2025-12-15 17:11:43.962     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.967     75FC +1
2025-12-15 17:11:43.967     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.972     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.972     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:43.984     2248 +1
2025-12-15 17:11:43.984     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:43.999     75FC +1
2025-12-15 17:11:43.999     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:44.014     2248 +1
2025-12-15 17:11:44.014     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:44.027     75FC +1
2025-12-15 17:11:44.027     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:44.043     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:44.059     75FC +1
2025-12-15 17:11:44.059     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:44.075     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:44.075     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:44.091     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:44.091     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()
2025-12-15 17:11:44.107     2248 [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::QueryOutput()
2025-12-15 17:11:44.107     75FC [AMFDecoderUVDImpl]   Debug: AMFDecoderUVDImpl::SubmitInput()

Expected behavior It should properly recover after AMF_DECODER_NO_FREE_SURFACES and continue.

Additional context FYI: The older driver 27.20.11028.10001 from 19-Nov-2020 is working.

nick-velichko avatar Dec 15 '25 14:12 nick-velichko

The issue is similar to #368 with H.264

nick-velichko avatar Dec 15 '25 14:12 nick-velichko

Thanks for reporting. This file actually causes three issues:

  1. In sample code here: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/afed28d37aca1938da2eedc50599bb3535a987ec/amf/public/samples/CPPSamples/SimpleDecoder/SimpleDecoder.cpp#L218 need to set bNeedNewInput = true;
  2. It was a bug in parsing of HRD header. You use older driver but in the newest driver parsers were updated for stricter error reporting, so the parsing error popped up.
  3. The actual hang happens when POC value in the stream is reset. All fixes will come with driver update.

MikhailAMD avatar Dec 15 '25 21:12 MikhailAMD