Revert MediaCodecSelector API change
Future changes for checking codec capabilities will go in the renderer rather than in the codec selector, so the codec selector only needs a MIME type as before. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=208076716
This commit is contained in:
parent
4b2e382725
commit
5b3b4e64f9
@ -270,11 +270,11 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<MediaCodecInfo> decoderInfos =
|
List<MediaCodecInfo> decoderInfos =
|
||||||
mediaCodecSelector.getDecoderInfos(format, requiresSecureDecryption);
|
mediaCodecSelector.getDecoderInfos(format.sampleMimeType, requiresSecureDecryption);
|
||||||
if (decoderInfos.isEmpty()) {
|
if (decoderInfos.isEmpty()) {
|
||||||
return requiresSecureDecryption
|
return requiresSecureDecryption
|
||||||
&& !mediaCodecSelector
|
&& !mediaCodecSelector
|
||||||
.getDecoderInfos(format, /* requiresSecureDecoder= */ false)
|
.getDecoderInfos(format.sampleMimeType, /* requiresSecureDecoder= */ false)
|
||||||
.isEmpty()
|
.isEmpty()
|
||||||
? FORMAT_UNSUPPORTED_DRM
|
? FORMAT_UNSUPPORTED_DRM
|
||||||
: FORMAT_UNSUPPORTED_SUBTYPE;
|
: FORMAT_UNSUPPORTED_SUBTYPE;
|
||||||
|
@ -392,7 +392,7 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
|
|||||||
protected List<MediaCodecInfo> getDecoderInfos(
|
protected List<MediaCodecInfo> getDecoderInfos(
|
||||||
MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder)
|
MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder)
|
||||||
throws DecoderQueryException {
|
throws DecoderQueryException {
|
||||||
return mediaCodecSelector.getDecoderInfos(format, requiresSecureDecoder);
|
return mediaCodecSelector.getDecoderInfos(format.sampleMimeType, requiresSecureDecoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,6 @@ package com.google.android.exoplayer2.mediacodec;
|
|||||||
|
|
||||||
import android.media.MediaCodec;
|
import android.media.MediaCodec;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import com.google.android.exoplayer2.Format;
|
|
||||||
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
|
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -34,10 +33,10 @@ public interface MediaCodecSelector {
|
|||||||
MediaCodecSelector DEFAULT =
|
MediaCodecSelector DEFAULT =
|
||||||
new MediaCodecSelector() {
|
new MediaCodecSelector() {
|
||||||
@Override
|
@Override
|
||||||
public List<MediaCodecInfo> getDecoderInfos(Format format, boolean requiresSecureDecoder)
|
public List<MediaCodecInfo> getDecoderInfos(String mimeType, boolean requiresSecureDecoder)
|
||||||
throws DecoderQueryException {
|
throws DecoderQueryException {
|
||||||
List<MediaCodecInfo> decoderInfos =
|
List<MediaCodecInfo> decoderInfos =
|
||||||
MediaCodecUtil.getDecoderInfos(format.sampleMimeType, requiresSecureDecoder);
|
MediaCodecUtil.getDecoderInfos(mimeType, requiresSecureDecoder);
|
||||||
return decoderInfos.isEmpty()
|
return decoderInfos.isEmpty()
|
||||||
? Collections.emptyList()
|
? Collections.emptyList()
|
||||||
: Collections.singletonList(decoderInfos.get(0));
|
: Collections.singletonList(decoderInfos.get(0));
|
||||||
@ -60,9 +59,9 @@ public interface MediaCodecSelector {
|
|||||||
MediaCodecSelector DEFAULT_WITH_FALLBACK =
|
MediaCodecSelector DEFAULT_WITH_FALLBACK =
|
||||||
new MediaCodecSelector() {
|
new MediaCodecSelector() {
|
||||||
@Override
|
@Override
|
||||||
public List<MediaCodecInfo> getDecoderInfos(Format format, boolean requiresSecureDecoder)
|
public List<MediaCodecInfo> getDecoderInfos(String mimeType, boolean requiresSecureDecoder)
|
||||||
throws DecoderQueryException {
|
throws DecoderQueryException {
|
||||||
return MediaCodecUtil.getDecoderInfos(format.sampleMimeType, requiresSecureDecoder);
|
return MediaCodecUtil.getDecoderInfos(mimeType, requiresSecureDecoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,14 +71,14 @@ public interface MediaCodecSelector {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of decoders that can decode media in the specified format, in priority order.
|
* Returns a list of decoders that can decode media in the specified MIME type, in priority order.
|
||||||
*
|
*
|
||||||
* @param format The format 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.
|
||||||
* @return A list of {@link MediaCodecInfo}s corresponding to decoders. May be empty.
|
* @return A 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(Format format, boolean requiresSecureDecoder)
|
List<MediaCodecInfo> getDecoderInfos(String mimeType, boolean requiresSecureDecoder)
|
||||||
throws DecoderQueryException;
|
throws DecoderQueryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,11 +246,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<MediaCodecInfo> decoderInfos =
|
List<MediaCodecInfo> decoderInfos =
|
||||||
mediaCodecSelector.getDecoderInfos(format, requiresSecureDecryption);
|
mediaCodecSelector.getDecoderInfos(format.sampleMimeType, requiresSecureDecryption);
|
||||||
if (decoderInfos.isEmpty()) {
|
if (decoderInfos.isEmpty()) {
|
||||||
return requiresSecureDecryption
|
return requiresSecureDecryption
|
||||||
&& !mediaCodecSelector
|
&& !mediaCodecSelector
|
||||||
.getDecoderInfos(format, /* requiresSecureDecoder= */ false)
|
.getDecoderInfos(format.sampleMimeType, /* requiresSecureDecoder= */ false)
|
||||||
.isEmpty()
|
.isEmpty()
|
||||||
? FORMAT_UNSUPPORTED_DRM
|
? FORMAT_UNSUPPORTED_DRM
|
||||||
: FORMAT_UNSUPPORTED_SUBTYPE;
|
: FORMAT_UNSUPPORTED_SUBTYPE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user