Commit 403f164b by andrewlewis Committed by Oliver Woodman

Pass the sample Format to AudioDecoderTrackRenderer.createDecoder.

The FFmpeg extension can support various different MIME types, so pass the
whole format to configure the decoder.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122246589
parent ea8d0a7a
...@@ -22,8 +22,6 @@ import com.google.android.exoplayer.util.MimeTypes; ...@@ -22,8 +22,6 @@ import com.google.android.exoplayer.util.MimeTypes;
import android.os.Handler; import android.os.Handler;
import java.util.List;
/** /**
* Decodes and renders audio using the native Flac decoder. * Decodes and renders audio using the native Flac decoder.
*/ */
...@@ -58,8 +56,8 @@ public class LibflacAudioTrackRenderer extends AudioDecoderTrackRenderer { ...@@ -58,8 +56,8 @@ public class LibflacAudioTrackRenderer extends AudioDecoderTrackRenderer {
} }
@Override @Override
protected FlacDecoder createDecoder(List<byte[]> initializationData) throws FlacDecoderException { protected FlacDecoder createDecoder(Format format) throws FlacDecoderException {
return new FlacDecoder(NUM_BUFFERS, NUM_BUFFERS, initializationData); return new FlacDecoder(NUM_BUFFERS, NUM_BUFFERS, format.initializationData);
} }
} }
...@@ -22,8 +22,6 @@ import com.google.android.exoplayer.util.MimeTypes; ...@@ -22,8 +22,6 @@ import com.google.android.exoplayer.util.MimeTypes;
import android.os.Handler; import android.os.Handler;
import java.util.List;
/** /**
* Decodes and renders audio using the native Opus decoder. * Decodes and renders audio using the native Opus decoder.
*/ */
...@@ -67,9 +65,9 @@ public final class LibopusAudioTrackRenderer extends AudioDecoderTrackRenderer { ...@@ -67,9 +65,9 @@ public final class LibopusAudioTrackRenderer extends AudioDecoderTrackRenderer {
} }
@Override @Override
protected OpusDecoder createDecoder(List<byte[]> initializationData) throws OpusDecoderException { protected OpusDecoder createDecoder(Format format) throws OpusDecoderException {
return new OpusDecoder(NUM_BUFFERS, NUM_BUFFERS, INITIAL_INPUT_BUFFER_SIZE, return new OpusDecoder(NUM_BUFFERS, NUM_BUFFERS, INITIAL_INPUT_BUFFER_SIZE,
initializationData); format.initializationData);
} }
} }
...@@ -31,8 +31,6 @@ import com.google.android.exoplayer.util.MimeTypes; ...@@ -31,8 +31,6 @@ import com.google.android.exoplayer.util.MimeTypes;
import android.os.Handler; import android.os.Handler;
import java.util.List;
/** /**
* Decodes and renders audio using a {@link SimpleDecoder}. * Decodes and renders audio using a {@link SimpleDecoder}.
*/ */
...@@ -103,7 +101,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements ...@@ -103,7 +101,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements
// If we don't have a decoder yet, we need to instantiate one. // If we don't have a decoder yet, we need to instantiate one.
if (decoder == null) { if (decoder == null) {
try { try {
decoder = createDecoder(format.initializationData); decoder = createDecoder(format);
} catch (AudioDecoderException e) { } catch (AudioDecoderException e) {
throw ExoPlaybackException.createForRenderer(e, getIndex()); throw ExoPlaybackException.createForRenderer(e, getIndex());
} }
...@@ -132,8 +130,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements ...@@ -132,8 +130,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements
} }
protected abstract SimpleDecoder<DecoderInputBuffer, ? extends SimpleOutputBuffer, protected abstract SimpleDecoder<DecoderInputBuffer, ? extends SimpleOutputBuffer,
? extends AudioDecoderException> createDecoder(List<byte[]> initializationData) ? extends AudioDecoderException> createDecoder(Format format) throws AudioDecoderException;
throws AudioDecoderException;
private void renderBuffer() throws AudioDecoderException, AudioTrack.InitializationException, private void renderBuffer() throws AudioDecoderException, AudioTrack.InitializationException,
AudioTrack.WriteException { AudioTrack.WriteException {
......
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