-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Muxer: increase Continuity Counter of PAT and PMT #29
Conversation
Countinuity counter of PAT and PMT must be increased after every delivery in order to avoid errors when playing TS files with VLC or hls.js. PAT and PMT buffers are reused in order to save RAM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR, just need some clarifications
if err := m.generatePAT(); err != nil { | ||
return bytesWritten, err | ||
} | ||
if err := m.generatePAT(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reasoning behind removing this condition ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, to increase the continuity counter, PAT and PMT needs to be regenerated during every WriteTables()
, therefore they can't be cached anymore. That condition allowed to cache PAT and PMT, this is not possible anymore.
if err := m.generatePMT(); err != nil { | ||
return bytesWritten, err | ||
} | ||
if err := m.generatePMT(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reasoning behind removing this condition ?
FYI I've created a Cheers |
It seems that this PR introduced a bug: now tables version increase every time tables are written. Which doesn't go along with specification AFAIR: we should increase tables version only if they change |
I noticed the same and had to disable it: fancybits@0156013 |
What do you think about this fix : #38 ? |
I didn't notice that the version number was increasing every time tables are written - my only aim was increasing the continuity counter, as the specification says. So thanks for the fix. |
No worries, bugs happen :) |
@aler9 yeah no worries 👍 |
Hello, this library allowed rtsp-simple-server to convert seamlessly from RTSP to HLS during the last months, hence a big thank you from the entire community.
As you may already know, HLS is a video/audio streaming format that uses MPEG-TS segments, containing H264 and AAC.
The only change i had to do to generate valid HLS was hacking a couple of functions in order to increase the continuity counter of PAT and PMT after every delivery.
Although the specification is not clear enough about the continuity counter of PAT and PMT, when it is not increased, VLC starts printing these kind of errors:
At the same time, hls.js (JS library that converts from MPEG-TS to browser-compatible fMP4) is unable to generate a valid video stream.
PAT and PMT buffers are reused in order to save RAM.