Commit 1c09af02 by andrewlewis Committed by Oliver Woodman

Fix handling of text codecs strings in DashManifestParser

Also fix an NPE in FfmpegAudioRenderer if sampleMimeType wasn't set.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=208230947
parent 9d14a3b3
......@@ -95,7 +95,7 @@ public final class FfmpegAudioRenderer extends SimpleDecoderAudioRenderer {
protected int supportsFormatInternal(DrmSessionManager<ExoMediaCrypto> drmSessionManager,
Format format) {
Assertions.checkNotNull(format.sampleMimeType);
if (!FfmpegLibrary.isAvailable() || !MimeTypes.isAudio(format.sampleMimeType)) {
if (!FfmpegLibrary.isAvailable()) {
return FORMAT_UNSUPPORTED_TYPE;
} else if (!FfmpegLibrary.supportsFormat(format.sampleMimeType, format.pcmEncoding)
|| !isOutputSupported(format)) {
......
......@@ -218,6 +218,9 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
@Override
public final int supportsFormat(Format format) {
if (!MimeTypes.isAudio(format.sampleMimeType)) {
return FORMAT_UNSUPPORTED_TYPE;
}
int formatSupport = supportsFormatInternal(drmSessionManager, format);
if (formatSupport <= FORMAT_UNSUPPORTED_DRM) {
return formatSupport;
......@@ -227,15 +230,15 @@ public abstract class SimpleDecoderAudioRenderer extends BaseRenderer implements
}
/**
* Returns the {@link #FORMAT_SUPPORT_MASK} component of the return value for
* {@link #supportsFormat(Format)}.
* Returns the {@link #FORMAT_SUPPORT_MASK} component of the return value for {@link
* #supportsFormat(Format)}.
*
* @param drmSessionManager The renderer's {@link DrmSessionManager}.
* @param format The format.
* @param format The format, which has an audio {@link Format#sampleMimeType}.
* @return The extent to which the renderer supports the format itself.
*/
protected abstract int supportsFormatInternal(DrmSessionManager<ExoMediaCrypto> drmSessionManager,
Format format);
protected abstract int supportsFormatInternal(
DrmSessionManager<ExoMediaCrypto> drmSessionManager, Format format);
/**
* Returns whether the audio sink can accept audio in the specified encoding.
......
......@@ -1022,10 +1022,12 @@ public class DashManifestParser extends DefaultHandler
} else if (mimeTypeIsRawText(containerMimeType)) {
return containerMimeType;
} else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
if ("stpp".equals(codecs)) {
return MimeTypes.APPLICATION_TTML;
} else if ("wvtt".equals(codecs)) {
return MimeTypes.APPLICATION_MP4VTT;
if (codecs != null) {
if (codecs.startsWith("stpp")) {
return MimeTypes.APPLICATION_TTML;
} else if (codecs.startsWith("wvtt")) {
return MimeTypes.APPLICATION_MP4VTT;
}
}
} else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
if (codecs != 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