Re-apply CEA-608 validDataChannelTimeoutMs assertion

This change was originally made in 379cb3ba54.

It was then accidentally lost in when `Cea608Parser` was merged back
into `Cea608Decoder` in 25498b151b.

This was spotted when re-doing a similar lost change to `Cea708Decoder`,
reported in https://github.com/androidx/media/pull/1315.

See reasoning on e2847b3b80
about why this is the only 'lost' CEA-608 change.

PiperOrigin-RevId: 635803536
This commit is contained in:
ibaker 2024-05-21 07:43:39 -07:00 committed by Copybara-Service
parent e2847b3b80
commit 8fdf105ab4

View File

@ -15,6 +15,7 @@
*/
package androidx.media3.extractor.text.cea;
import static androidx.media3.common.util.Assertions.checkArgument;
import static java.lang.Math.min;
import android.graphics.Color;
@ -365,8 +366,12 @@ public final class Cea608Decoder extends CeaDecoder {
cueBuilders = new ArrayList<>();
currentCueBuilder = new CueBuilder(CC_MODE_UNKNOWN, DEFAULT_CAPTIONS_ROW_COUNT);
currentChannel = NTSC_CC_CHANNEL_1;
this.validDataChannelTimeoutUs =
validDataChannelTimeoutMs > 0 ? validDataChannelTimeoutMs * 1000 : C.TIME_UNSET;
if (validDataChannelTimeoutMs != C.TIME_UNSET) {
checkArgument(validDataChannelTimeoutMs >= MIN_DATA_CHANNEL_TIMEOUT_MS);
this.validDataChannelTimeoutUs = validDataChannelTimeoutMs * 1000;
} else {
this.validDataChannelTimeoutUs = C.TIME_UNSET;
}
packetLength = MimeTypes.APPLICATION_MP4CEA608.equals(mimeType) ? 2 : 3;
switch (accessibilityChannel) {
case 1: