Fix all error-prone, style, optional suggestion, etc. issues.
This fixes or suppresses all reported issues by the code review linter tools. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=210107759
This commit is contained in:
parent
ff1812d3fe
commit
d0161ad18b
@ -18,6 +18,7 @@ package com.google.android.exoplayer2.ext.cronet;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.IntDef;
|
import android.support.annotation.IntDef;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -159,6 +160,8 @@ public final class CronetEngineWrapper {
|
|||||||
private final String gmsCoreCronetName;
|
private final String gmsCoreCronetName;
|
||||||
private final boolean preferGMSCoreCronet;
|
private final boolean preferGMSCoreCronet;
|
||||||
|
|
||||||
|
// Multi-catch can only be used for API 19+ in this case.
|
||||||
|
@SuppressWarnings("UseMultiCatch")
|
||||||
public CronetProviderComparator(boolean preferGMSCoreCronet) {
|
public CronetProviderComparator(boolean preferGMSCoreCronet) {
|
||||||
// GMSCore CronetProvider classes are only available in some configurations.
|
// GMSCore CronetProvider classes are only available in some configurations.
|
||||||
// Thus, we use reflection to copy static name.
|
// Thus, we use reflection to copy static name.
|
||||||
@ -219,8 +222,8 @@ public final class CronetEngineWrapper {
|
|||||||
if (versionLeft == null || versionRight == null) {
|
if (versionLeft == null || versionRight == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
String[] versionStringsLeft = versionLeft.split("\\.");
|
String[] versionStringsLeft = Util.split(versionLeft, "\\.");
|
||||||
String[] versionStringsRight = versionRight.split("\\.");
|
String[] versionStringsRight = Util.split(versionRight, "\\.");
|
||||||
int minLength = Math.min(versionStringsLeft.length, versionStringsRight.length);
|
int minLength = Math.min(versionStringsLeft.length, versionStringsRight.length);
|
||||||
for (int i = 0; i < minLength; i++) {
|
for (int i = 0; i < minLength; i++) {
|
||||||
if (!versionStringsLeft[i].equals(versionStringsRight[i])) {
|
if (!versionStringsLeft[i].equals(versionStringsRight[i])) {
|
||||||
|
@ -60,7 +60,7 @@ public final class ByteArrayUploadDataProviderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadPartialBuffer() throws IOException {
|
public void testReadPartialBuffer() throws IOException {
|
||||||
byte[] firstHalf = Arrays.copyOfRange(TEST_DATA, 0, TEST_DATA.length / 2);
|
byte[] firstHalf = Arrays.copyOf(TEST_DATA, TEST_DATA.length / 2);
|
||||||
byte[] secondHalf = Arrays.copyOfRange(TEST_DATA, TEST_DATA.length / 2, TEST_DATA.length);
|
byte[] secondHalf = Arrays.copyOfRange(TEST_DATA, TEST_DATA.length / 2, TEST_DATA.length);
|
||||||
byteBuffer = ByteBuffer.allocate(TEST_DATA.length / 2);
|
byteBuffer = ByteBuffer.allocate(TEST_DATA.length / 2);
|
||||||
// Read half of the data.
|
// Read half of the data.
|
||||||
|
@ -38,6 +38,7 @@ import com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceExcep
|
|||||||
import com.google.android.exoplayer2.upstream.TransferListener;
|
import com.google.android.exoplayer2.upstream.TransferListener;
|
||||||
import com.google.android.exoplayer2.util.Clock;
|
import com.google.android.exoplayer2.util.Clock;
|
||||||
import com.google.android.exoplayer2.util.Predicate;
|
import com.google.android.exoplayer2.util.Predicate;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
@ -50,6 +51,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import org.chromium.net.CronetEngine;
|
import org.chromium.net.CronetEngine;
|
||||||
import org.chromium.net.NetworkException;
|
import org.chromium.net.NetworkException;
|
||||||
import org.chromium.net.UrlRequest;
|
import org.chromium.net.UrlRequest;
|
||||||
@ -61,7 +63,6 @@ import org.junit.runner.RunWith;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.shadows.ShadowSystemClock;
|
|
||||||
|
|
||||||
/** Tests for {@link CronetDataSource}. */
|
/** Tests for {@link CronetDataSource}. */
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
@ -71,7 +72,7 @@ public final class CronetDataSourceTest {
|
|||||||
private static final int TEST_READ_TIMEOUT_MS = 100;
|
private static final int TEST_READ_TIMEOUT_MS = 100;
|
||||||
private static final String TEST_URL = "http://google.com";
|
private static final String TEST_URL = "http://google.com";
|
||||||
private static final String TEST_CONTENT_TYPE = "test/test";
|
private static final String TEST_CONTENT_TYPE = "test/test";
|
||||||
private static final byte[] TEST_POST_BODY = "test post body".getBytes();
|
private static final byte[] TEST_POST_BODY = Util.getUtf8Bytes("test post body");
|
||||||
private static final long TEST_CONTENT_LENGTH = 16000L;
|
private static final long TEST_CONTENT_LENGTH = 16000L;
|
||||||
private static final int TEST_CONNECTION_STATUS = 5;
|
private static final int TEST_CONNECTION_STATUS = 5;
|
||||||
private static final int TEST_INVALID_CONNECTION_STATUS = -1;
|
private static final int TEST_INVALID_CONNECTION_STATUS = -1;
|
||||||
@ -577,10 +578,10 @@ public final class CronetDataSourceTest {
|
|||||||
// We should still be trying to open.
|
// We should still be trying to open.
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// We should still be trying to open as we approach the timeout.
|
// We should still be trying to open as we approach the timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// Now we timeout.
|
// Now we timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS + 10);
|
SystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS + 10);
|
||||||
timedOutLatch.await();
|
timedOutLatch.await();
|
||||||
|
|
||||||
verify(mockTransferListener, never())
|
verify(mockTransferListener, never())
|
||||||
@ -616,7 +617,7 @@ public final class CronetDataSourceTest {
|
|||||||
// We should still be trying to open.
|
// We should still be trying to open.
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// We should still be trying to open as we approach the timeout.
|
// We should still be trying to open as we approach the timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// Now we interrupt.
|
// Now we interrupt.
|
||||||
thread.interrupt();
|
thread.interrupt();
|
||||||
@ -632,14 +633,16 @@ public final class CronetDataSourceTest {
|
|||||||
final ConditionVariable startCondition = buildUrlRequestStartedCondition();
|
final ConditionVariable startCondition = buildUrlRequestStartedCondition();
|
||||||
final CountDownLatch openLatch = new CountDownLatch(1);
|
final CountDownLatch openLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
AtomicReference<Exception> exceptionOnTestThread = new AtomicReference<>();
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
dataSourceUnderTest.open(testDataSpec);
|
dataSourceUnderTest.open(testDataSpec);
|
||||||
openLatch.countDown();
|
|
||||||
} catch (HttpDataSourceException e) {
|
} catch (HttpDataSourceException e) {
|
||||||
fail();
|
exceptionOnTestThread.set(e);
|
||||||
|
} finally {
|
||||||
|
openLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
@ -648,11 +651,12 @@ public final class CronetDataSourceTest {
|
|||||||
// We should still be trying to open.
|
// We should still be trying to open.
|
||||||
assertNotCountedDown(openLatch);
|
assertNotCountedDown(openLatch);
|
||||||
// We should still be trying to open as we approach the timeout.
|
// We should still be trying to open as we approach the timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
||||||
assertNotCountedDown(openLatch);
|
assertNotCountedDown(openLatch);
|
||||||
// The response arrives just in time.
|
// The response arrives just in time.
|
||||||
dataSourceUnderTest.urlRequestCallback.onResponseStarted(mockUrlRequest, testUrlResponseInfo);
|
dataSourceUnderTest.urlRequestCallback.onResponseStarted(mockUrlRequest, testUrlResponseInfo);
|
||||||
openLatch.await();
|
openLatch.await();
|
||||||
|
assertThat(exceptionOnTestThread.get()).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -682,14 +686,14 @@ public final class CronetDataSourceTest {
|
|||||||
// We should still be trying to open.
|
// We should still be trying to open.
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// We should still be trying to open as we approach the timeout.
|
// We should still be trying to open as we approach the timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + TEST_CONNECT_TIMEOUT_MS - 1);
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// A redirect arrives just in time.
|
// A redirect arrives just in time.
|
||||||
dataSourceUnderTest.urlRequestCallback.onRedirectReceived(
|
dataSourceUnderTest.urlRequestCallback.onRedirectReceived(
|
||||||
mockUrlRequest, testUrlResponseInfo, "RandomRedirectedUrl1");
|
mockUrlRequest, testUrlResponseInfo, "RandomRedirectedUrl1");
|
||||||
|
|
||||||
long newTimeoutMs = 2 * TEST_CONNECT_TIMEOUT_MS - 1;
|
long newTimeoutMs = 2 * TEST_CONNECT_TIMEOUT_MS - 1;
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs - 1);
|
||||||
// We should still be trying to open as we approach the new timeout.
|
// We should still be trying to open as we approach the new timeout.
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// A redirect arrives just in time.
|
// A redirect arrives just in time.
|
||||||
@ -697,11 +701,11 @@ public final class CronetDataSourceTest {
|
|||||||
mockUrlRequest, testUrlResponseInfo, "RandomRedirectedUrl2");
|
mockUrlRequest, testUrlResponseInfo, "RandomRedirectedUrl2");
|
||||||
|
|
||||||
newTimeoutMs = 3 * TEST_CONNECT_TIMEOUT_MS - 2;
|
newTimeoutMs = 3 * TEST_CONNECT_TIMEOUT_MS - 2;
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs - 1);
|
SystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs - 1);
|
||||||
// We should still be trying to open as we approach the new timeout.
|
// We should still be trying to open as we approach the new timeout.
|
||||||
assertNotCountedDown(timedOutLatch);
|
assertNotCountedDown(timedOutLatch);
|
||||||
// Now we timeout.
|
// Now we timeout.
|
||||||
ShadowSystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs + 10);
|
SystemClock.setCurrentTimeMillis(startTimeMs + newTimeoutMs + 10);
|
||||||
timedOutLatch.await();
|
timedOutLatch.await();
|
||||||
|
|
||||||
verify(mockTransferListener, never())
|
verify(mockTransferListener, never())
|
||||||
|
@ -50,20 +50,16 @@ public class FlacPlaybackTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicPlayback() throws ExoPlaybackException {
|
public void testBasicPlayback() throws Exception {
|
||||||
playUri(BEAR_FLAC_URI);
|
playUri(BEAR_FLAC_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playUri(String uri) throws ExoPlaybackException {
|
private void playUri(String uri) throws Exception {
|
||||||
TestPlaybackRunnable testPlaybackRunnable =
|
TestPlaybackRunnable testPlaybackRunnable =
|
||||||
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
||||||
Thread thread = new Thread(testPlaybackRunnable);
|
Thread thread = new Thread(testPlaybackRunnable);
|
||||||
thread.start();
|
thread.start();
|
||||||
try {
|
|
||||||
thread.join();
|
thread.join();
|
||||||
} catch (InterruptedException e) {
|
|
||||||
fail(); // Should never happen.
|
|
||||||
}
|
|
||||||
if (testPlaybackRunnable.playbackException != null) {
|
if (testPlaybackRunnable.playbackException != null) {
|
||||||
throw testPlaybackRunnable.playbackException;
|
throw testPlaybackRunnable.playbackException;
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,7 @@ import java.nio.ByteBuffer;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Decodes and consumes the next sample from the FLAC stream into the given byte buffer. */
|
/** Decodes and consumes the next sample from the FLAC stream into the given byte buffer. */
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
public void decodeSample(ByteBuffer output)
|
public void decodeSample(ByteBuffer output)
|
||||||
throws IOException, InterruptedException, FlacFrameDecodeException {
|
throws IOException, InterruptedException, FlacFrameDecodeException {
|
||||||
output.clear();
|
output.clear();
|
||||||
|
@ -46,13 +46,13 @@ public final class DefaultExtractorsFactoryTest {
|
|||||||
DefaultExtractorsFactory defaultExtractorsFactory = new DefaultExtractorsFactory();
|
DefaultExtractorsFactory defaultExtractorsFactory = new DefaultExtractorsFactory();
|
||||||
|
|
||||||
Extractor[] extractors = defaultExtractorsFactory.createExtractors();
|
Extractor[] extractors = defaultExtractorsFactory.createExtractors();
|
||||||
List<Class> listCreatedExtractorClasses = new ArrayList<>();
|
List<Class<?>> listCreatedExtractorClasses = new ArrayList<>();
|
||||||
for (Extractor extractor : extractors) {
|
for (Extractor extractor : extractors) {
|
||||||
listCreatedExtractorClasses.add(extractor.getClass());
|
listCreatedExtractorClasses.add(extractor.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
Class[] expectedExtractorClassses =
|
Class<?>[] expectedExtractorClassses =
|
||||||
new Class[] {
|
new Class<?>[] {
|
||||||
MatroskaExtractor.class,
|
MatroskaExtractor.class,
|
||||||
FragmentedMp4Extractor.class,
|
FragmentedMp4Extractor.class,
|
||||||
Mp4Extractor.class,
|
Mp4Extractor.class,
|
||||||
|
@ -27,9 +27,9 @@ import java.util.ArrayList;
|
|||||||
private final ArrayList<Player.EventListener> listeners;
|
private final ArrayList<Player.EventListener> listeners;
|
||||||
private final Timeline.Window window;
|
private final Timeline.Window window;
|
||||||
private final Timeline.Period period;
|
private final Timeline.Period period;
|
||||||
|
private final Timeline timeline;
|
||||||
|
|
||||||
private boolean prepared;
|
private boolean prepared;
|
||||||
private Timeline timeline;
|
|
||||||
private int state;
|
private int state;
|
||||||
private boolean playWhenReady;
|
private boolean playWhenReady;
|
||||||
private long position;
|
private long position;
|
||||||
|
@ -23,7 +23,6 @@ import com.firebase.jobdispatcher.Constraint;
|
|||||||
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
|
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
|
||||||
import com.firebase.jobdispatcher.GooglePlayDriver;
|
import com.firebase.jobdispatcher.GooglePlayDriver;
|
||||||
import com.firebase.jobdispatcher.Job;
|
import com.firebase.jobdispatcher.Job;
|
||||||
import com.firebase.jobdispatcher.Job.Builder;
|
|
||||||
import com.firebase.jobdispatcher.JobParameters;
|
import com.firebase.jobdispatcher.JobParameters;
|
||||||
import com.firebase.jobdispatcher.JobService;
|
import com.firebase.jobdispatcher.JobService;
|
||||||
import com.firebase.jobdispatcher.Lifetime;
|
import com.firebase.jobdispatcher.Lifetime;
|
||||||
@ -99,7 +98,7 @@ public final class JobDispatcherScheduler implements Scheduler {
|
|||||||
String tag,
|
String tag,
|
||||||
String serviceAction,
|
String serviceAction,
|
||||||
String servicePackage) {
|
String servicePackage) {
|
||||||
Builder builder =
|
Job.Builder builder =
|
||||||
dispatcher
|
dispatcher
|
||||||
.newJobBuilder()
|
.newJobBuilder()
|
||||||
.setService(JobDispatcherSchedulerService.class) // the JobService that will be called
|
.setService(JobDispatcherSchedulerService.class) // the JobService that will be called
|
||||||
|
@ -161,8 +161,8 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
|
|||||||
responseBody = Assertions.checkNotNull(response.body());
|
responseBody = Assertions.checkNotNull(response.body());
|
||||||
responseByteStream = responseBody.byteStream();
|
responseByteStream = responseBody.byteStream();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new HttpDataSourceException("Unable to connect to " + dataSpec.uri.toString(), e,
|
throw new HttpDataSourceException(
|
||||||
dataSpec, HttpDataSourceException.TYPE_OPEN);
|
"Unable to connect to " + dataSpec.uri, e, dataSpec, HttpDataSourceException.TYPE_OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int responseCode = response.code();
|
int responseCode = response.code();
|
||||||
|
@ -50,20 +50,16 @@ public class OpusPlaybackTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicPlayback() throws ExoPlaybackException {
|
public void testBasicPlayback() throws Exception {
|
||||||
playUri(BEAR_OPUS_URI);
|
playUri(BEAR_OPUS_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playUri(String uri) throws ExoPlaybackException {
|
private void playUri(String uri) throws Exception {
|
||||||
TestPlaybackRunnable testPlaybackRunnable =
|
TestPlaybackRunnable testPlaybackRunnable =
|
||||||
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
||||||
Thread thread = new Thread(testPlaybackRunnable);
|
Thread thread = new Thread(testPlaybackRunnable);
|
||||||
thread.start();
|
thread.start();
|
||||||
try {
|
|
||||||
thread.join();
|
thread.join();
|
||||||
} catch (InterruptedException e) {
|
|
||||||
fail(); // Should never happen.
|
|
||||||
}
|
|
||||||
if (testPlaybackRunnable.playbackException != null) {
|
if (testPlaybackRunnable.playbackException != null) {
|
||||||
throw testPlaybackRunnable.playbackException;
|
throw testPlaybackRunnable.playbackException;
|
||||||
}
|
}
|
||||||
|
@ -57,17 +57,17 @@ public class VpxPlaybackTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicPlayback() throws ExoPlaybackException {
|
public void testBasicPlayback() throws Exception {
|
||||||
playUri(BEAR_URI);
|
playUri(BEAR_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOddDimensionsPlayback() throws ExoPlaybackException {
|
public void testOddDimensionsPlayback() throws Exception {
|
||||||
playUri(BEAR_ODD_DIMENSIONS_URI);
|
playUri(BEAR_ODD_DIMENSIONS_URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test10BitProfile2Playback() throws ExoPlaybackException {
|
public void test10BitProfile2Playback() throws Exception {
|
||||||
if (VpxLibrary.isHighBitDepthSupported()) {
|
if (VpxLibrary.isHighBitDepthSupported()) {
|
||||||
Log.d(TAG, "High Bit Depth supported.");
|
Log.d(TAG, "High Bit Depth supported.");
|
||||||
playUri(ROADTRIP_10BIT_URI);
|
playUri(ROADTRIP_10BIT_URI);
|
||||||
@ -87,16 +87,12 @@ public class VpxPlaybackTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playUri(String uri) throws ExoPlaybackException {
|
private void playUri(String uri) throws Exception {
|
||||||
TestPlaybackRunnable testPlaybackRunnable =
|
TestPlaybackRunnable testPlaybackRunnable =
|
||||||
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
new TestPlaybackRunnable(Uri.parse(uri), getContext());
|
||||||
Thread thread = new Thread(testPlaybackRunnable);
|
Thread thread = new Thread(testPlaybackRunnable);
|
||||||
thread.start();
|
thread.start();
|
||||||
try {
|
|
||||||
thread.join();
|
thread.join();
|
||||||
} catch (InterruptedException e) {
|
|
||||||
fail(); // Should never happen.
|
|
||||||
}
|
|
||||||
if (testPlaybackRunnable.playbackException != null) {
|
if (testPlaybackRunnable.playbackException != null) {
|
||||||
throw testPlaybackRunnable.playbackException;
|
throw testPlaybackRunnable.playbackException;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ public final class ContentDataSourceTest {
|
|||||||
fail();
|
fail();
|
||||||
} catch (ContentDataSource.ContentDataSourceException e) {
|
} catch (ContentDataSource.ContentDataSourceException e) {
|
||||||
// Expected.
|
// Expected.
|
||||||
assertThat(e.getCause()).isInstanceOf(FileNotFoundException.class);
|
assertThat(e).hasCauseThat().isInstanceOf(FileNotFoundException.class);
|
||||||
} finally {
|
} finally {
|
||||||
dataSource.close();
|
dataSource.close();
|
||||||
}
|
}
|
||||||
|
@ -686,24 +686,20 @@ public final class C {
|
|||||||
public static final int DEFAULT_MUXED_BUFFER_SIZE = DEFAULT_VIDEO_BUFFER_SIZE
|
public static final int DEFAULT_MUXED_BUFFER_SIZE = DEFAULT_VIDEO_BUFFER_SIZE
|
||||||
+ DEFAULT_AUDIO_BUFFER_SIZE + DEFAULT_TEXT_BUFFER_SIZE;
|
+ DEFAULT_AUDIO_BUFFER_SIZE + DEFAULT_TEXT_BUFFER_SIZE;
|
||||||
|
|
||||||
/**
|
/** "cenc" scheme type name as defined in ISO/IEC 23001-7:2016. */
|
||||||
* "cenc" scheme type name as defined in ISO/IEC 23001-7:2016.
|
@SuppressWarnings("ConstantField")
|
||||||
*/
|
|
||||||
public static final String CENC_TYPE_cenc = "cenc";
|
public static final String CENC_TYPE_cenc = "cenc";
|
||||||
|
|
||||||
/**
|
/** "cbc1" scheme type name as defined in ISO/IEC 23001-7:2016. */
|
||||||
* "cbc1" scheme type name as defined in ISO/IEC 23001-7:2016.
|
@SuppressWarnings("ConstantField")
|
||||||
*/
|
|
||||||
public static final String CENC_TYPE_cbc1 = "cbc1";
|
public static final String CENC_TYPE_cbc1 = "cbc1";
|
||||||
|
|
||||||
/**
|
/** "cens" scheme type name as defined in ISO/IEC 23001-7:2016. */
|
||||||
* "cens" scheme type name as defined in ISO/IEC 23001-7:2016.
|
@SuppressWarnings("ConstantField")
|
||||||
*/
|
|
||||||
public static final String CENC_TYPE_cens = "cens";
|
public static final String CENC_TYPE_cens = "cens";
|
||||||
|
|
||||||
/**
|
/** "cbcs" scheme type name as defined in ISO/IEC 23001-7:2016. */
|
||||||
* "cbcs" scheme type name as defined in ISO/IEC 23001-7:2016.
|
@SuppressWarnings("ConstantField")
|
||||||
*/
|
|
||||||
public static final String CENC_TYPE_cbcs = "cbcs";
|
public static final String CENC_TYPE_cbcs = "cbcs";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,6 +191,14 @@ public interface Player {
|
|||||||
*/
|
*/
|
||||||
void clearVideoSurface();
|
void clearVideoSurface();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the {@link Surface} onto which video is being rendered if it matches the one passed.
|
||||||
|
* Else does nothing.
|
||||||
|
*
|
||||||
|
* @param surface The surface to clear.
|
||||||
|
*/
|
||||||
|
void clearVideoSurface(Surface surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link Surface} onto which video will be rendered. The caller is responsible for
|
* Sets the {@link Surface} onto which video will be rendered. The caller is responsible for
|
||||||
* tracking the lifecycle of the surface, and must clear the surface by calling {@code
|
* tracking the lifecycle of the surface, and must clear the surface by calling {@code
|
||||||
@ -206,14 +214,6 @@ public interface Player {
|
|||||||
*/
|
*/
|
||||||
void setVideoSurface(@Nullable Surface surface);
|
void setVideoSurface(@Nullable Surface surface);
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the {@link Surface} onto which video is being rendered if it matches the one passed.
|
|
||||||
* Else does nothing.
|
|
||||||
*
|
|
||||||
* @param surface The surface to clear.
|
|
||||||
*/
|
|
||||||
void clearVideoSurface(Surface surface);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link SurfaceHolder} that holds the {@link Surface} onto which video will be
|
* Sets the {@link SurfaceHolder} that holds the {@link Surface} onto which video will be
|
||||||
* rendered. The player will track the lifecycle of the surface automatically.
|
* rendered. The player will track the lifecycle of the surface automatically.
|
||||||
|
@ -156,6 +156,14 @@ public final class PlayerMessage {
|
|||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns position in window at {@link #getWindowIndex()} at which the message will be delivered,
|
||||||
|
* in milliseconds. If {@link C#TIME_UNSET}, the message will be delivered immediately.
|
||||||
|
*/
|
||||||
|
public long getPositionMs() {
|
||||||
|
return positionMs;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a position in the current window at which the message will be delivered.
|
* Sets a position in the current window at which the message will be delivered.
|
||||||
*
|
*
|
||||||
@ -170,14 +178,6 @@ public final class PlayerMessage {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns position in window at {@link #getWindowIndex()} at which the message will be delivered,
|
|
||||||
* in milliseconds. If {@link C#TIME_UNSET}, the message will be delivered immediately.
|
|
||||||
*/
|
|
||||||
public long getPositionMs() {
|
|
||||||
return positionMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a position in a window at which the message will be delivered.
|
* Sets a position in a window at which the message will be delivered.
|
||||||
*
|
*
|
||||||
|
@ -286,6 +286,13 @@ public class SimpleExoPlayer
|
|||||||
setVideoSurface(null);
|
setVideoSurface(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearVideoSurface(Surface surface) {
|
||||||
|
if (surface != null && surface == this.surface) {
|
||||||
|
setVideoSurface(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVideoSurface(Surface surface) {
|
public void setVideoSurface(Surface surface) {
|
||||||
removeSurfaceCallbacks();
|
removeSurfaceCallbacks();
|
||||||
@ -294,13 +301,6 @@ public class SimpleExoPlayer
|
|||||||
maybeNotifySurfaceSizeChanged(/* width= */ newSurfaceSize, /* height= */ newSurfaceSize);
|
maybeNotifySurfaceSizeChanged(/* width= */ newSurfaceSize, /* height= */ newSurfaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clearVideoSurface(Surface surface) {
|
|
||||||
if (surface != null && surface == this.surface) {
|
|
||||||
setVideoSurface(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVideoSurfaceHolder(SurfaceHolder surfaceHolder) {
|
public void setVideoSurfaceHolder(SurfaceHolder surfaceHolder) {
|
||||||
removeSurfaceCallbacks();
|
removeSurfaceCallbacks();
|
||||||
|
@ -304,6 +304,11 @@ public class AnalyticsCollector
|
|||||||
|
|
||||||
// VideoListener implementation.
|
// VideoListener implementation.
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void onRenderedFirstFrame() {
|
||||||
|
// Do nothing. Already reported in VideoRendererEventListener.onRenderedFirstFrame.
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void onVideoSizeChanged(
|
public final void onVideoSizeChanged(
|
||||||
int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
|
||||||
@ -322,11 +327,6 @@ public class AnalyticsCollector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onRenderedFirstFrame() {
|
|
||||||
// Do nothing. Already reported in VideoRendererEventListener.onRenderedFirstFrame.
|
|
||||||
}
|
|
||||||
|
|
||||||
// MediaSourceEventListener implementation.
|
// MediaSourceEventListener implementation.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,8 +90,8 @@ public class DecoderInputBuffer extends Buffer {
|
|||||||
/**
|
/**
|
||||||
* Ensures that {@link #data} is large enough to accommodate a write of a given length at its
|
* Ensures that {@link #data} is large enough to accommodate a write of a given length at its
|
||||||
* current position.
|
* current position.
|
||||||
* <p>
|
*
|
||||||
* If the capacity of {@link #data} is sufficient this method does nothing. If the capacity is
|
* <p>If the capacity of {@link #data} is sufficient this method does nothing. If the capacity is
|
||||||
* insufficient then an attempt is made to replace {@link #data} with a new {@link ByteBuffer}
|
* insufficient then an attempt is made to replace {@link #data} with a new {@link ByteBuffer}
|
||||||
* whose capacity is sufficient. Data up to the current position is copied to the new buffer.
|
* whose capacity is sufficient. Data up to the current position is copied to the new buffer.
|
||||||
*
|
*
|
||||||
@ -99,7 +99,7 @@ public class DecoderInputBuffer extends Buffer {
|
|||||||
* @throws IllegalStateException If there is insufficient capacity to accommodate the write and
|
* @throws IllegalStateException If there is insufficient capacity to accommodate the write and
|
||||||
* the buffer replacement mode of the holder is {@link #BUFFER_REPLACEMENT_MODE_DISABLED}.
|
* the buffer replacement mode of the holder is {@link #BUFFER_REPLACEMENT_MODE_DISABLED}.
|
||||||
*/
|
*/
|
||||||
public void ensureSpaceForWrite(int length) throws IllegalStateException {
|
public void ensureSpaceForWrite(int length) {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
data = createReplacementByteBuffer(length);
|
data = createReplacementByteBuffer(length);
|
||||||
return;
|
return;
|
||||||
|
@ -20,11 +20,11 @@ import com.google.android.exoplayer2.C;
|
|||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
|
||||||
/**
|
/** Base class for {@link Decoder}s that use their own decode thread. */
|
||||||
* Base class for {@link Decoder}s that use their own decode thread.
|
@SuppressWarnings("UngroupedOverloads")
|
||||||
*/
|
public abstract class SimpleDecoder<
|
||||||
public abstract class SimpleDecoder<I extends DecoderInputBuffer, O extends OutputBuffer,
|
I extends DecoderInputBuffer, O extends OutputBuffer, E extends Exception>
|
||||||
E extends Exception> implements Decoder<I, O, E> {
|
implements Decoder<I, O, E> {
|
||||||
|
|
||||||
private final Thread decodeThread;
|
private final Thread decodeThread;
|
||||||
|
|
||||||
|
@ -153,7 +153,9 @@ public final class MpegAudioHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int padding = (headerData >>> 9) & 1;
|
int padding = (headerData >>> 9) & 1;
|
||||||
int bitrate, frameSize, samplesPerFrame;
|
int bitrate;
|
||||||
|
int frameSize;
|
||||||
|
int samplesPerFrame;
|
||||||
if (layer == 3) {
|
if (layer == 3) {
|
||||||
// Layer I (layer == 3)
|
// Layer I (layer == 3)
|
||||||
bitrate = version == 3 ? BITRATE_V1_L1[bitrateIndex - 1] : BITRATE_V2_L1[bitrateIndex - 1];
|
bitrate = version == 3 ? BITRATE_V1_L1[bitrateIndex - 1] : BITRATE_V2_L1[bitrateIndex - 1];
|
||||||
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantField")
|
||||||
/* package*/ abstract class Atom {
|
/* package*/ abstract class Atom {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,9 +38,8 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/** Utility methods for parsing MP4 format atom payloads according to ISO 14496-12. */
|
||||||
* Utility methods for parsing MP4 format atom payloads according to ISO 14496-12.
|
@SuppressWarnings("ConstantField")
|
||||||
*/
|
|
||||||
/* package */ final class AtomParsers {
|
/* package */ final class AtomParsers {
|
||||||
|
|
||||||
/** Thrown if an edit list couldn't be applied. */
|
/** Thrown if an edit list couldn't be applied. */
|
||||||
@ -619,9 +618,11 @@ import java.util.List;
|
|||||||
long timescale = mdhd.readUnsignedInt();
|
long timescale = mdhd.readUnsignedInt();
|
||||||
mdhd.skipBytes(version == 0 ? 4 : 8);
|
mdhd.skipBytes(version == 0 ? 4 : 8);
|
||||||
int languageCode = mdhd.readUnsignedShort();
|
int languageCode = mdhd.readUnsignedShort();
|
||||||
String language = "" + (char) (((languageCode >> 10) & 0x1F) + 0x60)
|
String language =
|
||||||
|
""
|
||||||
|
+ (char) (((languageCode >> 10) & 0x1F) + 0x60)
|
||||||
+ (char) (((languageCode >> 5) & 0x1F) + 0x60)
|
+ (char) (((languageCode >> 5) & 0x1F) + 0x60)
|
||||||
+ (char) (((languageCode) & 0x1F) + 0x60);
|
+ (char) ((languageCode & 0x1F) + 0x60);
|
||||||
return Pair.create(timescale, language);
|
return Pair.create(timescale, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,10 @@ public final class FragmentedMp4Extractor implements Extractor {
|
|||||||
public static final int FLAG_WORKAROUND_IGNORE_EDIT_LISTS = 1 << 4; // 16
|
public static final int FLAG_WORKAROUND_IGNORE_EDIT_LISTS = 1 << 4; // 16
|
||||||
|
|
||||||
private static final String TAG = "FragmentedMp4Extractor";
|
private static final String TAG = "FragmentedMp4Extractor";
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantField")
|
||||||
private static final int SAMPLE_GROUP_TYPE_seig = Util.getIntegerCodeForString("seig");
|
private static final int SAMPLE_GROUP_TYPE_seig = Util.getIntegerCodeForString("seig");
|
||||||
|
|
||||||
private static final byte[] PIFF_SAMPLE_ENCRYPTION_BOX_EXTENDED_TYPE =
|
private static final byte[] PIFF_SAMPLE_ENCRYPTION_BOX_EXTENDED_TYPE =
|
||||||
new byte[] {-94, 57, 79, 82, 90, -101, 79, 20, -94, 68, 108, 66, 124, 100, -115, -12};
|
new byte[] {-94, 57, 79, 82, 90, -101, 79, 20, -94, 68, 108, 66, 124, 100, -115, -12};
|
||||||
private static final Format EMSG_FORMAT =
|
private static final Format EMSG_FORMAT =
|
||||||
|
@ -26,9 +26,8 @@ import com.google.android.exoplayer2.extractor.TrackOutput;
|
|||||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/** StreamReader abstract class. */
|
||||||
* StreamReader abstract class.
|
@SuppressWarnings("UngroupedOverloads")
|
||||||
*/
|
|
||||||
/* package */ abstract class StreamReader {
|
/* package */ abstract class StreamReader {
|
||||||
|
|
||||||
private static final int STATE_READ_HEADERS = 0;
|
private static final int STATE_READ_HEADERS = 0;
|
||||||
|
@ -153,7 +153,7 @@ import java.util.ArrayList;
|
|||||||
buffer.setLimit(buffer.limit() + 4);
|
buffer.setLimit(buffer.limit() + 4);
|
||||||
// The vorbis decoder expects the number of samples in the packet
|
// The vorbis decoder expects the number of samples in the packet
|
||||||
// to be appended to the audio data as an int32
|
// to be appended to the audio data as an int32
|
||||||
buffer.data[buffer.limit() - 4] = (byte) ((packetSampleCount) & 0xFF);
|
buffer.data[buffer.limit() - 4] = (byte) (packetSampleCount & 0xFF);
|
||||||
buffer.data[buffer.limit() - 3] = (byte) ((packetSampleCount >>> 8) & 0xFF);
|
buffer.data[buffer.limit() - 3] = (byte) ((packetSampleCount >>> 8) & 0xFF);
|
||||||
buffer.data[buffer.limit() - 2] = (byte) ((packetSampleCount >>> 16) & 0xFF);
|
buffer.data[buffer.limit() - 2] = (byte) ((packetSampleCount >>> 16) & 0xFF);
|
||||||
buffer.data[buffer.limit() - 1] = (byte) ((packetSampleCount >>> 24) & 0xFF);
|
buffer.data[buffer.limit() - 1] = (byte) ((packetSampleCount >>> 24) & 0xFF);
|
||||||
|
@ -169,6 +169,8 @@ public final class AdtsReader implements ElementaryStreamReader {
|
|||||||
case STATE_READING_SAMPLE:
|
case STATE_READING_SAMPLE:
|
||||||
readSample(data);
|
readSample(data);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,8 @@ public final class DtsReader implements ElementaryStreamReader {
|
|||||||
state = STATE_FINDING_SYNC;
|
state = STATE_FINDING_SYNC;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,8 @@ public final class LatmReader implements ElementaryStreamReader {
|
|||||||
state = STATE_FINDING_SYNC_1;
|
state = STATE_FINDING_SYNC_1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,6 +252,8 @@ public final class LatmReader implements ElementaryStreamReader {
|
|||||||
case 7:
|
case 7:
|
||||||
data.skipBits(1); // HVXCframeLengthTableIndex.
|
data.skipBits(1); // HVXCframeLengthTableIndex.
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +100,8 @@ public final class MpegAudioReader implements ElementaryStreamReader {
|
|||||||
case STATE_READING_FRAME:
|
case STATE_READING_FRAME:
|
||||||
readFrameRemainder(data);
|
readFrameRemainder(data);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ public final class PesReader implements TsPayloadReader {
|
|||||||
// Either way, notify the reader that it has now finished.
|
// Either way, notify the reader that it has now finished.
|
||||||
reader.packetFinished();
|
reader.packetFinished();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
setState(STATE_READING_HEADER);
|
setState(STATE_READING_HEADER);
|
||||||
}
|
}
|
||||||
@ -140,6 +142,8 @@ public final class PesReader implements TsPayloadReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,23 +499,34 @@ public final class MediaCodecUtil {
|
|||||||
*/
|
*/
|
||||||
private static int avcLevelToMaxFrameSize(int avcLevel) {
|
private static int avcLevelToMaxFrameSize(int avcLevel) {
|
||||||
switch (avcLevel) {
|
switch (avcLevel) {
|
||||||
case CodecProfileLevel.AVCLevel1: return 99 * 16 * 16;
|
case CodecProfileLevel.AVCLevel1:
|
||||||
case CodecProfileLevel.AVCLevel1b: return 99 * 16 * 16;
|
case CodecProfileLevel.AVCLevel1b:
|
||||||
case CodecProfileLevel.AVCLevel12: return 396 * 16 * 16;
|
return 99 * 16 * 16;
|
||||||
case CodecProfileLevel.AVCLevel13: return 396 * 16 * 16;
|
case CodecProfileLevel.AVCLevel12:
|
||||||
case CodecProfileLevel.AVCLevel2: return 396 * 16 * 16;
|
case CodecProfileLevel.AVCLevel13:
|
||||||
case CodecProfileLevel.AVCLevel21: return 792 * 16 * 16;
|
case CodecProfileLevel.AVCLevel2:
|
||||||
case CodecProfileLevel.AVCLevel22: return 1620 * 16 * 16;
|
return 396 * 16 * 16;
|
||||||
case CodecProfileLevel.AVCLevel3: return 1620 * 16 * 16;
|
case CodecProfileLevel.AVCLevel21:
|
||||||
case CodecProfileLevel.AVCLevel31: return 3600 * 16 * 16;
|
return 792 * 16 * 16;
|
||||||
case CodecProfileLevel.AVCLevel32: return 5120 * 16 * 16;
|
case CodecProfileLevel.AVCLevel22:
|
||||||
case CodecProfileLevel.AVCLevel4: return 8192 * 16 * 16;
|
case CodecProfileLevel.AVCLevel3:
|
||||||
case CodecProfileLevel.AVCLevel41: return 8192 * 16 * 16;
|
return 1620 * 16 * 16;
|
||||||
case CodecProfileLevel.AVCLevel42: return 8704 * 16 * 16;
|
case CodecProfileLevel.AVCLevel31:
|
||||||
case CodecProfileLevel.AVCLevel5: return 22080 * 16 * 16;
|
return 3600 * 16 * 16;
|
||||||
case CodecProfileLevel.AVCLevel51: return 36864 * 16 * 16;
|
case CodecProfileLevel.AVCLevel32:
|
||||||
case CodecProfileLevel.AVCLevel52: return 36864 * 16 * 16;
|
return 5120 * 16 * 16;
|
||||||
default: return -1;
|
case CodecProfileLevel.AVCLevel4:
|
||||||
|
case CodecProfileLevel.AVCLevel41:
|
||||||
|
return 8192 * 16 * 16;
|
||||||
|
case CodecProfileLevel.AVCLevel42:
|
||||||
|
return 8704 * 16 * 16;
|
||||||
|
case CodecProfileLevel.AVCLevel5:
|
||||||
|
return 22080 * 16 * 16;
|
||||||
|
case CodecProfileLevel.AVCLevel51:
|
||||||
|
case CodecProfileLevel.AVCLevel52:
|
||||||
|
return 36864 * 16 * 16;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
public final class EventMessageDecoder implements MetadataDecoder {
|
public final class EventMessageDecoder implements MetadataDecoder {
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
@Override
|
@Override
|
||||||
public Metadata decode(MetadataInputBuffer inputBuffer) {
|
public Metadata decode(MetadataInputBuffer inputBuffer) {
|
||||||
ByteBuffer buffer = inputBuffer.data;
|
ByteBuffer buffer = inputBuffer.data;
|
||||||
|
@ -96,6 +96,7 @@ public final class Id3Decoder implements MetadataDecoder {
|
|||||||
this.framePredicate = framePredicate;
|
this.framePredicate = framePredicate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Metadata decode(MetadataInputBuffer inputBuffer) {
|
public @Nullable Metadata decode(MetadataInputBuffer inputBuffer) {
|
||||||
ByteBuffer buffer = inputBuffer.data;
|
ByteBuffer buffer = inputBuffer.data;
|
||||||
@ -696,14 +697,13 @@ public final class Id3Decoder implements MetadataDecoder {
|
|||||||
*/
|
*/
|
||||||
private static String getCharsetName(int encodingByte) {
|
private static String getCharsetName(int encodingByte) {
|
||||||
switch (encodingByte) {
|
switch (encodingByte) {
|
||||||
case ID3_TEXT_ENCODING_ISO_8859_1:
|
|
||||||
return "ISO-8859-1";
|
|
||||||
case ID3_TEXT_ENCODING_UTF_16:
|
case ID3_TEXT_ENCODING_UTF_16:
|
||||||
return "UTF-16";
|
return "UTF-16";
|
||||||
case ID3_TEXT_ENCODING_UTF_16BE:
|
case ID3_TEXT_ENCODING_UTF_16BE:
|
||||||
return "UTF-16BE";
|
return "UTF-16BE";
|
||||||
case ID3_TEXT_ENCODING_UTF_8:
|
case ID3_TEXT_ENCODING_UTF_8:
|
||||||
return "UTF-8";
|
return "UTF-8";
|
||||||
|
case ID3_TEXT_ENCODING_ISO_8859_1:
|
||||||
default:
|
default:
|
||||||
return "ISO-8859-1";
|
return "ISO-8859-1";
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public final class SpliceInfoDecoder implements MetadataDecoder {
|
|||||||
sectionHeader = new ParsableBitArray();
|
sectionHeader = new ParsableBitArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
@Override
|
@Override
|
||||||
public Metadata decode(MetadataInputBuffer inputBuffer) {
|
public Metadata decode(MetadataInputBuffer inputBuffer) {
|
||||||
// Internal timestamps adjustment.
|
// Internal timestamps adjustment.
|
||||||
|
@ -189,6 +189,7 @@ public abstract class DownloadAction {
|
|||||||
public abstract Downloader createDownloader(
|
public abstract Downloader createDownloader(
|
||||||
DownloaderConstructorHelper downloaderConstructorHelper);
|
DownloaderConstructorHelper downloaderConstructorHelper);
|
||||||
|
|
||||||
|
@SuppressWarnings("EqualsGetClass")
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object o) {
|
public boolean equals(@Nullable Object o) {
|
||||||
if (o == null || getClass() != o.getClass()) {
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
@ -25,6 +25,7 @@ import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
|
|||||||
import com.google.android.exoplayer2.upstream.cache.CacheUtil;
|
import com.google.android.exoplayer2.upstream.cache.CacheUtil;
|
||||||
import com.google.android.exoplayer2.upstream.cache.CacheUtil.CachingCounters;
|
import com.google.android.exoplayer2.upstream.cache.CacheUtil.CachingCounters;
|
||||||
import com.google.android.exoplayer2.util.PriorityTaskManager;
|
import com.google.android.exoplayer2.util.PriorityTaskManager;
|
||||||
|
import com.google.android.exoplayer2.util.Util;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -54,8 +55,7 @@ public abstract class SegmentDownloader<M extends FilterableManifest<M>> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NonNull Segment other) {
|
public int compareTo(@NonNull Segment other) {
|
||||||
long startOffsetDiff = startTimeUs - other.startTimeUs;
|
return Util.compareLong(startTimeUs, other.startTimeUs);
|
||||||
return startOffsetDiff == 0 ? 0 : ((startOffsetDiff < 0) ? -1 : 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +67,10 @@ public abstract class SimpleSubtitleDecoder extends
|
|||||||
super.releaseOutputBuffer(buffer);
|
super.releaseOutputBuffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
@Override
|
@Override
|
||||||
protected final SubtitleDecoderException decode(SubtitleInputBuffer inputBuffer,
|
protected final SubtitleDecoderException decode(
|
||||||
SubtitleOutputBuffer outputBuffer, boolean reset) {
|
SubtitleInputBuffer inputBuffer, SubtitleOutputBuffer outputBuffer, boolean reset) {
|
||||||
try {
|
try {
|
||||||
ByteBuffer inputData = inputBuffer.data;
|
ByteBuffer inputData = inputBuffer.data;
|
||||||
Subtitle subtitle = decode(inputData.array(), inputData.limit(), reset);
|
Subtitle subtitle = decode(inputData.array(), inputData.limit(), reset);
|
||||||
|
@ -250,6 +250,7 @@ public final class Cea608Decoder extends CeaDecoder {
|
|||||||
return new CeaSubtitle(cues);
|
return new CeaSubtitle(cues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ByteBufferBackingArray")
|
||||||
@Override
|
@Override
|
||||||
protected void decode(SubtitleInputBuffer inputBuffer) {
|
protected void decode(SubtitleInputBuffer inputBuffer) {
|
||||||
ccData.reset(inputBuffer.data.array(), inputBuffer.data.limit());
|
ccData.reset(inputBuffer.data.array(), inputBuffer.data.limit());
|
||||||
|
@ -186,7 +186,7 @@ public abstract class BaseTrackSelection implements TrackSelection {
|
|||||||
|
|
||||||
// Track groups are compared by identity not value, as distinct groups may have the same value.
|
// Track groups are compared by identity not value, as distinct groups may have the same value.
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("ReferenceEquality")
|
@SuppressWarnings({"ReferenceEquality", "EqualsGetClass"})
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -148,6 +148,7 @@ public final class ContentDataSource extends BaseDataSource {
|
|||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("Finally")
|
||||||
@Override
|
@Override
|
||||||
public void close() throws ContentDataSourceException {
|
public void close() throws ContentDataSourceException {
|
||||||
uri = null;
|
uri = null;
|
||||||
|
@ -171,6 +171,7 @@ public final class RawResourceDataSource extends BaseDataSource {
|
|||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("Finally")
|
||||||
@Override
|
@Override
|
||||||
public void close() throws RawResourceDataSourceException {
|
public void close() throws RawResourceDataSourceException {
|
||||||
uri = null;
|
uri = null;
|
||||||
|
@ -431,6 +431,7 @@ import com.google.android.exoplayer2.util.Util;
|
|||||||
* latter only checks the text of each sequence, and does not check for equality of styling that
|
* latter only checks the text of each sequence, and does not check for equality of styling that
|
||||||
* may be embedded within the {@link CharSequence}s.
|
* may be embedded within the {@link CharSequence}s.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("UndefinedEquals")
|
||||||
private static boolean areCharSequencesEqual(CharSequence first, CharSequence second) {
|
private static boolean areCharSequencesEqual(CharSequence first, CharSequence second) {
|
||||||
// Some CharSequence implementations don't perform a cheap referential equality check in their
|
// Some CharSequence implementations don't perform a cheap referential equality check in their
|
||||||
// equals methods, so we perform one explicitly here.
|
// equals methods, so we perform one explicitly here.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user