I've implemented the CSocketReader class derived from DataReader to buffer and pass on the data for streaming MPEG Ts. I've got it working mostly, but still getting artifacts in the video every few seconds.
So I wanted to clear a few things:
1. What should GetPosition() return? I am doing this:
return (m_stDoneSize + m_pDataPointer - m_pBuffer); // m_pBuffer - address of my circular buffer, m_pDataPointer - current read location., m_stDoneSize is number of bytes written into the buffer so far.
I found this is important to get right, because when I put in random values or zero the Demuxer does not initialize.
2. Since I have a cyclic buffer, once the ReadData is done reading the data I free up that memory so that the thread writing data is free to write there. Or does the Stream Parser code need that data later on, i.e. when I can reuse the memory for writing?