Skip to content

Commit

Permalink
Correct language propagation
Browse files Browse the repository at this point in the history
Issue: #1784

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131811458
  • Loading branch information
AquilesCanta authored and ojw28 committed Aug 31, 2016
1 parent f70fbf4 commit 4d92d8f
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,24 +547,24 @@ private void buildTracks(HlsExtractorWrapper extractor) {
int trackIndex = 0;
for (int i = 0; i < extractorTrackCount; i++) {
MediaFormat format = extractor.getMediaFormat(i).copyWithDurationUs(durationUs);
String language = null;
String muxedLanguage = null;
if (MimeTypes.isAudio(format.mimeType)) {
language = chunkSource.getMuxedAudioLanguage();
muxedLanguage = chunkSource.getMuxedAudioLanguage();
} else if (MimeTypes.APPLICATION_EIA608.equals(format.mimeType)) {
language = chunkSource.getMuxedCaptionLanguage();
muxedLanguage = chunkSource.getMuxedCaptionLanguage();
}
if (i == primaryExtractorTrackIndex) {
for (int j = 0; j < chunkSourceTrackCount; j++) {
extractorTrackIndices[trackIndex] = i;
chunkSourceTrackIndices[trackIndex] = j;
Variant fixedTrackVariant = chunkSource.getFixedTrackVariant(j);
trackFormats[trackIndex++] = fixedTrackVariant == null ? format.copyAsAdaptive(null)
: copyWithFixedTrackInfo(format, fixedTrackVariant.format, language);
: copyWithFixedTrackInfo(format, fixedTrackVariant.format, muxedLanguage);
}
} else {
extractorTrackIndices[trackIndex] = i;
chunkSourceTrackIndices[trackIndex] = -1;
trackFormats[trackIndex++] = format.copyWithLanguage(language);
trackFormats[trackIndex++] = format.copyWithLanguage(muxedLanguage);
}
}
}
Expand All @@ -590,14 +590,14 @@ private void setTrackEnabledState(int track, boolean enabledState) {
*
* @param format The {@link MediaFormat} to copy.
* @param fixedTrackFormat The {@link Format} to incorporate into the copy.
* @param languageOverride The language to incorporate into the copy.
* @param muxedLanguage The muxed language as declared by the playlist.
* @return The copied {@link MediaFormat}.
*/
private static MediaFormat copyWithFixedTrackInfo(MediaFormat format, Format fixedTrackFormat,
String languageOverride) {
String muxedLanguage) {
int width = fixedTrackFormat.width == -1 ? MediaFormat.NO_VALUE : fixedTrackFormat.width;
int height = fixedTrackFormat.height == -1 ? MediaFormat.NO_VALUE : fixedTrackFormat.height;
String language = languageOverride == null ? fixedTrackFormat.language : languageOverride;
String language = fixedTrackFormat.language == null ? muxedLanguage : fixedTrackFormat.language;
return format.copyWithFixedTrackInfo(fixedTrackFormat.id, fixedTrackFormat.bitrate, width,
height, language);
}
Expand Down

0 comments on commit 4d92d8f

Please sign in to comment.