Skip to content

Commit

Permalink
Ignore file extension for HLS Subtitle Renditions
Browse files Browse the repository at this point in the history
According to the spec, subtitle renditions must be Webvtt media
segments.

Issue:#2025
Issue:#2355

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145289266
  • Loading branch information
AquilesCanta authored and ojw28 committed Jan 24, 2017
1 parent 18d7cdf commit 497651c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public boolean isLoadCanceled() {
public void load() throws IOException, InterruptedException {
if (extractor == null && !isPackedAudio) {
// See HLS spec, version 20, Section 3.4 for more information on packed audio extraction.
extractor = buildExtractorByExtension();
extractor = createExtractor();
}
maybeLoadInitData();
if (!loadCanceled) {
Expand Down Expand Up @@ -329,11 +329,12 @@ private static DataSource buildDataSource(DataSource dataSource, byte[] encrypti
return new Aes128DataSource(dataSource, encryptionKey, encryptionIv);
}

private Extractor buildExtractorByExtension() {
// Set the extractor that will read the chunk.
private Extractor createExtractor() {
// Select the extractor that will read the chunk.
Extractor extractor;
boolean usingNewExtractor = true;
if (lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION)
if (MimeTypes.TEXT_VTT.equals(hlsUrl.format.sampleMimeType)
|| lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION)
|| lastPathSegment.endsWith(VTT_FILE_EXTENSION)) {
extractor = new WebvttExtractor(trackFormat.language, timestampAdjuster);
} else if (!needNewExtractor) {
Expand Down

0 comments on commit 497651c

Please sign in to comment.