mirror of
https://github.com/androidx/media.git
synced 2025-05-08 16:10:38 +08:00
Use MP4VTT MIME type in DashManifestParser (again)
We stopped using using this MIME type in74a9d8f680
This broke subtitle decoding in some cases (Issue: #7985), which I fixed in7b8895d655
. 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
This commit is contained in:
parent
d4a0dfda77
commit
907d10705a
@ -91,15 +91,11 @@ public interface SubtitleDecoderFactory {
|
||||
|
||||
@Override
|
||||
public SubtitleDecoder createDecoder(Format format) {
|
||||
@Nullable String sampleMimeType = format.sampleMimeType;
|
||||
if (sampleMimeType != null) {
|
||||
switch (sampleMimeType) {
|
||||
@Nullable String mimeType = format.sampleMimeType;
|
||||
if (mimeType != null) {
|
||||
switch (mimeType) {
|
||||
case MimeTypes.TEXT_VTT:
|
||||
if (MimeTypes.APPLICATION_MP4.equals(format.containerMimeType)) {
|
||||
return new Mp4WebvttDecoder();
|
||||
} else {
|
||||
return new WebvttDecoder();
|
||||
}
|
||||
return new WebvttDecoder();
|
||||
case MimeTypes.TEXT_SSA:
|
||||
return new SsaDecoder(format.initializationData);
|
||||
case MimeTypes.APPLICATION_MP4VTT:
|
||||
@ -113,7 +109,7 @@ public interface SubtitleDecoderFactory {
|
||||
case MimeTypes.APPLICATION_CEA608:
|
||||
case MimeTypes.APPLICATION_MP4CEA608:
|
||||
return new Cea608Decoder(
|
||||
sampleMimeType,
|
||||
mimeType,
|
||||
format.accessibilityChannel,
|
||||
Cea608Decoder.MIN_DATA_CHANNEL_TIMEOUT_MS);
|
||||
case MimeTypes.APPLICATION_CEA708:
|
||||
@ -127,7 +123,7 @@ public interface SubtitleDecoderFactory {
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException(
|
||||
"Attempted to create decoder for unsupported MIME type: " + sampleMimeType);
|
||||
"Attempted to create decoder for unsupported MIME type: " + mimeType);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1363,7 +1363,8 @@ public class DashManifestParser extends DefaultHandler
|
||||
// All other text types are raw formats.
|
||||
return 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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user