Skip to content

Commit

Permalink
fix(CEA): Ignore XDS control codes (#6702)
Browse files Browse the repository at this point in the history
Thanks @tykus160
  • Loading branch information
avelad authored May 30, 2024
1 parent 2e248db commit f69694a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/cea/cea608_data_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,15 @@ shaka.cea.Cea608DataChannel = class {
// b1 -> |P|0|0|1|X|X|X|X|
return (b1 & 0x70) === 0x10;
}

/**
* Checks if the data contains a XDS control code.
* @param {number} b1 Byte 1.
* @return {boolean}
*/
static isXdsControlCode(b1) {
return b1 >= 0x01 && b1 <= 0x0F;
}
};

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/cea/cea_decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ shaka.cea.CeaDecoder = class {
ccPacket.ccData1 &= 0x7f;
ccPacket.ccData2 &= 0x7f;

// Ignore XDS
if (shaka.cea.Cea608DataChannel.isXdsControlCode(ccPacket.ccData1)) {
return null;
}

// Check for empty captions and skip them.
if (!ccPacket.ccData1 && !ccPacket.ccData2) {
return null;
Expand Down

0 comments on commit f69694a

Please sign in to comment.