From 63eaf1144cce9caa2637e81e2d3d73ba1f36ad78 Mon Sep 17 00:00:00 2001 From: ibaker Date: Mon, 6 Jan 2020 11:48:54 +0000 Subject: [PATCH] Fix MatroskaExtractor to use blockDurationUs not durationUs This typo was introduced in https://github.com/google/ExoPlayer/commit/ddb70d96ad99f07fe10f53a76ce3262fe625be70 when migrating a static method with parameter `durationUs` to an instance method where the correct field to use was `blockDurationUs` (but `durationUs` also exists). The test that catches this was only added in https://github.com/google/ExoPlayer/commit/45013ece1e3fe054ff8960355a89559241eeb288 (and therefore configured with the wrong expected output data). issue:#6833 PiperOrigin-RevId: 288274197 --- RELEASENOTES.md | 2 ++ .../android/exoplayer2/extractor/mkv/MatroskaExtractor.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index c403f0160f..bcd6de8029 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -23,6 +23,8 @@ * WAV: * Support IMA ADPCM encoded data. * Improve support for G.711 A-law and mu-law encoded data. +* Fix MKV subtitles to disappear when intended instead of lasting until the + next cue ([#6833](https://github.com/google/ExoPlayer/issues/6833)). ### 2.11.1 (2019-12-20) ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java index b30fbf105e..bede029a0e 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java @@ -1248,10 +1248,10 @@ public class MatroskaExtractor implements Extractor { if (CODEC_ID_SUBRIP.equals(track.codecId) || CODEC_ID_ASS.equals(track.codecId)) { if (blockSampleCount > 1) { Log.w(TAG, "Skipping subtitle sample in laced block."); - } else if (durationUs == C.TIME_UNSET) { + } else if (blockDurationUs == C.TIME_UNSET) { Log.w(TAG, "Skipping subtitle sample with no duration."); } else { - setSubtitleEndTime(track.codecId, durationUs, subtitleSample.data); + setSubtitleEndTime(track.codecId, blockDurationUs, subtitleSample.data); // Note: If we ever want to support DRM protected subtitles then we'll need to output the // appropriate encryption data here. track.output.sampleData(subtitleSample, subtitleSample.limit());