demuxer: use m_tsBuffer and clean some more code