Commit 5d92cc83 by Oliver Woodman

Make changes to Opus/Vp9 projects to build against new dev

parent 102e0ce8
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ExoPlayerExtWebMDemo</name>
<name>ExoPlayerExt-WebMDemo</name>
<comment></comment>
<projects>
</projects>
......
......@@ -33,11 +33,11 @@ import com.google.android.exoplayer.dash.mpd.Period;
import com.google.android.exoplayer.dash.mpd.Representation;
import com.google.android.exoplayer.ext.opus.LibopusAudioTrackRenderer;
import com.google.android.exoplayer.ext.vp9.LibvpxVideoTrackRenderer;
import com.google.android.exoplayer.upstream.BufferPool;
import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DefaultAllocator;
import com.google.android.exoplayer.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer.upstream.UriDataSource;
import com.google.android.exoplayer.upstream.DefaultUriDataSource;
import com.google.android.exoplayer.util.ManifestFetcher;
import com.google.android.exoplayer.util.ManifestFetcher.ManifestCallback;
import com.google.android.exoplayer.util.MimeTypes;
......@@ -80,7 +80,7 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
@Override
public void onSingleManifest(MediaPresentationDescription manifest) {
LoadControl loadControl = new DefaultLoadControl(new BufferPool(BUFFER_SEGMENT_SIZE));
LoadControl loadControl = new DefaultLoadControl(new DefaultAllocator(BUFFER_SEGMENT_SIZE));
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(null, null);
// Obtain Representations for playback.
......@@ -105,7 +105,7 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
// Build the video renderer.
LibvpxVideoTrackRenderer videoRenderer = null;
if (!videoRepresentationsList.isEmpty()) {
DataSource videoDataSource = new UriDataSource(userAgent, bandwidthMeter);
DataSource videoDataSource = new DefaultUriDataSource(userAgent, bandwidthMeter);
ChunkSource videoChunkSource;
String mimeType = videoRepresentations[0].format.mimeType;
if (mimeType.equals(MimeTypes.VIDEO_WEBM)) {
......@@ -124,7 +124,7 @@ public class DashRendererBuilder implements ManifestCallback<MediaPresentationDe
MultiTrackChunkSource audioChunkSource = null;
TrackRenderer audioRenderer = null;
if (!audioRepresentationsList.isEmpty()) {
DataSource audioDataSource = new UriDataSource(userAgent, bandwidthMeter);
DataSource audioDataSource = new DefaultUriDataSource(userAgent, bandwidthMeter);
ChunkSource[] audioChunkSources = new ChunkSource[audioRepresentationsList.size()];
FormatEvaluator audioEvaluator = new FormatEvaluator.FixedEvaluator();
for (int i = 0; i < audioRepresentationsList.size(); i++) {
......
......@@ -19,12 +19,15 @@ import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.TrackRenderer;
import com.google.android.exoplayer.VideoSurfaceView;
import com.google.android.exoplayer.ext.opus.LibopusAudioTrackRenderer;
import com.google.android.exoplayer.ext.vp9.LibvpxVideoTrackRenderer;
import com.google.android.exoplayer.ext.vp9.VpxDecoderException;
import com.google.android.exoplayer.ext.vp9.VpxVideoSurfaceView;
import com.google.android.exoplayer.source.DefaultSampleSource;
import com.google.android.exoplayer.source.FrameworkSampleExtractor;
import com.google.android.exoplayer.extractor.ExtractorSampleSource;
import com.google.android.exoplayer.extractor.webm.WebmExtractor;
import com.google.android.exoplayer.upstream.DefaultUriDataSource;
import com.google.android.exoplayer.util.PlayerControl;
import com.google.android.exoplayer.util.Util;
import android.app.Activity;
import android.content.Intent;
......@@ -53,6 +56,7 @@ public class VideoPlayer extends Activity implements OnClickListener,
public static final String USE_OPENGL_ID_EXTRA = "use_opengl";
private static final int FILE_PICKER_REQUEST = 1;
private static final int EXTRACTOR_BUFFER_SIZE = 10 * 1024 * 1024;
private boolean isDash;
private String manifestUrl;
......@@ -150,13 +154,14 @@ public class VideoPlayer extends Activity implements OnClickListener,
return;
}
findViewById(R.id.buttons).setVisibility(View.GONE);
player = ExoPlayer.Factory.newInstance(1);
player = ExoPlayer.Factory.newInstance(2);
player.addListener(this);
mediaController.setMediaPlayer(new PlayerControl(player));
mediaController.setEnabled(true);
Uri uri = Uri.fromFile(new File(filename));
DefaultSampleSource sampleSource =
new DefaultSampleSource(new FrameworkSampleExtractor(this, uri, null), 2);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(
Uri.fromFile(new File(filename)),
new DefaultUriDataSource(Util.getUserAgent(this, "ExoPlayerExtWebMDemo"), null),
new WebmExtractor(), 2, EXTRACTOR_BUFFER_SIZE);
TrackRenderer videoRenderer =
new LibvpxVideoTrackRenderer(sampleSource, true, handler, this, 50);
if (useOpenGL) {
......@@ -169,7 +174,8 @@ public class VideoPlayer extends Activity implements OnClickListener,
videoSurfaceView.getHolder().getSurface());
vpxVideoSurfaceView.setVisibility(View.GONE);
}
player.prepare(videoRenderer);
TrackRenderer audioRenderer = new LibopusAudioTrackRenderer(sampleSource);
player.prepare(videoRenderer, audioRenderer);
player.setPlayWhenReady(true);
}
......
......@@ -29,6 +29,7 @@ import java.nio.ByteBuffer;
private final long nativeDecoderContext;
static {
System.loadLibrary("opus");
System.loadLibrary("opusJNI");
}
......
......@@ -234,7 +234,7 @@ import java.util.LinkedList;
synchronized (lock) {
if (flushDecodedOutputBuffer
|| inputBuffer.sampleHolder.decodeOnly
|| inputBuffer.sampleHolder.isDecodeOnly()
|| outputBuffer.size == 0) {
// In the following cases, we make the output buffer available again rather than queuing it
// to be consumed:
......
......@@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
private final long vpxDecContext;
static {
System.loadLibrary("vpx");
System.loadLibrary("vpxJNI");
}
......
......@@ -196,7 +196,9 @@ import java.util.LinkedList;
}
synchronized (lock) {
if (flushDecodedOutputBuffer || inputBuffer.sampleHolder.decodeOnly || decodeResult == 1) {
if (flushDecodedOutputBuffer
|| inputBuffer.sampleHolder.isDecodeOnly()
|| decodeResult == 1) {
// In the following cases, we make the output buffer available again rather than queuing it
// to be consumed:
// 1) A flush occured whilst we were decoding.
......
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