diff --git a/RELEASENOTES.md b/RELEASENOTES.md index b5088f821d4..b6f7083e3bf 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -82,6 +82,9 @@ * Apps with custom `SubtitleDecoder` implementations need to update them to implement `SubtitleParser` instead (and `SubtitleParser.Factory` instead of `SubtitleDecoderFactory`). + * PGS: Fix run-length decoding to resolve `0` as a color index, instead of + a literal color value + ([#1367](https://github.com/androidx/media/pull/1367)). * Metadata: * Fix mapping of MP4 to ID3 sort tags. Previously the 'album sort' (`soal`), 'artist sort' (`soar`) and 'album artist sort' (`soaa`) MP4 diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/pgs/PgsParser.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/pgs/PgsParser.java index a316c617c19..0e7ff2d1a74 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/pgs/PgsParser.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/pgs/PgsParser.java @@ -248,7 +248,8 @@ public Cue build() { (switchBits & 0x40) == 0 ? (switchBits & 0x3F) : (((switchBits & 0x3F) << 8) | bitmapData.readUnsignedByte()); - int color = (switchBits & 0x80) == 0 ? colors[0] : colors[bitmapData.readUnsignedByte()]; + int color = + (switchBits & 0x80) == 0 ? colors[0] : colors[bitmapData.readUnsignedByte()]; Arrays.fill( argbBitmapData, argbBitmapDataIndex, argbBitmapDataIndex + runLength, color); argbBitmapDataIndex += runLength;