Skip to content

Commit 8fdf105

Browse files
icbakercopybara-github
authored andcommitted
Re-apply CEA-608 validDataChannelTimeoutMs assertion
This change was originally made in 379cb3b. It was then accidentally lost in when `Cea608Parser` was merged back into `Cea608Decoder` in 25498b1. This was spotted when re-doing a similar lost change to `Cea708Decoder`, reported in #1315. See reasoning on e2847b3 about why this is the only 'lost' CEA-608 change. PiperOrigin-RevId: 635803536
1 parent e2847b3 commit 8fdf105

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

libraries/extractor/src/main/java/androidx/media3/extractor/text/cea/Cea608Decoder.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package androidx.media3.extractor.text.cea;
1717

18+
import static androidx.media3.common.util.Assertions.checkArgument;
1819
import static java.lang.Math.min;
1920

2021
import android.graphics.Color;
@@ -365,8 +366,12 @@ public Cea608Decoder(String mimeType, int accessibilityChannel, long validDataCh
365366
cueBuilders = new ArrayList<>();
366367
currentCueBuilder = new CueBuilder(CC_MODE_UNKNOWN, DEFAULT_CAPTIONS_ROW_COUNT);
367368
currentChannel = NTSC_CC_CHANNEL_1;
368-
this.validDataChannelTimeoutUs =
369-
validDataChannelTimeoutMs > 0 ? validDataChannelTimeoutMs * 1000 : C.TIME_UNSET;
369+
if (validDataChannelTimeoutMs != C.TIME_UNSET) {
370+
checkArgument(validDataChannelTimeoutMs >= MIN_DATA_CHANNEL_TIMEOUT_MS);
371+
this.validDataChannelTimeoutUs = validDataChannelTimeoutMs * 1000;
372+
} else {
373+
this.validDataChannelTimeoutUs = C.TIME_UNSET;
374+
}
370375
packetLength = MimeTypes.APPLICATION_MP4CEA608.equals(mimeType) ? 2 : 3;
371376
switch (accessibilityChannel) {
372377
case 1:

0 commit comments

Comments
 (0)