Fix/suppress some analysis warnings.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136710546
This commit is contained in:
parent
862552c2ed
commit
a0fe258e8d
@ -37,7 +37,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':library')
|
compile project(':library')
|
||||||
compile('com.squareup.okhttp3:okhttp:+') {
|
compile('com.squareup.okhttp3:okhttp:3.4.1') {
|
||||||
exclude group: 'org.json'
|
exclude group: 'org.json'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,10 +73,13 @@ import javax.microedition.khronos.opengles.GL10;
|
|||||||
private final int[] yuvTextures = new int[3];
|
private final int[] yuvTextures = new int[3];
|
||||||
private final AtomicReference<VpxOutputBuffer> pendingOutputBufferReference;
|
private final AtomicReference<VpxOutputBuffer> pendingOutputBufferReference;
|
||||||
|
|
||||||
|
// Kept in a field rather than a local variable so that it doesn't get garbage collected before
|
||||||
|
// glDrawArrays uses it.
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
|
private FloatBuffer textureCoords;
|
||||||
private int program;
|
private int program;
|
||||||
private int texLocation;
|
private int texLocation;
|
||||||
private int colorMatrixLocation;
|
private int colorMatrixLocation;
|
||||||
private FloatBuffer textureCoords;
|
|
||||||
private int previousWidth;
|
private int previousWidth;
|
||||||
private int previousStride;
|
private int previousStride;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ dependencies {
|
|||||||
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
||||||
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
||||||
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
||||||
compile 'com.android.support:support-annotations:24.2.0'
|
compile 'com.android.support:support-annotations:24.2.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
android.libraryVariants.all { variant ->
|
android.libraryVariants.all { variant ->
|
||||||
|
@ -249,6 +249,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
// Handler.Callback implementation.
|
// Handler.Callback implementation.
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(Message msg) {
|
public boolean handleMessage(Message msg) {
|
||||||
try {
|
try {
|
||||||
@ -335,8 +336,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareInternal(MediaSource mediaSource, boolean resetPosition)
|
private void prepareInternal(MediaSource mediaSource, boolean resetPosition) {
|
||||||
throws ExoPlaybackException {
|
|
||||||
resetInternal();
|
resetInternal();
|
||||||
loadControl.onPrepared();
|
loadControl.onPrepared();
|
||||||
if (resetPosition) {
|
if (resetPosition) {
|
||||||
@ -884,8 +884,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void attemptRestart(Timeline newTimeline, Timeline oldTimeline,
|
private void attemptRestart(Timeline newTimeline, Timeline oldTimeline, int oldPeriodIndex) {
|
||||||
int oldPeriodIndex) throws ExoPlaybackException {
|
|
||||||
int newPeriodIndex = C.INDEX_UNSET;
|
int newPeriodIndex = C.INDEX_UNSET;
|
||||||
while (newPeriodIndex == C.INDEX_UNSET
|
while (newPeriodIndex == C.INDEX_UNSET
|
||||||
&& oldPeriodIndex < oldTimeline.getPeriodCount() - 1) {
|
&& oldPeriodIndex < oldTimeline.getPeriodCount() - 1) {
|
||||||
@ -1260,7 +1259,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long updatePeriodTrackSelection(long positionUs, LoadControl loadControl,
|
public long updatePeriodTrackSelection(long positionUs, LoadControl loadControl,
|
||||||
boolean forceRecreateStreams, boolean[] streamResetFlags) throws ExoPlaybackException {
|
boolean forceRecreateStreams, boolean[] streamResetFlags) {
|
||||||
for (int i = 0; i < trackSelections.length; i++) {
|
for (int i = 0; i < trackSelections.length; i++) {
|
||||||
mayRetainStreamFlags[i] = !forceRecreateStreams
|
mayRetainStreamFlags[i] = !forceRecreateStreams
|
||||||
&& Util.areEqual(periodTrackSelections == null ? null : periodTrackSelections.get(i),
|
&& Util.areEqual(periodTrackSelections == null ? null : periodTrackSelections.get(i),
|
||||||
|
@ -23,6 +23,7 @@ import android.os.ConditionVariable;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
|
import com.google.android.exoplayer2.Format;
|
||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
@ -981,6 +982,9 @@ public final class AudioTrack {
|
|||||||
case C.ENCODING_PCM_32BIT:
|
case C.ENCODING_PCM_32BIT:
|
||||||
resampledSize = size / 2;
|
resampledSize = size / 2;
|
||||||
break;
|
break;
|
||||||
|
case C.ENCODING_PCM_16BIT:
|
||||||
|
case C.ENCODING_INVALID:
|
||||||
|
case Format.NO_VALUE:
|
||||||
default:
|
default:
|
||||||
// Never happens.
|
// Never happens.
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
@ -1016,6 +1020,9 @@ public final class AudioTrack {
|
|||||||
resampledBuffer.put(buffer.get(i + 3));
|
resampledBuffer.put(buffer.get(i + 3));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case C.ENCODING_PCM_16BIT:
|
||||||
|
case C.ENCODING_INVALID:
|
||||||
|
case Format.NO_VALUE:
|
||||||
default:
|
default:
|
||||||
// Never happens.
|
// Never happens.
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
@ -76,7 +76,8 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
* has obtained the keys necessary to decrypt encrypted regions of the media.
|
* has obtained the keys necessary to decrypt encrypted regions of the media.
|
||||||
*/
|
*/
|
||||||
public MediaCodecAudioRenderer(MediaCodecSelector mediaCodecSelector,
|
public MediaCodecAudioRenderer(MediaCodecSelector mediaCodecSelector,
|
||||||
DrmSessionManager drmSessionManager, boolean playClearSamplesWithoutKeys) {
|
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
|
||||||
|
boolean playClearSamplesWithoutKeys) {
|
||||||
this(mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys, null, null);
|
this(mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import java.io.IOException;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Extractor#sniff
|
* @see com.google.android.exoplayer2.extractor.Extractor#sniff(ExtractorInput)
|
||||||
*/
|
*/
|
||||||
public boolean sniff(ExtractorInput input) throws IOException, InterruptedException {
|
public boolean sniff(ExtractorInput input) throws IOException, InterruptedException {
|
||||||
long inputLength = input.getLength();
|
long inputLength = input.getLength();
|
||||||
|
@ -26,7 +26,7 @@ import com.google.android.exoplayer2.util.Assertions;
|
|||||||
/* package */ final class VorbisBitArray {
|
/* package */ final class VorbisBitArray {
|
||||||
|
|
||||||
public final byte[] data;
|
public final byte[] data;
|
||||||
private int limit;
|
private final int limit;
|
||||||
private int byteOffset;
|
private int byteOffset;
|
||||||
private int bitOffset;
|
private int bitOffset;
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ public final class RawCcExtractor implements Extractor {
|
|||||||
|
|
||||||
private final ParsableByteArray dataScratch;
|
private final ParsableByteArray dataScratch;
|
||||||
|
|
||||||
private ExtractorOutput extractorOutput;
|
|
||||||
private TrackOutput trackOutput;
|
private TrackOutput trackOutput;
|
||||||
|
|
||||||
private int parserState;
|
private int parserState;
|
||||||
@ -63,10 +62,9 @@ public final class RawCcExtractor implements Extractor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(ExtractorOutput output) {
|
public void init(ExtractorOutput output) {
|
||||||
this.extractorOutput = output;
|
output.seekMap(new SeekMap.Unseekable(C.TIME_UNSET));
|
||||||
extractorOutput.seekMap(new SeekMap.Unseekable(C.TIME_UNSET));
|
trackOutput = output.track(0);
|
||||||
trackOutput = extractorOutput.track(0);
|
output.endTracks();
|
||||||
extractorOutput.endTracks();
|
|
||||||
|
|
||||||
trackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608,
|
trackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608,
|
||||||
null, Format.NO_VALUE, 0, null, null));
|
null, Format.NO_VALUE, 0, null, null));
|
||||||
|
@ -23,6 +23,7 @@ import android.media.MediaCodecList;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
import com.google.android.exoplayer2.util.Util;
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -63,8 +64,8 @@ public final class MediaCodecUtil {
|
|||||||
|
|
||||||
// Codecs to constant mappings.
|
// Codecs to constant mappings.
|
||||||
// AVC.
|
// AVC.
|
||||||
private static final Map<Integer, Integer> AVC_PROFILE_NUMBER_TO_CONST;
|
private static final SparseIntArray AVC_PROFILE_NUMBER_TO_CONST;
|
||||||
private static final Map<Integer, Integer> AVC_LEVEL_NUMBER_TO_CONST;
|
private static final SparseIntArray AVC_LEVEL_NUMBER_TO_CONST;
|
||||||
private static final String CODEC_ID_AVC1 = "avc1";
|
private static final String CODEC_ID_AVC1 = "avc1";
|
||||||
private static final String CODEC_ID_AVC2 = "avc2";
|
private static final String CODEC_ID_AVC2 = "avc2";
|
||||||
// HEVC.
|
// HEVC.
|
||||||
@ -364,8 +365,8 @@ public final class MediaCodecUtil {
|
|||||||
Log.w(TAG, "Ignoring malformed AVC codec string: " + codec);
|
Log.w(TAG, "Ignoring malformed AVC codec string: " + codec);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Integer profileInteger = null;
|
Integer profileInteger;
|
||||||
Integer levelInteger = null;
|
Integer levelInteger;
|
||||||
try {
|
try {
|
||||||
if (codecsParts[1].length() == 6) {
|
if (codecsParts[1].length() == 6) {
|
||||||
// Format: avc1.xxccyy, where xx is profile and yy level, both hexadecimal.
|
// Format: avc1.xxccyy, where xx is profile and yy level, both hexadecimal.
|
||||||
@ -555,13 +556,13 @@ public final class MediaCodecUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AVC_PROFILE_NUMBER_TO_CONST = new HashMap<>();
|
AVC_PROFILE_NUMBER_TO_CONST = new SparseIntArray();
|
||||||
AVC_PROFILE_NUMBER_TO_CONST.put(66, CodecProfileLevel.AVCProfileBaseline);
|
AVC_PROFILE_NUMBER_TO_CONST.put(66, CodecProfileLevel.AVCProfileBaseline);
|
||||||
AVC_PROFILE_NUMBER_TO_CONST.put(77, CodecProfileLevel.AVCProfileMain);
|
AVC_PROFILE_NUMBER_TO_CONST.put(77, CodecProfileLevel.AVCProfileMain);
|
||||||
AVC_PROFILE_NUMBER_TO_CONST.put(88, CodecProfileLevel.AVCProfileExtended);
|
AVC_PROFILE_NUMBER_TO_CONST.put(88, CodecProfileLevel.AVCProfileExtended);
|
||||||
AVC_PROFILE_NUMBER_TO_CONST.put(100, CodecProfileLevel.AVCProfileHigh);
|
AVC_PROFILE_NUMBER_TO_CONST.put(100, CodecProfileLevel.AVCProfileHigh);
|
||||||
|
|
||||||
AVC_LEVEL_NUMBER_TO_CONST = new HashMap<>();
|
AVC_LEVEL_NUMBER_TO_CONST = new SparseIntArray();
|
||||||
AVC_LEVEL_NUMBER_TO_CONST.put(10, CodecProfileLevel.AVCLevel1);
|
AVC_LEVEL_NUMBER_TO_CONST.put(10, CodecProfileLevel.AVCLevel1);
|
||||||
// TODO: Find int for CodecProfileLevel.AVCLevel1b.
|
// TODO: Find int for CodecProfileLevel.AVCLevel1b.
|
||||||
AVC_LEVEL_NUMBER_TO_CONST.put(11, CodecProfileLevel.AVCLevel11);
|
AVC_LEVEL_NUMBER_TO_CONST.put(11, CodecProfileLevel.AVCLevel11);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.metadata.id3;
|
package com.google.android.exoplayer2.metadata.id3;
|
||||||
|
|
||||||
import com.google.android.exoplayer2.ParserException;
|
|
||||||
import com.google.android.exoplayer2.metadata.MetadataDecoder;
|
import com.google.android.exoplayer2.metadata.MetadataDecoder;
|
||||||
import com.google.android.exoplayer2.metadata.MetadataDecoderException;
|
import com.google.android.exoplayer2.metadata.MetadataDecoderException;
|
||||||
import com.google.android.exoplayer2.util.MimeTypes;
|
import com.google.android.exoplayer2.util.MimeTypes;
|
||||||
@ -124,7 +123,7 @@ public final class Id3Decoder implements MetadataDecoder<List<Id3Frame>> {
|
|||||||
/**
|
/**
|
||||||
* @param id3Buffer A {@link ParsableByteArray} from which data should be read.
|
* @param id3Buffer A {@link ParsableByteArray} from which data should be read.
|
||||||
* @return The size of ID3 frames in bytes, excluding the header and footer.
|
* @return The size of ID3 frames in bytes, excluding the header and footer.
|
||||||
* @throws ParserException If ID3 file identifier != "ID3".
|
* @throws MetadataDecoderException If ID3 file identifier != "ID3".
|
||||||
*/
|
*/
|
||||||
private static int decodeId3Header(ParsableByteArray id3Buffer) throws MetadataDecoderException {
|
private static int decodeId3Header(ParsableByteArray id3Buffer) throws MetadataDecoderException {
|
||||||
int id1 = id3Buffer.readUnsignedByte();
|
int id1 = id3Buffer.readUnsignedByte();
|
||||||
|
@ -149,9 +149,9 @@ import java.util.IdentityHashMap;
|
|||||||
}
|
}
|
||||||
// It must be possible to seek enabled periods to the new position, if there is one.
|
// It must be possible to seek enabled periods to the new position, if there is one.
|
||||||
if (positionUs != C.TIME_UNSET) {
|
if (positionUs != C.TIME_UNSET) {
|
||||||
for (int i = 0; i < enabledPeriods.length; i++) {
|
for (MediaPeriod enabledPeriod : enabledPeriods) {
|
||||||
if (enabledPeriods[i] != periods[0]
|
if (enabledPeriod != periods[0]
|
||||||
&& enabledPeriods[i].seekToUs(positionUs) != positionUs) {
|
&& enabledPeriod.seekToUs(positionUs) != positionUs) {
|
||||||
throw new IllegalStateException("Children seeked to different positions");
|
throw new IllegalStateException("Children seeked to different positions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ import java.util.List;
|
|||||||
private int pendingPrepareCount;
|
private int pendingPrepareCount;
|
||||||
private HlsPlaylist playlist;
|
private HlsPlaylist playlist;
|
||||||
private boolean seenFirstTrackSelection;
|
private boolean seenFirstTrackSelection;
|
||||||
private long durationUs;
|
|
||||||
private boolean isLive;
|
private boolean isLive;
|
||||||
private TrackGroupArray trackGroups;
|
private TrackGroupArray trackGroups;
|
||||||
private HlsSampleStreamWrapper[] sampleStreamWrappers;
|
private HlsSampleStreamWrapper[] sampleStreamWrappers;
|
||||||
@ -280,7 +279,7 @@ import java.util.List;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The wrapper at index 0 is the one of type TRACK_TYPE_DEFAULT.
|
// The wrapper at index 0 is the one of type TRACK_TYPE_DEFAULT.
|
||||||
durationUs = sampleStreamWrappers[0].getDurationUs();
|
long durationUs = sampleStreamWrappers[0].getDurationUs();
|
||||||
isLive = sampleStreamWrappers[0].isLive();
|
isLive = sampleStreamWrappers[0].isLive();
|
||||||
|
|
||||||
int totalTrackGroupCount = 0;
|
int totalTrackGroupCount = 0;
|
||||||
|
@ -20,7 +20,7 @@ package com.google.android.exoplayer2.text;
|
|||||||
*/
|
*/
|
||||||
/* package */ final class SimpleSubtitleOutputBuffer extends SubtitleOutputBuffer {
|
/* package */ final class SimpleSubtitleOutputBuffer extends SubtitleOutputBuffer {
|
||||||
|
|
||||||
private SimpleSubtitleDecoder owner;
|
private final SimpleSubtitleDecoder owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param owner The decoder that owns this buffer.
|
* @param owner The decoder that owns this buffer.
|
||||||
|
@ -28,6 +28,7 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
|
|||||||
public final class Cea608Decoder extends CeaDecoder {
|
public final class Cea608Decoder extends CeaDecoder {
|
||||||
|
|
||||||
private static final int NTSC_CC_FIELD_1 = 0x00;
|
private static final int NTSC_CC_FIELD_1 = 0x00;
|
||||||
|
private static final int CC_TYPE_MASK = 0x03;
|
||||||
private static final int CC_VALID_FLAG = 0x04;
|
private static final int CC_VALID_FLAG = 0x04;
|
||||||
|
|
||||||
private static final int PAYLOAD_TYPE_CC = 4;
|
private static final int PAYLOAD_TYPE_CC = 4;
|
||||||
@ -223,7 +224,8 @@ public final class Cea608Decoder extends CeaDecoder {
|
|||||||
byte ccData2 = (byte) (ccData.readUnsignedByte() & 0x7F);
|
byte ccData2 = (byte) (ccData.readUnsignedByte() & 0x7F);
|
||||||
|
|
||||||
// Only examine valid NTSC_CC_FIELD_1 packets
|
// Only examine valid NTSC_CC_FIELD_1 packets
|
||||||
if (ccTypeAndValid != (CC_VALID_FLAG | NTSC_CC_FIELD_1)) {
|
if ((ccTypeAndValid & CC_VALID_FLAG) == 0
|
||||||
|
|| (ccTypeAndValid & CC_TYPE_MASK) != NTSC_CC_FIELD_1) {
|
||||||
// TODO: Add support for NTSC_CC_FIELD_2 packets
|
// TODO: Add support for NTSC_CC_FIELD_2 packets
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -92,21 +92,22 @@ import java.util.Map;
|
|||||||
builder.setSpan(new AlignmentSpan.Standard(style.getTextAlign()), start, end,
|
builder.setSpan(new AlignmentSpan.Standard(style.getTextAlign()), start, end,
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
if (style.getFontSizeUnit() != TtmlStyle.UNSPECIFIED) {
|
switch (style.getFontSizeUnit()) {
|
||||||
switch (style.getFontSizeUnit()) {
|
case TtmlStyle.FONT_SIZE_UNIT_PIXEL:
|
||||||
case TtmlStyle.FONT_SIZE_UNIT_PIXEL:
|
builder.setSpan(new AbsoluteSizeSpan((int) style.getFontSize(), true), start, end,
|
||||||
builder.setSpan(new AbsoluteSizeSpan((int) style.getFontSize(), true), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case TtmlStyle.FONT_SIZE_UNIT_EM:
|
||||||
case TtmlStyle.FONT_SIZE_UNIT_EM:
|
builder.setSpan(new RelativeSizeSpan(style.getFontSize()), start, end,
|
||||||
builder.setSpan(new RelativeSizeSpan(style.getFontSize()), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case TtmlStyle.FONT_SIZE_UNIT_PERCENT:
|
||||||
case TtmlStyle.FONT_SIZE_UNIT_PERCENT:
|
builder.setSpan(new RelativeSizeSpan(style.getFontSize() / 100), start, end,
|
||||||
builder.setSpan(new RelativeSizeSpan(style.getFontSize() / 100), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case TtmlStyle.UNSPECIFIED:
|
||||||
}
|
// Do nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,21 +413,22 @@ import java.util.regex.Pattern;
|
|||||||
spannedText.setSpan(new AlignmentSpan.Standard(style.getTextAlign()), start, end,
|
spannedText.setSpan(new AlignmentSpan.Standard(style.getTextAlign()), start, end,
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
}
|
}
|
||||||
if (style.getFontSizeUnit() != WebvttCssStyle.UNSPECIFIED) {
|
switch (style.getFontSizeUnit()) {
|
||||||
switch (style.getFontSizeUnit()) {
|
case WebvttCssStyle.FONT_SIZE_UNIT_PIXEL:
|
||||||
case WebvttCssStyle.FONT_SIZE_UNIT_PIXEL:
|
spannedText.setSpan(new AbsoluteSizeSpan((int) style.getFontSize(), true), start, end,
|
||||||
spannedText.setSpan(new AbsoluteSizeSpan((int) style.getFontSize(), true), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case WebvttCssStyle.FONT_SIZE_UNIT_EM:
|
||||||
case WebvttCssStyle.FONT_SIZE_UNIT_EM:
|
spannedText.setSpan(new RelativeSizeSpan(style.getFontSize()), start, end,
|
||||||
spannedText.setSpan(new RelativeSizeSpan(style.getFontSize()), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case WebvttCssStyle.FONT_SIZE_UNIT_PERCENT:
|
||||||
case WebvttCssStyle.FONT_SIZE_UNIT_PERCENT:
|
spannedText.setSpan(new RelativeSizeSpan(style.getFontSize() / 100), start, end,
|
||||||
spannedText.setSpan(new RelativeSizeSpan(style.getFontSize() / 100), start, end,
|
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
break;
|
||||||
break;
|
case WebvttCssStyle.UNSPECIFIED:
|
||||||
}
|
// Do nothing.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ public abstract class MappingTrackSelector extends TrackSelector<MappedTrackInfo
|
|||||||
* Returns whether this override contains the specified track index.
|
* Returns whether this override contains the specified track index.
|
||||||
*/
|
*/
|
||||||
public boolean containsTrack(int track) {
|
public boolean containsTrack(int track) {
|
||||||
for (int i = 0; i < tracks.length; i++) {
|
for (int overrideTrack : tracks) {
|
||||||
if (tracks[i] == track) {
|
if (overrideTrack == track) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public final class RawResourceDataSource implements DataSource {
|
|||||||
* @param rawResourceId A raw resource identifier (i.e. a constant defined in {@code R.raw}).
|
* @param rawResourceId A raw resource identifier (i.e. a constant defined in {@code R.raw}).
|
||||||
* @return The corresponding {@link Uri}.
|
* @return The corresponding {@link Uri}.
|
||||||
*/
|
*/
|
||||||
public static final Uri buildRawResourceUri(int rawResourceId) {
|
public static Uri buildRawResourceUri(int rawResourceId) {
|
||||||
return Uri.parse(RAW_RESOURCE_SCHEME + ":///" + rawResourceId);
|
return Uri.parse(RAW_RESOURCE_SCHEME + ":///" + rawResourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
@ -37,6 +38,7 @@
|
|||||||
style="@style/ExoMediaButton.Rewind"/>
|
style="@style/ExoMediaButton.Rewind"/>
|
||||||
|
|
||||||
<ImageButton android:id="@+id/play"
|
<ImageButton android:id="@+id/play"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
style="@style/ExoMediaButton"/>
|
style="@style/ExoMediaButton"/>
|
||||||
|
|
||||||
<ImageButton android:id="@+id/ffwd"
|
<ImageButton android:id="@+id/ffwd"
|
||||||
|
@ -28,6 +28,7 @@ import com.google.android.exoplayer2.ExoPlaybackException;
|
|||||||
import com.google.android.exoplayer2.ExoPlayer;
|
import com.google.android.exoplayer2.ExoPlayer;
|
||||||
import com.google.android.exoplayer2.RendererCapabilities;
|
import com.google.android.exoplayer2.RendererCapabilities;
|
||||||
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
||||||
|
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
|
||||||
import com.google.android.exoplayer2.drm.HttpMediaDrmCallback;
|
import com.google.android.exoplayer2.drm.HttpMediaDrmCallback;
|
||||||
import com.google.android.exoplayer2.drm.StreamingDrmSessionManager;
|
import com.google.android.exoplayer2.drm.StreamingDrmSessionManager;
|
||||||
import com.google.android.exoplayer2.drm.UnsupportedDrmException;
|
import com.google.android.exoplayer2.drm.UnsupportedDrmException;
|
||||||
@ -696,8 +697,9 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
|
|||||||
@Override
|
@Override
|
||||||
@TargetApi(18)
|
@TargetApi(18)
|
||||||
@SuppressWarnings("ResourceType")
|
@SuppressWarnings("ResourceType")
|
||||||
protected final StreamingDrmSessionManager buildDrmSessionManager(final String userAgent) {
|
protected final StreamingDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
|
||||||
StreamingDrmSessionManager drmSessionManager = null;
|
final String userAgent) {
|
||||||
|
StreamingDrmSessionManager<FrameworkMediaCrypto> drmSessionManager = null;
|
||||||
if (isWidevineEncrypted) {
|
if (isWidevineEncrypted) {
|
||||||
try {
|
try {
|
||||||
// Force L3 if secure decoder is not available.
|
// Force L3 if secure decoder is not available.
|
||||||
|
@ -30,6 +30,7 @@ import com.google.android.exoplayer2.audio.AudioRendererEventListener;
|
|||||||
import com.google.android.exoplayer2.audio.AudioTrack;
|
import com.google.android.exoplayer2.audio.AudioTrack;
|
||||||
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
import com.google.android.exoplayer2.decoder.DecoderCounters;
|
||||||
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
import com.google.android.exoplayer2.drm.DrmSessionManager;
|
||||||
|
import com.google.android.exoplayer2.drm.FrameworkMediaCrypto;
|
||||||
import com.google.android.exoplayer2.playbacktests.util.HostActivity.HostedTest;
|
import com.google.android.exoplayer2.playbacktests.util.HostActivity.HostedTest;
|
||||||
import com.google.android.exoplayer2.source.MediaSource;
|
import com.google.android.exoplayer2.source.MediaSource;
|
||||||
import com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection;
|
import com.google.android.exoplayer2.trackselection.AdaptiveVideoTrackSelection;
|
||||||
@ -130,7 +131,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
|
|||||||
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
|
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
|
||||||
trackSelector = buildTrackSelector(host, bandwidthMeter);
|
trackSelector = buildTrackSelector(host, bandwidthMeter);
|
||||||
String userAgent = "ExoPlayerPlaybackTests";
|
String userAgent = "ExoPlayerPlaybackTests";
|
||||||
DrmSessionManager drmSessionManager = buildDrmSessionManager(userAgent);
|
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager = buildDrmSessionManager(userAgent);
|
||||||
player = buildExoPlayer(host, surface, trackSelector, drmSessionManager);
|
player = buildExoPlayer(host, surface, trackSelector, drmSessionManager);
|
||||||
player.prepare(buildSource(host, Util.getUserAgent(host, userAgent), bandwidthMeter));
|
player.prepare(buildSource(host, Util.getUserAgent(host, userAgent), bandwidthMeter));
|
||||||
player.addListener(this);
|
player.addListener(this);
|
||||||
@ -296,7 +297,7 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
|
|||||||
|
|
||||||
// Internal logic
|
// Internal logic
|
||||||
|
|
||||||
protected DrmSessionManager buildDrmSessionManager(String userAgent) {
|
protected DrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(String userAgent) {
|
||||||
// Do nothing. Interested subclasses may override.
|
// Do nothing. Interested subclasses may override.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -309,7 +310,8 @@ public abstract class ExoHostedTest implements HostedTest, ExoPlayer.EventListen
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected SimpleExoPlayer buildExoPlayer(HostActivity host, Surface surface,
|
protected SimpleExoPlayer buildExoPlayer(HostActivity host, Surface surface,
|
||||||
MappingTrackSelector trackSelector, DrmSessionManager drmSessionManager) {
|
MappingTrackSelector trackSelector,
|
||||||
|
DrmSessionManager<FrameworkMediaCrypto> drmSessionManager) {
|
||||||
SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(host, trackSelector,
|
SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(host, trackSelector,
|
||||||
new DefaultLoadControl(), drmSessionManager, false, 0);
|
new DefaultLoadControl(), drmSessionManager, false, 0);
|
||||||
player.setVideoSurface(surface);
|
player.setVideoSurface(surface);
|
||||||
|
@ -232,7 +232,7 @@ public final class HostActivity extends Activity implements SurfaceHolder.Callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
private static final int getWifiLockMode() {
|
private static int getWifiLockMode() {
|
||||||
return Util.SDK_INT < 12 ? WifiManager.WIFI_MODE_FULL : WifiManager.WIFI_MODE_FULL_HIGH_PERF;
|
return Util.SDK_INT < 12 ? WifiManager.WIFI_MODE_FULL : WifiManager.WIFI_MODE_FULL_HIGH_PERF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user