Search in sources :

Example 1 with AudioCapabilities

use of android.media.MediaCodecInfo.AudioCapabilities in project ExoPlayer by google.

the class MediaCodecInfo method isAudioChannelCountSupportedV21.

/**
 * Whether the decoder supports audio with a given channel count.
 *
 * <p>Must not be called if the device SDK version is less than 21.
 *
 * @param channelCount The channel count.
 * @return Whether the decoder supports audio with the given channel count.
 */
@RequiresApi(21)
public boolean isAudioChannelCountSupportedV21(int channelCount) {
    if (capabilities == null) {
        logNoSupport("channelCount.caps");
        return false;
    }
    AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
    if (audioCapabilities == null) {
        logNoSupport("channelCount.aCaps");
        return false;
    }
    int maxInputChannelCount = adjustMaxInputChannelCount(name, mimeType, audioCapabilities.getMaxInputChannelCount());
    if (maxInputChannelCount < channelCount) {
        logNoSupport("channelCount.support, " + channelCount);
        return false;
    }
    return true;
}
Also used : AudioCapabilities(android.media.MediaCodecInfo.AudioCapabilities) Point(android.graphics.Point) RequiresApi(androidx.annotation.RequiresApi)

Aggregations

Point (android.graphics.Point)1 AudioCapabilities (android.media.MediaCodecInfo.AudioCapabilities)1 RequiresApi (androidx.annotation.RequiresApi)1