Java Code Examples for android.media.MediaCodecInfo.VideoCapabilities#areSizeAndRateSupported()

The following examples show how to use android.media.MediaCodecInfo.VideoCapabilities#areSizeAndRateSupported() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaCodecInfo.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  // Don't ever fail due to alignment. See: https://github.com/google/ExoPlayer/issues/6551.
  Point alignedSize = alignVideoSizeV21(capabilities, width, height);
  width = alignedSize.x;
  height = alignedSize.y;

  if (frameRate == Format.NO_VALUE || frameRate <= 0) {
    return capabilities.isSizeSupported(width, height);
  } else {
    // The signaled frame rate may be slightly higher than the actual frame rate, so we take the
    // floor to avoid situations where a range check in areSizeAndRateSupported fails due to
    // slightly exceeding the limits for a standard format (e.g., 1080p at 30 fps).
    double floorFrameRate = Math.floor(frameRate);
    return capabilities.areSizeAndRateSupported(width, height, floorFrameRate);
  }
}
 
Example 2
Source File: MediaCodecInfo.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  // Don't ever fail due to alignment. See: https://github.com/google/ExoPlayer/issues/6551.
  Point alignedSize = alignVideoSizeV21(capabilities, width, height);
  width = alignedSize.x;
  height = alignedSize.y;

  if (frameRate == Format.NO_VALUE || frameRate <= 0) {
    return capabilities.isSizeSupported(width, height);
  } else {
    // The signaled frame rate may be slightly higher than the actual frame rate, so we take the
    // floor to avoid situations where a range check in areSizeAndRateSupported fails due to
    // slightly exceeding the limits for a standard format (e.g., 1080p at 30 fps).
    double floorFrameRate = Math.floor(frameRate);
    return capabilities.areSizeAndRateSupported(width, height, floorFrameRate);
  }
}
 
Example 3
Source File: MediaCodecInfo.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  // Don't ever fail due to alignment. See: https://github.com/google/ExoPlayer/issues/6551.
  Point alignedSize = alignVideoSizeV21(capabilities, width, height);
  width = alignedSize.x;
  height = alignedSize.y;

  if (frameRate == Format.NO_VALUE || frameRate <= 0) {
    return capabilities.isSizeSupported(width, height);
  } else {
    // The signaled frame rate may be slightly higher than the actual frame rate, so we take the
    // floor to avoid situations where a range check in areSizeAndRateSupported fails due to
    // slightly exceeding the limits for a standard format (e.g., 1080p at 30 fps).
    double floorFrameRate = Math.floor(frameRate);
    return capabilities.areSizeAndRateSupported(width, height, floorFrameRate);
  }
}
 
Example 4
Source File: MediaCodecInfo.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  return frameRate == Format.NO_VALUE || frameRate <= 0
      ? capabilities.isSizeSupported(width, height)
      : capabilities.areSizeAndRateSupported(width, height, frameRate);
}
 
Example 5
Source File: MediaCodecInfo.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupportedV21(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  return frameRate == Format.NO_VALUE || frameRate <= 0
      ? capabilities.isSizeSupported(width, height)
      : capabilities.areSizeAndRateSupported(width, height, frameRate);
}
 
Example 6
Source File: MediaCodecInfo.java    From K-Sonic with MIT License 5 votes vote down vote up
@TargetApi(21)
private static boolean areSizeAndRateSupported(VideoCapabilities capabilities, int width,
    int height, double frameRate) {
  return frameRate == Format.NO_VALUE || frameRate <= 0
      ? capabilities.isSizeSupported(width, height)
      : capabilities.areSizeAndRateSupported(width, height, frameRate);
}