mpegts icon indicating copy to clipboard operation
mpegts copied to clipboard

Overwriting PES and mux/demux errors.

Open andersc opened this issue 5 years ago • 9 comments

Just want to let you know that I fixed a bunch of errors in the multiplexer and demux in my fork if you want to fix in your project.

Fixes here -> My fork

In general..

Using std::string to work with binary (non string) data is a bad idea The PES Header is destroyed in some cases The data is corrupt when building some size PES frames..

If you run the unit tests I made you will catch all of the errors that I found so far..

I also added mBroken to indicate broken PES frames.

You can close this at any time.. This is the only way for me to make you aware of the errors since we decided not to merge my fork earlier I can't create pull requests.

/Anders

andersc avatar Jul 02 '20 13:07 andersc

I will confirm these issue, thanks

akanchi avatar Jul 04 '20 02:07 akanchi

@andersc can you outline the neccessary fixes? we also used a fork and are restrcutruring a bit. also your code seems to have moved into a repo which has no shared history with this one, so its hard to merge

maddanio avatar Jul 28 '20 10:07 maddanio

I just checked, the only use of string is in PMTElementInfo, should that be replaces by vector or such?

maddanio avatar Jul 28 '20 10:07 maddanio

@maddanio I made so many changes to the original repo it's not possible for me to be that specific. Just fork my clone to get to where I'm at ->

https://github.com/Unit-X/mpegts

Then just pullrequest from there.

/Anders

andersc avatar Jul 28 '20 15:07 andersc

Ok, i tried porting your unit tests, but I think its too hard, so i switched to your fork. One thing: in both versions the demuxer is sensitive to the block size it is fed. Basically the simple buffer borders must somehow align with the demuxer granularity, otherwise things just fail oddly. I would advice a streaming input here, i.e. either an std istream or a callback. Easiest would likely be the latter, and then plug that into simple buffer.

maddanio avatar Jul 29 '20 09:07 maddanio

OK. Great you found a bug. Would it be possible for you to write a failing unit test? Then I'll fix it. Or provide more detailed information.

andersc avatar Jul 29 '20 11:07 andersc

Hmm, thats tricky, I think you kinda assert that packet size is divisible by 188 in your tests, which seems to be a magic number. its kinda obvious though that it is fragile like that, as the demuxer very rarely checks for emptiness of the buffer, i.e. it being used up, but happily reads from it the rest of the time. in debug mode that will probably trigger the assertions in the simple buffer

maddanio avatar Jul 29 '20 13:07 maddanio

let me try...

maddanio avatar Jul 29 '20 13:07 maddanio

https://github.com/Unit-X/mpegts/issues/1

maddanio avatar Jul 29 '20 13:07 maddanio