Does this help in "guessing" where the problem might lie?
Maybe. If the file content is same, then the issue must be in the code that reads the buffered content. If you are getting discontinuity errors then you are somehow missing TS packets (or reading those twice). Check what the CPacketSync (hopefully that is the correct class name) is thinking about the stream.