V2 Extension fixes

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120699171
This commit is contained in:
eguven 2016-04-25 05:53:11 -07:00 committed by Oliver Woodman
parent da5e4dbe92
commit d1eb43ad62
5 changed files with 14 additions and 6 deletions

View file

@ -52,7 +52,7 @@ public class LibflacAudioTrackRenderer extends AudioDecoderTrackRenderer {
} }
@Override @Override
protected int supportsFormat(Format format) { protected int supportsFormat(Format format) {
return MimeTypes.AUDIO_FLAC.equalsIgnoreCase(format.sampleMimeType) return isLibflacAvailable() && MimeTypes.AUDIO_FLAC.equalsIgnoreCase(format.sampleMimeType)
? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE; ? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE;
} }

View file

@ -60,7 +60,7 @@ public final class LibopusAudioTrackRenderer extends AudioDecoderTrackRenderer {
@Override @Override
protected int supportsFormat(Format format) { protected int supportsFormat(Format format) {
return MimeTypes.AUDIO_OPUS.equalsIgnoreCase(format.sampleMimeType) return isLibopusAvailable() && MimeTypes.AUDIO_OPUS.equalsIgnoreCase(format.sampleMimeType)
? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE; ? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE;
} }

View file

@ -186,7 +186,7 @@ public final class LibvpxVideoTrackRenderer extends TrackRenderer {
@Override @Override
protected int supportsFormat(Format format) { protected int supportsFormat(Format format) {
return MimeTypes.VIDEO_VP9.equalsIgnoreCase(format.sampleMimeType) return isLibvpxAvailable() && MimeTypes.VIDEO_VP9.equalsIgnoreCase(format.sampleMimeType)
? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE; ? FORMAT_HANDLED : FORMAT_UNSUPPORTED_TYPE;
} }

View file

@ -83,7 +83,6 @@ public final class VpxOutputBuffer extends OutputBuffer {
yuvPlanes = new ByteBuffer[3]; yuvPlanes = new ByteBuffer[3];
} }
// Rewrapping has to be done on every frame since the stride might have changed. // Rewrapping has to be done on every frame since the stride might have changed.
data.position(0);
yuvPlanes[0] = data.slice(); yuvPlanes[0] = data.slice();
yuvPlanes[0].limit(yLength); yuvPlanes[0].limit(yLength);
data.position(yLength); data.position(yLength);
@ -103,9 +102,10 @@ public final class VpxOutputBuffer extends OutputBuffer {
private void initData(int size) { private void initData(int size) {
if (data == null || data.capacity() < size) { if (data == null || data.capacity() < size) {
data = ByteBuffer.allocateDirect(size); data = ByteBuffer.allocateDirect(size);
} else {
data.position(0);
data.limit(size);
} }
data.position(0);
data.limit(size);
} }
} }

View file

@ -59,6 +59,7 @@ import java.util.List;
* <li>MPEG PS ({@link com.google.android.exoplayer.extractor.ts.PsExtractor})</li> * <li>MPEG PS ({@link com.google.android.exoplayer.extractor.ts.PsExtractor})</li>
* <li>FLV ({@link com.google.android.exoplayer.extractor.flv.FlvExtractor})</li> * <li>FLV ({@link com.google.android.exoplayer.extractor.flv.FlvExtractor})</li>
* <li>WAV ({@link com.google.android.exoplayer.extractor.wav.WavExtractor})</li> * <li>WAV ({@link com.google.android.exoplayer.extractor.wav.WavExtractor})</li>
* <li>FLAC (only available if the FLAC extension is built and included)</li>
* </ul> * </ul>
* *
* <p>Seeking in AAC, MPEG TS and FLV streams is not supported. * <p>Seeking in AAC, MPEG TS and FLV streams is not supported.
@ -188,6 +189,13 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// Extractor not found. // Extractor not found.
} }
try {
DEFAULT_EXTRACTOR_CLASSES.add(
Class.forName("com.google.android.exoplayer.ext.flac.FlacExtractor")
.asSubclass(Extractor.class));
} catch (ClassNotFoundException e) {
// Extractor not found.
}
} }
private final Loader loader; private final Loader loader;