mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Only use passthrough for passthrough MIME types.
This commit is contained in:
parent
e770e5c24b
commit
679fa8de03
1 changed files with 4 additions and 4 deletions
|
|
@ -160,8 +160,8 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer implem
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns whether encoded audio passthrough may be used for playing back the input format. This
|
||||
* implementation returns true if the {@link AudioTrack}'s audio capabilities indicate that
|
||||
* Returns whether encoded audio passthrough should be used for playing back the input format.
|
||||
* This implementation returns true if the {@link AudioTrack}'s audio capabilities indicate that
|
||||
* passthrough is supported.
|
||||
*
|
||||
* @param mimeType The type of input media.
|
||||
|
|
@ -174,9 +174,9 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer implem
|
|||
@Override
|
||||
protected void configureCodec(MediaCodec codec, String codecName,
|
||||
android.media.MediaFormat format, android.media.MediaCrypto crypto) {
|
||||
if (RAW_DECODER_NAME.equals(codecName)) {
|
||||
String mimeType = format.getString(android.media.MediaFormat.KEY_MIME);
|
||||
if (RAW_DECODER_NAME.equals(codecName) && !MimeTypes.AUDIO_RAW.equals(mimeType)) {
|
||||
// Override the MIME type used to configure the codec if we are using a passthrough decoder.
|
||||
String mimeType = format.getString(android.media.MediaFormat.KEY_MIME);
|
||||
format.setString(android.media.MediaFormat.KEY_MIME, MimeTypes.AUDIO_RAW);
|
||||
codec.configure(format, null, crypto, 0);
|
||||
format.setString(android.media.MediaFormat.KEY_MIME, mimeType);
|
||||
|
|
|
|||
Loading…
Reference in a new issue