Fix Cea608 caption valid

PiperOrigin-RevId: 222797622
This commit is contained in:
olly 2018-11-26 10:58:41 +00:00 committed by Oliver Woodman
parent 03101444af
commit 17eadcc433

View file

@ -298,7 +298,6 @@ public final class Cea608Decoder extends CeaDecoder {
int ccByte1 = ccData.readUnsignedByte(); int ccByte1 = ccData.readUnsignedByte();
int ccByte2 = ccData.readUnsignedByte(); int ccByte2 = ccData.readUnsignedByte();
// Only examine valid CEA-608 packets
// TODO: We're currently ignoring the top 5 marker bits, which should all be 1s according // TODO: We're currently ignoring the top 5 marker bits, which should all be 1s according
// to the CEA-608 specification. We need to determine if the data should be handled // to the CEA-608 specification. We need to determine if the data should be handled
// differently when that is not the case. // differently when that is not the case.
@ -323,11 +322,12 @@ public final class Cea608Decoder extends CeaDecoder {
continue; continue;
} }
if ((ccHeader & CC_VALID_FLAG) != CC_VALID_FLAG) { boolean previousCaptionValid = captionValid;
if (captionValid) { captionValid = (ccHeader & CC_VALID_FLAG) == CC_VALID_FLAG;
if (!captionValid) {
if (previousCaptionValid) {
// The encoder has flipped the validity bit to indicate captions are being turned off. // The encoder has flipped the validity bit to indicate captions are being turned off.
resetCueBuilders(); resetCueBuilders();
captionValid = false;
captionDataProcessed = true; captionDataProcessed = true;
} }
continue; continue;