Commit 506e9e95 by ibaker Committed by kim-vde

Use MP4VTT MIME type in DashManifestParser (again)

We stopped using using this MIME type in
https://github.com/google/ExoPlayer/commit/74a9d8f680995f2096c59fde6cd1ef6e85bb4d55

This broke subtitle decoding in some cases (Issue: #7985), which I
fixed in
https://github.com/google/ExoPlayer/commit/7b8895d655c9b48e042f66045bc9c7ab27e93346.

After some discussion we've decided SubtitleDecoderFactory shouldn't
depend on Format.containerMimeType (since the samples have already been
extracted by this point, so the container shouldn't matter). So this
change fixes DashManifestParser to use MimeTypes.APPLICATION_MP4VTT (and
reverts the no-longer-needed SubtitleDecoderFactory change).

PiperOrigin-RevId: 336668450
parent d2db0bb7
...@@ -91,15 +91,11 @@ public interface SubtitleDecoderFactory { ...@@ -91,15 +91,11 @@ public interface SubtitleDecoderFactory {
@Override @Override
public SubtitleDecoder createDecoder(Format format) { public SubtitleDecoder createDecoder(Format format) {
@Nullable String sampleMimeType = format.sampleMimeType; @Nullable String mimeType = format.sampleMimeType;
if (sampleMimeType != null) { if (mimeType != null) {
switch (sampleMimeType) { switch (mimeType) {
case MimeTypes.TEXT_VTT: case MimeTypes.TEXT_VTT:
if (MimeTypes.APPLICATION_MP4.equals(format.containerMimeType)) { return new WebvttDecoder();
return new Mp4WebvttDecoder();
} else {
return new WebvttDecoder();
}
case MimeTypes.TEXT_SSA: case MimeTypes.TEXT_SSA:
return new SsaDecoder(format.initializationData); return new SsaDecoder(format.initializationData);
case MimeTypes.APPLICATION_MP4VTT: case MimeTypes.APPLICATION_MP4VTT:
...@@ -113,7 +109,7 @@ public interface SubtitleDecoderFactory { ...@@ -113,7 +109,7 @@ public interface SubtitleDecoderFactory {
case MimeTypes.APPLICATION_CEA608: case MimeTypes.APPLICATION_CEA608:
case MimeTypes.APPLICATION_MP4CEA608: case MimeTypes.APPLICATION_MP4CEA608:
return new Cea608Decoder( return new Cea608Decoder(
sampleMimeType, mimeType,
format.accessibilityChannel, format.accessibilityChannel,
Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS); Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS);
case MimeTypes.APPLICATION_CEA708: case MimeTypes.APPLICATION_CEA708:
...@@ -127,7 +123,7 @@ public interface SubtitleDecoderFactory { ...@@ -127,7 +123,7 @@ public interface SubtitleDecoderFactory {
} }
} }
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Attempted to create decoder for unsupported MIME type: " + sampleMimeType); "Attempted to create decoder for unsupported MIME type: " + mimeType);
} }
}; };
} }
...@@ -1535,7 +1535,8 @@ public class DashManifestParser extends DefaultHandler ...@@ -1535,7 +1535,8 @@ public class DashManifestParser extends DefaultHandler
// All other text types are raw formats. // All other text types are raw formats.
return containerMimeType; return containerMimeType;
} else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) { } else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
return MimeTypes.getMediaMimeType(codecs); @Nullable String mimeType = MimeTypes.getMediaMimeType(codecs);
return MimeTypes.TEXT_VTT.equals(mimeType) ? MimeTypes.APPLICATION_MP4VTT : mimeType;
} }
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment