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