Don't fail if we find a track is unsupported
Use AUDIO_UNKNOWN instead. This is in line with our handling of video tracks with VIDEO_UNKNOWN. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=157209428
This commit is contained in:
parent
9737046e53
commit
2c20689237
@ -16,6 +16,7 @@
|
||||
package com.google.android.exoplayer2.extractor.mkv;
|
||||
|
||||
import android.support.annotation.IntDef;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
@ -84,6 +85,8 @@ public final class MatroskaExtractor implements Extractor {
|
||||
*/
|
||||
public static final int FLAG_DISABLE_SEEK_FOR_CUES = 1;
|
||||
|
||||
private static final String TAG = "MatroskaExtractor";
|
||||
|
||||
private static final int UNSET_ENTRY_ID = -1;
|
||||
|
||||
private static final int BLOCK_STATE_START = 0;
|
||||
@ -1559,7 +1562,12 @@ public final class MatroskaExtractor implements Extractor {
|
||||
break;
|
||||
case CODEC_ID_FOURCC:
|
||||
initializationData = parseFourCcVc1Private(new ParsableByteArray(codecPrivate));
|
||||
mimeType = initializationData == null ? MimeTypes.VIDEO_UNKNOWN : MimeTypes.VIDEO_VC1;
|
||||
if (initializationData != null) {
|
||||
mimeType = MimeTypes.VIDEO_VC1;
|
||||
} else {
|
||||
Log.w(TAG, "Unsupported FourCC. Setting mimeType to " + MimeTypes.VIDEO_UNKNOWN);
|
||||
mimeType = MimeTypes.VIDEO_UNKNOWN;
|
||||
}
|
||||
break;
|
||||
case CODEC_ID_THEORA:
|
||||
// TODO: This can be set to the real mimeType if/when we work out what initializationData
|
||||
@ -1615,19 +1623,27 @@ public final class MatroskaExtractor implements Extractor {
|
||||
break;
|
||||
case CODEC_ID_ACM:
|
||||
mimeType = MimeTypes.AUDIO_RAW;
|
||||
if (!parseMsAcmCodecPrivate(new ParsableByteArray(codecPrivate))) {
|
||||
throw new ParserException("Non-PCM MS/ACM is unsupported");
|
||||
}
|
||||
pcmEncoding = Util.getPcmEncoding(audioBitDepth);
|
||||
if (pcmEncoding == C.ENCODING_INVALID) {
|
||||
throw new ParserException("Unsupported PCM bit depth: " + audioBitDepth);
|
||||
if (parseMsAcmCodecPrivate(new ParsableByteArray(codecPrivate))) {
|
||||
pcmEncoding = Util.getPcmEncoding(audioBitDepth);
|
||||
if (pcmEncoding == C.ENCODING_INVALID) {
|
||||
pcmEncoding = Format.NO_VALUE;
|
||||
mimeType = MimeTypes.AUDIO_UNKNOWN;
|
||||
Log.w(TAG, "Unsupported PCM bit depth: " + audioBitDepth + ". Setting mimeType to "
|
||||
+ mimeType);
|
||||
}
|
||||
} else {
|
||||
mimeType = MimeTypes.AUDIO_UNKNOWN;
|
||||
Log.w(TAG, "Non-PCM MS/ACM is unsupported. Setting mimeType to " + mimeType);
|
||||
}
|
||||
break;
|
||||
case CODEC_ID_PCM_INT_LIT:
|
||||
mimeType = MimeTypes.AUDIO_RAW;
|
||||
pcmEncoding = Util.getPcmEncoding(audioBitDepth);
|
||||
if (pcmEncoding == C.ENCODING_INVALID) {
|
||||
throw new ParserException("Unsupported PCM bit depth: " + audioBitDepth);
|
||||
pcmEncoding = Format.NO_VALUE;
|
||||
mimeType = MimeTypes.AUDIO_UNKNOWN;
|
||||
Log.w(TAG, "Unsupported PCM bit depth: " + audioBitDepth + ". Setting mimeType to "
|
||||
+ mimeType);
|
||||
}
|
||||
break;
|
||||
case CODEC_ID_SUBRIP:
|
||||
|
@ -61,6 +61,7 @@ public final class MimeTypes {
|
||||
public static final String AUDIO_AMR_WB = BASE_TYPE_AUDIO + "/amr-wb";
|
||||
public static final String AUDIO_FLAC = BASE_TYPE_AUDIO + "/x-flac";
|
||||
public static final String AUDIO_ALAC = BASE_TYPE_AUDIO + "/alac";
|
||||
public static final String AUDIO_UNKNOWN = BASE_TYPE_AUDIO + "/x-unknown";
|
||||
|
||||
public static final String TEXT_VTT = BASE_TYPE_TEXT + "/vtt";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user