Commit faf196a5 by ojw28

Merge pull request #154 from google/dev

Merge dev -> dev-hls
parents 25ddeab5 d506d766
...@@ -268,7 +268,7 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer { ...@@ -268,7 +268,7 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer {
@Override @Override
protected void seekTo(long positionUs) throws ExoPlaybackException { protected void seekTo(long positionUs) throws ExoPlaybackException {
super.seekTo(positionUs); super.seekTo(positionUs);
// TODO: Try and re-use the same AudioTrack instance once [redacted] is fixed. // TODO: Try and re-use the same AudioTrack instance once [Internal: b/7941810] is fixed.
audioTrack.reset(); audioTrack.reset();
currentPositionUs = Long.MIN_VALUE; currentPositionUs = Long.MIN_VALUE;
} }
......
...@@ -30,7 +30,8 @@ import android.os.SystemClock; ...@@ -30,7 +30,8 @@ import android.os.SystemClock;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.HashSet; import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
...@@ -141,7 +142,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer { ...@@ -141,7 +142,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
private final SampleSource source; private final SampleSource source;
private final SampleHolder sampleHolder; private final SampleHolder sampleHolder;
private final MediaFormatHolder formatHolder; private final MediaFormatHolder formatHolder;
private final HashSet<Long> decodeOnlyPresentationTimestamps; private final List<Long> decodeOnlyPresentationTimestamps;
private final MediaCodec.BufferInfo outputBufferInfo; private final MediaCodec.BufferInfo outputBufferInfo;
private final EventListener eventListener; private final EventListener eventListener;
protected final Handler eventHandler; protected final Handler eventHandler;
...@@ -191,7 +192,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer { ...@@ -191,7 +192,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
codecCounters = new CodecCounters(); codecCounters = new CodecCounters();
sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED); sampleHolder = new SampleHolder(SampleHolder.BUFFER_REPLACEMENT_MODE_DISABLED);
formatHolder = new MediaFormatHolder(); formatHolder = new MediaFormatHolder();
decodeOnlyPresentationTimestamps = new HashSet<Long>(); decodeOnlyPresentationTimestamps = new ArrayList<Long>();
outputBufferInfo = new MediaCodec.BufferInfo(); outputBufferInfo = new MediaCodec.BufferInfo();
} }
...@@ -467,7 +468,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer { ...@@ -467,7 +468,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
waitingForFirstSyncFrame = true; waitingForFirstSyncFrame = true;
decodeOnlyPresentationTimestamps.clear(); decodeOnlyPresentationTimestamps.clear();
// Workaround for framework bugs. // Workaround for framework bugs.
// See [redacted], [redacted], [redacted]. // See [Internal: b/8347958], [Internal: b/8578467], [Internal: b/8543366].
if (Util.SDK_INT >= 18) { if (Util.SDK_INT >= 18) {
codec.flush(); codec.flush();
} else { } else {
...@@ -736,12 +737,11 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer { ...@@ -736,12 +737,11 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
return false; return false;
} }
boolean decodeOnly = decodeOnlyPresentationTimestamps.contains( int decodeOnlyIdx = getDecodeOnlyIndex(outputBufferInfo.presentationTimeUs);
outputBufferInfo.presentationTimeUs);
if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex], if (processOutputBuffer(positionUs, elapsedRealtimeUs, codec, outputBuffers[outputIndex],
outputBufferInfo, outputIndex, decodeOnly)) { outputBufferInfo, outputIndex, decodeOnlyIdx >= 0)) {
if (decodeOnly) { if (decodeOnlyIdx >= 0) {
decodeOnlyPresentationTimestamps.remove(outputBufferInfo.presentationTimeUs); decodeOnlyPresentationTimestamps.remove(decodeOnlyIdx);
} else { } else {
currentPositionUs = outputBufferInfo.presentationTimeUs; currentPositionUs = outputBufferInfo.presentationTimeUs;
} }
...@@ -785,4 +785,13 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer { ...@@ -785,4 +785,13 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
} }
} }
private int getDecodeOnlyIndex(long presentationTimeUs) {
final int size = decodeOnlyPresentationTimestamps.size();
for (int i = 0; i < size; i++) {
if (decodeOnlyPresentationTimestamps.get(i).longValue() == presentationTimeUs) {
return i;
}
}
return -1;
}
} }
...@@ -103,7 +103,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer { ...@@ -103,7 +103,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
} }
// TODO: Use MediaFormat constants if these get exposed through the API. See [redacted]. // TODO: Use MediaFormat constants if these get exposed through the API. See [Internal: b/14127601].
private static final String KEY_CROP_LEFT = "crop-left"; private static final String KEY_CROP_LEFT = "crop-left";
private static final String KEY_CROP_RIGHT = "crop-right"; private static final String KEY_CROP_RIGHT = "crop-right";
private static final String KEY_CROP_BOTTOM = "crop-bottom"; private static final String KEY_CROP_BOTTOM = "crop-bottom";
......
...@@ -583,7 +583,7 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -583,7 +583,7 @@ public final class FragmentedMp4Extractor implements Extractor {
if (atomType == Atom.TYPE_mp4a || atomType == Atom.TYPE_enca) { if (atomType == Atom.TYPE_mp4a || atomType == Atom.TYPE_enca) {
if (childAtomType == Atom.TYPE_esds) { if (childAtomType == Atom.TYPE_esds) {
initializationData = parseEsdsFromParent(parent, childStartPosition); initializationData = parseEsdsFromParent(parent, childStartPosition);
// TODO: Do we really need to do this? See [redacted] // TODO: Do we really need to do this? See [Internal: b/10903778]
// Update sampleRate and channelCount from the AudioSpecificConfig initialization data. // Update sampleRate and channelCount from the AudioSpecificConfig initialization data.
Pair<Integer, Integer> audioSpecificConfig = Pair<Integer, Integer> audioSpecificConfig =
CodecSpecificDataUtil.parseAudioSpecificConfig(initializationData); CodecSpecificDataUtil.parseAudioSpecificConfig(initializationData);
......
...@@ -247,7 +247,7 @@ public class TextTrackRenderer extends TrackRenderer implements Callback { ...@@ -247,7 +247,7 @@ public class TextTrackRenderer extends TrackRenderer implements Callback {
@Override @Override
protected boolean isReady() { protected boolean isReady() {
// Don't block playback whilst subtitles are loading. // Don't block playback whilst subtitles are loading.
// Note: To change this behavior, it will be necessary to consider [redacted]. // Note: To change this behavior, it will be necessary to consider [Internal: b/12949941].
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment