Fix decoder selection for E-AC3 JOC streams

Issue: #6398
PiperOrigin-RevId: 267563795
This commit is contained in:
andrewlewis 2019-09-06 11:15:33 +01:00 committed by Oliver Woodman
parent 77ed930251
commit f1ccb47c3b
4 changed files with 11 additions and 6 deletions

View File

@ -65,6 +65,8 @@
* Publish `testutils` module to simplify unit testing with ExoPlayer * Publish `testutils` module to simplify unit testing with ExoPlayer
([#6267](https://github.com/google/ExoPlayer/issues/6267)). ([#6267](https://github.com/google/ExoPlayer/issues/6267)).
* Add `uid` to `Timeline.Window` to uniquely identify window instances. * Add `uid` to `Timeline.Window` to uniquely identify window instances.
* Fix decoder selection for E-AC3 JOC streams
([#6398](https://github.com/google/ExoPlayer/issues/6398)).
### 2.10.4 ### ### 2.10.4 ###

View File

@ -46,6 +46,7 @@ import com.google.android.exoplayer2.util.MediaClock;
import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util; import com.google.android.exoplayer2.util.Util;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -361,10 +362,11 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
decoderInfos = MediaCodecUtil.getDecoderInfosSortedByFormatSupport(decoderInfos, format); decoderInfos = MediaCodecUtil.getDecoderInfosSortedByFormatSupport(decoderInfos, format);
if (MimeTypes.AUDIO_E_AC3_JOC.equals(format.sampleMimeType)) { if (MimeTypes.AUDIO_E_AC3_JOC.equals(format.sampleMimeType)) {
// E-AC3 decoders can decode JOC streams, but in 2-D rather than 3-D. // E-AC3 decoders can decode JOC streams, but in 2-D rather than 3-D.
List<MediaCodecInfo> eac3DecoderInfos = List<MediaCodecInfo> decoderInfosWithEac3 = new ArrayList<>(decoderInfos);
decoderInfosWithEac3.addAll(
mediaCodecSelector.getDecoderInfos( mediaCodecSelector.getDecoderInfos(
MimeTypes.AUDIO_E_AC3, requiresSecureDecoder, /* requiresTunnelingDecoder= */ false); MimeTypes.AUDIO_E_AC3, requiresSecureDecoder, /* requiresTunnelingDecoder= */ false));
decoderInfos.addAll(eac3DecoderInfos); decoderInfos = decoderInfosWithEac3;
} }
return Collections.unmodifiableList(decoderInfos); return Collections.unmodifiableList(decoderInfos);
} }

View File

@ -52,7 +52,8 @@ public interface MediaCodecSelector {
* @param mimeType The MIME type for which a decoder is required. * @param mimeType The MIME type for which a decoder is required.
* @param requiresSecureDecoder Whether a secure decoder is required. * @param requiresSecureDecoder Whether a secure decoder is required.
* @param requiresTunnelingDecoder Whether a tunneling decoder is required. * @param requiresTunnelingDecoder Whether a tunneling decoder is required.
* @return A list of {@link MediaCodecInfo}s corresponding to decoders. May be empty. * @return An unmodifiable list of {@link MediaCodecInfo}s corresponding to decoders. May be
* empty.
* @throws DecoderQueryException Thrown if there was an error querying decoders. * @throws DecoderQueryException Thrown if there was an error querying decoders.
*/ */
List<MediaCodecInfo> getDecoderInfos( List<MediaCodecInfo> getDecoderInfos(

View File

@ -156,8 +156,8 @@ public final class MediaCodecUtil {
* unless secure decryption really is required. * unless secure decryption really is required.
* @param tunneling Whether the decoder is required to support tunneling. Always pass false unless * @param tunneling Whether the decoder is required to support tunneling. Always pass false unless
* tunneling really is required. * tunneling really is required.
* @return A list of all {@link MediaCodecInfo}s for the given mime type, in the order given by * @return An unmodifiable list of all {@link MediaCodecInfo}s for the given mime type, in the
* {@link MediaCodecList}. * order given by {@link MediaCodecList}.
* @throws DecoderQueryException If there was an error querying the available decoders. * @throws DecoderQueryException If there was an error querying the available decoders.
*/ */
public static synchronized List<MediaCodecInfo> getDecoderInfos( public static synchronized List<MediaCodecInfo> getDecoderInfos(