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;
|
||||
MediaPresentationDescriptionParser parser = new MediaPresentationDescriptionParser();
|
||||
manifestDataSource = new DefaultUriDataSource(context, userAgent);
|
||||
manifestFetcher = new ManifestFetcher<>(url, manifestDataSource,
|
||||
parser);
|
||||
manifestFetcher = new ManifestFetcher<>(url, manifestDataSource, parser);
|
||||
manifestFetcher.singleLoad(player.getMainHandler().getLooper(), this);
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,19 @@ android {
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
androidTest {
|
||||
assets.srcDirs = ['src/test/assets']
|
||||
java.srcDirs = ['src/test/java']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 ->
|
||||
|
@ -52,8 +52,7 @@ public class MediaCodecUtil {
|
||||
|
||||
private static final String TAG = "MediaCodecUtil";
|
||||
|
||||
private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs =
|
||||
new HashMap<>();
|
||||
private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 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 DataSource dataSource;
|
||||
private final FormatEvaluator evaluator;
|
||||
private final FormatEvaluator formatEvaluator;
|
||||
private final Evaluation evaluation;
|
||||
private final Clock systemClock;
|
||||
private final StringBuilder headerBuilder;
|
||||
@ -117,13 +117,14 @@ public class DashChunkSource implements ChunkSource {
|
||||
private final int adaptationSetIndex;
|
||||
private final int[] representationIndices;
|
||||
|
||||
private DrmInitData drmInitData;
|
||||
private MediaPresentationDescription currentManifest;
|
||||
private boolean finishedCurrentManifest;
|
||||
|
||||
private DrmInitData drmInitData;
|
||||
private TimeRange seekRange;
|
||||
private long[] seekRangeValues;
|
||||
private int firstAvailableSegmentNum;
|
||||
private int lastAvailableSegmentNum;
|
||||
private boolean finishedCurrentManifest;
|
||||
|
||||
private boolean lastChunkWasInitialization;
|
||||
private IOException fatalError;
|
||||
@ -214,7 +215,7 @@ public class DashChunkSource implements ChunkSource {
|
||||
this.adaptationSetIndex = adaptationSetIndex;
|
||||
this.representationIndices = representationIndices;
|
||||
this.dataSource = dataSource;
|
||||
this.evaluator = formatEvaluator;
|
||||
this.formatEvaluator = formatEvaluator;
|
||||
this.systemClock = systemClock;
|
||||
this.liveEdgeLatencyUs = liveEdgeLatencyUs;
|
||||
this.elapsedRealtimeOffsetUs = elapsedRealtimeOffsetUs;
|
||||
@ -268,7 +269,8 @@ public class DashChunkSource implements ChunkSource {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
evaluator.enable();
|
||||
fatalError = null;
|
||||
formatEvaluator.enable();
|
||||
if (manifestFetcher != null) {
|
||||
manifestFetcher.enable();
|
||||
}
|
||||
@ -286,7 +288,7 @@ public class DashChunkSource implements ChunkSource {
|
||||
|
||||
@Override
|
||||
public void disable(List<? extends MediaChunk> queue) {
|
||||
evaluator.disable();
|
||||
formatEvaluator.disable();
|
||||
if (manifestFetcher != null) {
|
||||
manifestFetcher.disable();
|
||||
}
|
||||
@ -347,7 +349,7 @@ public class DashChunkSource implements ChunkSource {
|
||||
|
||||
evaluation.queueSize = queue.size();
|
||||
if (evaluation.format == null || !lastChunkWasInitialization) {
|
||||
evaluator.evaluate(queue, playbackPositionUs, formats, evaluation);
|
||||
formatEvaluator.evaluate(queue, playbackPositionUs, formats, evaluation);
|
||||
}
|
||||
Format selectedFormat = evaluation.format;
|
||||
out.queueSize = evaluation.queueSize;
|
||||
@ -362,6 +364,9 @@ public class DashChunkSource implements ChunkSource {
|
||||
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);
|
||||
Representation selectedRepresentation = representationHolder.representation;
|
||||
DashSegmentIndex segmentIndex = representationHolder.segmentIndex;
|
||||
@ -426,7 +431,7 @@ public class DashChunkSource implements ChunkSource {
|
||||
}
|
||||
|
||||
if (segmentNum == -1) {
|
||||
out.chunk = null;
|
||||
// We've reached the end of the stream.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
|
||||
*/
|
||||
public void init(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 INITIALIZATION_VECTOR_SIZE = 8;
|
||||
|
||||
private final ManifestFetcher<SmoothStreamingManifest> manifestFetcher;
|
||||
private final int streamElementIndex;
|
||||
private final TrackInfo trackInfo;
|
||||
private final DataSource dataSource;
|
||||
private final FormatEvaluator formatEvaluator;
|
||||
private final Evaluation evaluation;
|
||||
private final long liveEdgeLatencyUs;
|
||||
|
||||
private final int maxWidth;
|
||||
private final int maxHeight;
|
||||
|
||||
@ -75,6 +72,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
private final DrmInitData drmInitData;
|
||||
private final Format[] formats;
|
||||
|
||||
private final ManifestFetcher<SmoothStreamingManifest> manifestFetcher;
|
||||
private final int streamElementIndex;
|
||||
|
||||
private SmoothStreamingManifest currentManifest;
|
||||
private int currentManifestChunkOffset;
|
||||
private boolean finishedCurrentManifest;
|
||||
@ -174,8 +174,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
extractorWrappers.put(trackIndex, new ChunkExtractorWrapper(extractor));
|
||||
mediaFormats.put(trackIndex, mediaFormat);
|
||||
}
|
||||
this.maxHeight = maxHeight;
|
||||
this.maxWidth = maxWidth;
|
||||
this.maxHeight = maxHeight;
|
||||
Arrays.sort(formats, new DecreasingBandwidthComparator());
|
||||
}
|
||||
|
||||
@ -194,6 +194,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
@Override
|
||||
public void enable() {
|
||||
fatalError = null;
|
||||
formatEvaluator.enable();
|
||||
if (manifestFetcher != null) {
|
||||
manifestFetcher.enable();
|
||||
}
|
||||
@ -201,6 +202,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
|
||||
@Override
|
||||
public void disable(List<? extends MediaChunk> queue) {
|
||||
formatEvaluator.disable();
|
||||
if (manifestFetcher != null) {
|
||||
manifestFetcher.disable();
|
||||
}
|
||||
@ -248,14 +250,13 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
out.chunk = null;
|
||||
return;
|
||||
} 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
|
||||
// of the queue. Do nothing.
|
||||
// of the queue. Leave unchanged.
|
||||
return;
|
||||
}
|
||||
|
||||
// In all cases where we return before instantiating a new chunk at the bottom of this method,
|
||||
// we want out.chunk to be null.
|
||||
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
|
||||
out.chunk = null;
|
||||
|
||||
StreamElement streamElement = getElement(currentManifest);
|
||||
@ -290,7 +291,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
|
||||
// but continue to return the final chunk.
|
||||
finishedCurrentManifest = true;
|
||||
}
|
||||
} else if (chunkIndex == -1) {
|
||||
}
|
||||
|
||||
if (chunkIndex == -1) {
|
||||
// We've reached the end of the stream.
|
||||
return;
|
||||
}
|
||||
|
@ -230,8 +230,11 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
|
||||
}
|
||||
|
||||
private void invokeRendererInternal(String cueText) {
|
||||
Cue cue = new Cue(cueText);
|
||||
textRenderer.onCues(Collections.singletonList(cue));
|
||||
if (cueText == null) {
|
||||
textRenderer.onCues(Collections.<Cue>emptyList());
|
||||
} else {
|
||||
textRenderer.onCues(Collections.singletonList(new Cue(cueText)));
|
||||
}
|
||||
}
|
||||
|
||||
private void maybeParsePendingSample() {
|
||||
|
@ -92,7 +92,8 @@ public final class CacheSpan implements Comparable<CacheSpan> {
|
||||
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) {
|
||||
this.key = key;
|
||||
this.position = position;
|
||||
|
@ -5,6 +5,5 @@
|
||||
<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.DEPENDENCIES"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/ExoPlayerDemo"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
@ -15,16 +15,19 @@
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.google.android.exoplayer.tests">
|
||||
|
||||
<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"/>
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:targetPackage="com.google.android.exoplayer.demo"
|
||||
android:targetPackage="com.google.android.exoplayer.tests"
|
||||
android:name="android.test.InstrumentationTestRunner"/>
|
||||
|
||||
</manifest>
|
||||
|
@ -54,7 +54,6 @@ public class WebvttSubtitleTest extends TestCase {
|
||||
}
|
||||
private WebvttSubtitle overlappingSubtitle = new WebvttSubtitle(overlappingSubtitleCues, 0);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ArrayList<WebvttCue> nestedSubtitleCues = new ArrayList<>();
|
||||
{
|
||||
WebvttCue firstCue = new WebvttCue(1000000, 4000000, FIRST_SUBTITLE_STRING);
|
||||
|
@ -12,3 +12,4 @@
|
||||
|
||||
# Project target.
|
||||
target=android-22
|
||||
android.library.reference.1=../main
|
||||
|
Loading…
x
Reference in New Issue
Block a user