Skip to content
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

psi: handle multi-table PMT split across multiple packets #90

Merged
merged 3 commits into from
Jun 18, 2018

Conversation

tmm1
Copy link
Contributor

@tmm1 tmm1 commented Jun 15, 2018

Following up on #75 and #85, which both dealt with cases where multiple tables exist in the PMT stream (SCTE 0xc0 table as well as 0x2 program map table).

This time, the 0xc0 and 0x2 tables are again combined (like with #75), however now the combined size is larger than a single packet so the payload has to be continued into a second packet.

I added a test case, and fixed the PMTDoneFunc implementation, however the new test is still not passing. It looks like I've uncovered some sort of bug in the accumulator. When I observe the the values of the packets in accumulator.Parse(), both entries have the same contents. Somehow the contents of the first packet are being lost between the first and second invocations of the doneFunc.

cc @kortschak since he was looking at the accumulator recently as well

tmm1 added 3 commits June 15, 2018 12:48
This fixes a serious bug where the accumulator wouldn't work if the
caller was re-using a packet buffer (like in the tests or cli for
example).
@tmm1
Copy link
Contributor Author

tmm1 commented Jun 15, 2018

I was able to fix my new test by changing the accumulator to make a copy of the packet before storing it (a6ff222):

-       a.packets = append(a.packets, pkt)
+       pktCopy := make(Packet, PacketSize)
+       copy(pktCopy, pkt)
+       a.packets = append(a.packets, pktCopy)

It's surprising this wasn't caught before..

@tmm1 tmm1 changed the title [WIP] psi: handle multi-table PMT split across multiple packets psi: handle multi-table PMT split across multiple packets Jun 18, 2018
@tmm1
Copy link
Contributor Author

tmm1 commented Jun 18, 2018

Hope everyone had a great weekend. Would love a review here when you have a moment.

@ieckart ieckart self-requested a review June 18, 2018 19:17
@ieckart
Copy link
Collaborator

ieckart commented Jun 18, 2018

It was a good weekend. reviewing it now. :)

Copy link
Collaborator

@ieckart ieckart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants