Closed andersc closed 4 years ago
When appending bytes
void SimpleBuffer::append(const char* bytes, int size) { if (size <= 0) return; _data.insert(_data.end(), bytes, bytes + size); _pos += size; }
pos will be size if pos is 0 That means that ->
bool SimpleBuffer::empty() { return _pos >= (int)_data.size(); }
Empty will be true (but it should not be) .. Or am I missing something?
There is a bug here. Maybe you can skip(-size) temporarily to avoid this problem.
The problem for me is that it's used in the demuxer
int MpegTsDemuxer::decode(SimpleBuffer *in, TsFrame *&out)
{
while (!in->empty()) {
meaning it will never parse any bytes.. I just removed the line
_pos += size;
in my fork but that might cause other problems I'm unaware of.
When appending/writing bytes, do not change pos
, pos
should only be used to read buffer.
When appending bytes
pos will be size if pos is 0 That means that ->
Empty will be true (but it should not be) .. Or am I missing something?