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
This commit is contained in:
parent
ea8d0a7aef
commit
403f164b75
@ -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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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;
|
|||||||
|
|
||||||
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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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;
|
|||||||
|
|
||||||
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
|
|||||||
// 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
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user