Hi, following my previous question, I did figure out how to provide timestamps to the decoder, by setting the TimeStamp property of the mfxBitStream together with the new data on each frame. I'm running into a strange case where the decoder will output two frames with the same timestamp although I only provided one frame with that specific timestamp. I have a feeling I'm not using this property correctly.
Indeed here's basically how I'm feeding data to the decoder
// Move remaining data back to the buffer start
memmove(m_mfxBitStream->Data, m_mfxBitStream->Data + m_mfxBitStream->DataOffset, m_mfxBitStream->DataLength);
// Copy new data after existing data
memcpy(m_mfxBitStream->Data + m_mfxBitStream->DataLength, newDataPtr, newDataSize);
// Update bitstream fields
m_mfxBitStream->TimeStamp = newDataTimeStamp;
m_mfxBitStream->DataOffset = 0;
m_mfxBitStream->DataLength += newDataSize;
The potential issue I can see with this is that the new timestamp is not guaranteed to correspond to the new data in the bit stream, i.e. it's possible there is still remaining data from previous frame(s) and this timestamp will be associated with an older frame or even possibly several frames. Am I correct that this is the likely explanation for the doubled timestamp I'm seeing in the output, and how can I remedy this problem?