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

CEA-708 Decoder fixes for issue #1807. #8356

Closed
wants to merge 3 commits into from

Conversation

sneelavara
Copy link
Contributor

This pull request is for issue#1807. In this commit -

  1. Handling the sequence number discontinuity in caption channel packet header.

  2. Handle the multiple Service Blocks within a single caption channel packet. An outer while loop is added to function processCurrentPacket() to achieve that.

  3. The processCurrentPacket returns if the packet length does not match with the currentIndex. That assumption is wrong.
    As per spec the the packet can end on reception of next cc_type = 0x3.

  4. Added a logic to handle multi byte commands. These commands can be within the service block or spread across service blocks.

  5. Processing of service block needs to wait until all the command bytes arrive. An ArrayList is used to accumulate the bytes belonging to same service block.

In this change the current flow is not altered, i.e. the parsing of service block is not started until the complete caption channel packet arrives.

These changes are verified through Sarnoff Test streams. Many tests are still failing after this change. Subsequent changes are planned to address them.

In this commit -

Handling the sequence number discontinuity in caption channel packet header.

Handle the multiple Service Blocks within a single caption channel packet. An outer while loop is added to function processCurrentPacket() to achieve that.

The processCurrentPacket returns if the packet length does not match with the currentIndex. That assumption is wrong.

As per spec the the packet can end on reception of next cc_type = 0x3.

Added a logic to handle multi byte commands. These commands can be within the service block or spread across service blocks.

Processing of service block needs to wait until all the command bytes arrive. An ArrayList is used to accumulate the bytes belonging to same service block.

In this change the current flow is not altered, i.e. the parsing of service block is not started until the complete caption channel packet arrives.

These changes are verified through Sarnoff Test streams. Many tests are still failing after this change. Subsequent changes are planned to address that.
@google-cla google-cla bot added the cla: yes label Dec 16, 2020
@icbaker icbaker self-assigned this Dec 17, 2020
Copy link
Collaborator

@icbaker icbaker left a comment

Choose a reason for hiding this comment

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

Points 1 and 2 in the description seem simple & uncontroversial - is it worth splitting them out into a separate PR?

3 is the one that seems to introduce the most complexity - and (I think?) 4 and 5 both depend on 3.

// blocks in the current packet. If the previous command spread across the paket, that is
// accumulated and handled after all the bytes are received
while (currOffset < currentDtvCcPacket.currentIndex) {
int serviceNumber = (currentDtvCcPacket.packetData[currOffset] & 0xE0) >> 5; //3 bits
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems far preferable to leverage ParsableBitArray rather than manually bit shifting.

I wonder if it's possible to re-use the serviceBlockPacket one everywhere by some cunning position checking (and rename it allServiceBlocks?), or failing that to introduce a second one called allServiceBlocks to separate the two.

I had a go locally with the first approach (use serviceBlockPacket everywhere) by making edits on top of this change - but I ran into a lack of understanding of exactly how the code is meant to behave (see my next comment) which I think affects how feasible that approach will be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @icbaker. My understanding of ParsableBitArray is that it can not be resized after creation. As per CEA-708 spec, the cc_data() can be split across multiple caption channel packets (section 4.4.1.1 - A DTVCC Caption Channel Packet may continue from one cc_data() structure to the next). In such case, we need to retain the previous data to interpret the commands correctly. But ParsableBitArray.reset() clears everything. If we could extend ParsableBitArray with append feature, I think we can still use ParsableBitArray here. As a simple workaround, I used ArrayList which can be resized easily.

sneelavara added a commit to TiVo/ExoPlayer that referenced this pull request Dec 31, 2020
In this change -

Handling the sequence number discontinuity in caption channel packet header.

The processCurrentPacket returns if the packet length does not match with the currentIndex. That assumption is wrong. As per spec the the packet can end on reception of next cc_type = 0x3.
The handling sequence discontinuity and the packet with size less the packet_size is separated out to another PR google#8415
@sneelavara
Copy link
Contributor Author

@icbaker any suggestion how can we add unit tests for these files (Cea708Decoder and Cea608Decoder)?
Since I have shared the test streams which would effectively execute almost all the aspects of the spec, would that be sufficient?

psharma676 pushed a commit to psharma676/ExoPlayer that referenced this pull request Dec 14, 2023
In this change -

Handling the sequence number discontinuity in caption channel packet header.

The processCurrentPacket returns if the packet length does not match with the currentIndex. That assumption is wrong. As per spec the the packet can end on reception of next cc_type = 0x3.
@icbaker
Copy link
Collaborator

icbaker commented Apr 15, 2024

Closing all PRs on this deprecated project. We are now unable to merge PRs from here. If you would like us to consider this change again please file a new PR on the media3 project: https:/androidx/media/pulls

@icbaker icbaker closed this Apr 15, 2024
@google google locked and limited conversation to collaborators Jun 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants