Cleanup/Sync with internal tree
This commit is contained in:
parent
67d0154960
commit
ac54b4f696
@ -131,8 +131,7 @@ public class DashRendererBuilder implements RendererBuilder,
|
|||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser();
|
MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser();
|
||||||
manifestDataSource = new DefaultUriDataSource(context, userAgent);
|
manifestDataSource = new DefaultUriDataSource(context, userAgent);
|
||||||
manifestFetcher = new ManifestFetcher<>(url, manifestDataSource,
|
manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser);
|
||||||
parser);
|
|
||||||
manifestFetcher.singleLoad(player.getMainHandler().getLooper(), this);
|
manifestFetcher.singleLoad(player.getMainHandler().getLooper(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,19 @@ android {
|
|||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
androidTest {
|
||||||
|
assets.srcDirs = ['src/test/assets']
|
||||||
|
java.srcDirs = ['src/test/java']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
|
||||||
|
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
|
||||||
|
androidTestCompile 'org.mockito:mockito-core:1.9.5'
|
||||||
}
|
}
|
||||||
|
|
||||||
android.libraryVariants.all { variant ->
|
android.libraryVariants.all { variant ->
|
||||||
|
@ -52,8 +52,7 @@ public class MediaCodecUtil {
|
|||||||
|
|
||||||
private static final String TAG = "MediaCodecUtil";
|
private static final String TAG = "MediaCodecUtil";
|
||||||
|
|
||||||
private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs =
|
private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs = new HashMap<>();
|
||||||
new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get information about the decoder that will be used for a given mime type.
|
* Get information about the decoder that will be used for a given mime type.
|
||||||
|
@ -101,7 +101,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
|
|
||||||
private final TrackInfo trackInfo;
|
private final TrackInfo trackInfo;
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
private final FormatEvaluator evaluator;
|
private final FormatEvaluator formatEvaluator;
|
||||||
private final Evaluation evaluation;
|
private final Evaluation evaluation;
|
||||||
private final Clock systemClock;
|
private final Clock systemClock;
|
||||||
private final StringBuilder headerBuilder;
|
private final StringBuilder headerBuilder;
|
||||||
@ -117,13 +117,14 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
private final int adaptationSetIndex;
|
private final int adaptationSetIndex;
|
||||||
private final int[] representationIndices;
|
private final int[] representationIndices;
|
||||||
|
|
||||||
private DrmInitData drmInitData;
|
|
||||||
private MediaPresentationDescription currentManifest;
|
private MediaPresentationDescription currentManifest;
|
||||||
|
private boolean finishedCurrentManifest;
|
||||||
|
|
||||||
|
private DrmInitData drmInitData;
|
||||||
private TimeRange seekRange;
|
private TimeRange seekRange;
|
||||||
private long[] seekRangeValues;
|
private long[] seekRangeValues;
|
||||||
private int firstAvailableSegmentNum;
|
private int firstAvailableSegmentNum;
|
||||||
private int lastAvailableSegmentNum;
|
private int lastAvailableSegmentNum;
|
||||||
private boolean finishedCurrentManifest;
|
|
||||||
|
|
||||||
private boolean lastChunkWasInitialization;
|
private boolean lastChunkWasInitialization;
|
||||||
private IOException fatalError;
|
private IOException fatalError;
|
||||||
@ -214,7 +215,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
this.adaptationSetIndex = adaptationSetIndex;
|
this.adaptationSetIndex = adaptationSetIndex;
|
||||||
this.representationIndices = representationIndices;
|
this.representationIndices = representationIndices;
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.evaluator = formatEvaluator;
|
this.formatEvaluator = formatEvaluator;
|
||||||
this.systemClock = systemClock;
|
this.systemClock = systemClock;
|
||||||
this.liveEdgeLatencyUs = liveEdgeLatencyUs;
|
this.liveEdgeLatencyUs = liveEdgeLatencyUs;
|
||||||
this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs;
|
this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs;
|
||||||
@ -268,7 +269,8 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
evaluator.enable();
|
fatalError = null;
|
||||||
|
formatEvaluator.enable();
|
||||||
if (manifestFetcher != null) {
|
if (manifestFetcher != null) {
|
||||||
manifestFetcher.enable();
|
manifestFetcher.enable();
|
||||||
}
|
}
|
||||||
@ -286,7 +288,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable(List<? extends MediaChunk> queue) {
|
public void disable(List<? extends MediaChunk> queue) {
|
||||||
evaluator.disable();
|
formatEvaluator.disable();
|
||||||
if (manifestFetcher != null) {
|
if (manifestFetcher != null) {
|
||||||
manifestFetcher.disable();
|
manifestFetcher.disable();
|
||||||
}
|
}
|
||||||
@ -347,7 +349,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
|
|
||||||
evaluation.queueSize = queue.size();
|
evaluation.queueSize = queue.size();
|
||||||
if (evaluation.format == null || !lastChunkWasInitialization) {
|
if (evaluation.format == null || !lastChunkWasInitialization) {
|
||||||
evaluator.evaluate(queue, playbackPositionUs, formats, evaluation);
|
formatEvaluator.evaluate(queue, playbackPositionUs, formats, evaluation);
|
||||||
}
|
}
|
||||||
Format selectedFormat = evaluation.format;
|
Format selectedFormat = evaluation.format;
|
||||||
out.queueSize = evaluation.queueSize;
|
out.queueSize = evaluation.queueSize;
|
||||||
@ -362,6 +364,9 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
|
||||||
|
out.chunk = null;
|
||||||
|
|
||||||
RepresentationHolder representationHolder = representationHolders.get(selectedFormat.id);
|
RepresentationHolder representationHolder = representationHolders.get(selectedFormat.id);
|
||||||
Representation selectedRepresentation = representationHolder.representation;
|
Representation selectedRepresentation = representationHolder.representation;
|
||||||
DashSegmentIndex segmentIndex = representationHolder.segmentIndex;
|
DashSegmentIndex segmentIndex = representationHolder.segmentIndex;
|
||||||
@ -426,7 +431,7 @@ public class DashChunkSource implements ChunkSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (segmentNum == -1) {
|
if (segmentNum == -1) {
|
||||||
out.chunk = null;
|
// We've reached the end of the stream.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
|
|||||||
*/
|
*/
|
||||||
public void init(Allocator allocator) {
|
public void init(Allocator allocator) {
|
||||||
this.allocator = allocator;
|
this.allocator = allocator;
|
||||||
this.extractor.init(this);
|
extractor.init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,14 +59,11 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
private static final int MINIMUM_MANIFEST_REFRESH_PERIOD_MS = 5000;
|
private static final int MINIMUM_MANIFEST_REFRESH_PERIOD_MS = 5000;
|
||||||
private static final int INITIALIZATION_VECTOR_SIZE = 8;
|
private static final int INITIALIZATION_VECTOR_SIZE = 8;
|
||||||
|
|
||||||
private final ManifestFetcher<SmoothStreamingManifest> manifestFetcher;
|
|
||||||
private final int streamElementIndex;
|
|
||||||
private final TrackInfo trackInfo;
|
private final TrackInfo trackInfo;
|
||||||
private final DataSource dataSource;
|
private final DataSource dataSource;
|
||||||
private final FormatEvaluator formatEvaluator;
|
private final FormatEvaluator formatEvaluator;
|
||||||
private final Evaluation evaluation;
|
private final Evaluation evaluation;
|
||||||
private final long liveEdgeLatencyUs;
|
private final long liveEdgeLatencyUs;
|
||||||
|
|
||||||
private final int maxWidth;
|
private final int maxWidth;
|
||||||
private final int maxHeight;
|
private final int maxHeight;
|
||||||
|
|
||||||
@ -75,6 +72,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
private final DrmInitData drmInitData;
|
private final DrmInitData drmInitData;
|
||||||
private final Format[] formats;
|
private final Format[] formats;
|
||||||
|
|
||||||
|
private final ManifestFetcher<SmoothStreamingManifest> manifestFetcher;
|
||||||
|
private final int streamElementIndex;
|
||||||
|
|
||||||
private SmoothStreamingManifest currentManifest;
|
private SmoothStreamingManifest currentManifest;
|
||||||
private int currentManifestChunkOffset;
|
private int currentManifestChunkOffset;
|
||||||
private boolean finishedCurrentManifest;
|
private boolean finishedCurrentManifest;
|
||||||
@ -174,8 +174,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
extractorWrappers.put(trackIndex, new ChunkExtractorWrapper(extractor));
|
extractorWrappers.put(trackIndex, new ChunkExtractorWrapper(extractor));
|
||||||
mediaFormats.put(trackIndex, mediaFormat);
|
mediaFormats.put(trackIndex, mediaFormat);
|
||||||
}
|
}
|
||||||
this.maxHeight = maxHeight;
|
|
||||||
this.maxWidth = maxWidth;
|
this.maxWidth = maxWidth;
|
||||||
|
this.maxHeight = maxHeight;
|
||||||
Arrays.sort(formats, new DecreasingBandwidthComparator());
|
Arrays.sort(formats, new DecreasingBandwidthComparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +194,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
fatalError = null;
|
fatalError = null;
|
||||||
|
formatEvaluator.enable();
|
||||||
if (manifestFetcher != null) {
|
if (manifestFetcher != null) {
|
||||||
manifestFetcher.enable();
|
manifestFetcher.enable();
|
||||||
}
|
}
|
||||||
@ -201,6 +202,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable(List<? extends MediaChunk> queue) {
|
public void disable(List<? extends MediaChunk> queue) {
|
||||||
|
formatEvaluator.disable();
|
||||||
if (manifestFetcher != null) {
|
if (manifestFetcher != null) {
|
||||||
manifestFetcher.disable();
|
manifestFetcher.disable();
|
||||||
}
|
}
|
||||||
@ -248,14 +250,13 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
out.chunk = null;
|
out.chunk = null;
|
||||||
return;
|
return;
|
||||||
} else if (out.queueSize == queue.size() && out.chunk != null
|
} else if (out.queueSize == queue.size() && out.chunk != null
|
||||||
&& out.chunk.format.equals(evaluation.format)) {
|
&& out.chunk.format.equals(selectedFormat)) {
|
||||||
// We already have a chunk, and the evaluation hasn't changed either the format or the size
|
// We already have a chunk, and the evaluation hasn't changed either the format or the size
|
||||||
// of the queue. Do nothing.
|
// of the queue. Leave unchanged.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In all cases where we return before instantiating a new chunk at the bottom of this method,
|
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
|
||||||
// we want out.chunk to be null.
|
|
||||||
out.chunk = null;
|
out.chunk = null;
|
||||||
|
|
||||||
StreamElement streamElement = getElement(currentManifest);
|
StreamElement streamElement = getElement(currentManifest);
|
||||||
@ -290,7 +291,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
|||||||
// but continue to return the final chunk.
|
// but continue to return the final chunk.
|
||||||
finishedCurrentManifest = true;
|
finishedCurrentManifest = true;
|
||||||
}
|
}
|
||||||
} else if (chunkIndex == -1) {
|
}
|
||||||
|
|
||||||
|
if (chunkIndex == -1) {
|
||||||
// We've reached the end of the stream.
|
// We've reached the end of the stream.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -230,8 +230,11 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void invokeRendererInternal(String cueText) {
|
private void invokeRendererInternal(String cueText) {
|
||||||
Cue cue = new Cue(cueText);
|
if (cueText == null) {
|
||||||
textRenderer.onCues(Collections.singletonList(cue));
|
textRenderer.onCues(Collections.<Cue>emptyList());
|
||||||
|
} else {
|
||||||
|
textRenderer.onCues(Collections.singletonList(new Cue(cueText)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeParsePendingSample() {
|
private void maybeParsePendingSample() {
|
||||||
|
@ -92,7 +92,8 @@ public final class CacheSpan implements Comparable<CacheSpan> {
|
|||||||
return new CacheSpan(key, position, file.length(), true, lastAccessTimestamp, file);
|
return new CacheSpan(key, position, file.length(), true, lastAccessTimestamp, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CacheSpan(String key, long position, long length, boolean isCached,
|
// Visible for testing.
|
||||||
|
CacheSpan(String key, long position, long length, boolean isCached,
|
||||||
long lastAccessTimestamp, File file) {
|
long lastAccessTimestamp, File file) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
@ -5,6 +5,5 @@
|
|||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/ExoPlayerDemo"/>
|
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -15,16 +15,19 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.google.android.exoplayer.tests">
|
package="com.google.android.exoplayer.tests">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="22"/>
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="22"/>
|
||||||
|
|
||||||
<application>
|
<application android:debuggable="true"
|
||||||
|
android:allowBackup="false"
|
||||||
|
tools:ignore="MissingApplicationIcon,HardcodedDebugMode">
|
||||||
<uses-library android:name="android.test.runner"/>
|
<uses-library android:name="android.test.runner"/>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
<instrumentation
|
<instrumentation
|
||||||
android:targetPackage="com.google.android.exoplayer.demo"
|
android:targetPackage="com.google.android.exoplayer.tests"
|
||||||
android:name="android.test.InstrumentationTestRunner"/>
|
android:name="android.test.InstrumentationTestRunner"/>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -54,7 +54,6 @@ public class WebvttSubtitleTest extends TestCase {
|
|||||||
}
|
}
|
||||||
private WebvttSubtitle overlappingSubtitle = new WebvttSubtitle(overlappingSubtitleCues, 0);
|
private WebvttSubtitle overlappingSubtitle = new WebvttSubtitle(overlappingSubtitleCues, 0);
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private ArrayList<WebvttCue> nestedSubtitleCues = new ArrayList<>();
|
private ArrayList<WebvttCue> nestedSubtitleCues = new ArrayList<>();
|
||||||
{
|
{
|
||||||
WebvttCue firstCue = new WebvttCue(1000000, 4000000, FIRST_SUBTITLE_STRING);
|
WebvttCue firstCue = new WebvttCue(1000000, 4000000, FIRST_SUBTITLE_STRING);
|
||||||
|
@ -12,3 +12,4 @@
|
|||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-22
|
target=android-22
|
||||||
|
android.library.reference.1=../main
|
||||||
|
Loading…
x
Reference in New Issue
Block a user