Hi,
I have a question regarding BitStreamParserH264.cpp.
At the very bottom of the FindSPSandPPS() function, the code is implemented as follows:
m_pStream->Seek(amf::AMF_SEEK_BEGIN, 0, NULL);
// It will fail if SPS or PPS are absent
extraDataBuilder.GetExtradata(m_Extradata);
m_ReadData.SetSize(0);
My question is: Is calling m_ReadData.SetSize(0); at this point absolutely necessary?
Consider a case where the file contains only one sequence and immediately ends with the following NALUs:
00 00 00 01 09 + 00 00 00 01 67 + 00 00 00 01 68 + 00 00 00 01 65 (EOF)
If a file ends like this, it causes an error condition. At this moment, m_bEof is already evaluated as true. Because m_ReadData.SetSize(0); is forced right after, the check inside QueryOutput() gets triggered immediately:
if ((m_bEof && m_ReadData.GetSize() == 0) || (m_maxFramesNumber && m_PacketCount >= m_maxFramesNumber))
{
return AMF_EOF;
}
As a result, it hits the condition and unexpectedly returns AMF_EOF, preventing the actual frame data from being dispatched.
Should m_ReadData.SetSize(0); really be enforced here, or is this a potential edge-case bug in the sample parser? I would appreciate your insights.
Thank you!
Hi,
I have a question regarding
BitStreamParserH264.cpp.At the very bottom of the
FindSPSandPPS()function, the code is implemented as follows:My question is: Is calling
m_ReadData.SetSize(0);at this point absolutely necessary?Consider a case where the file contains only one sequence and immediately ends with the following NALUs:
00 00 00 01 09+00 00 00 01 67+00 00 00 01 68+00 00 00 01 65(EOF)If a file ends like this, it causes an error condition. At this moment,
m_bEofis already evaluated astrue. Becausem_ReadData.SetSize(0);is forced right after, the check insideQueryOutput()gets triggered immediately:As a result, it hits the condition and unexpectedly returns
AMF_EOF, preventing the actual frame data from being dispatched.Should
m_ReadData.SetSize(0);really be enforced here, or is this a potential edge-case bug in the sample parser? I would appreciate your insights.Thank you!