Rename java VideoCodecType to VideoCodecMimeType

to avoid collission and confusion with VideoCodeType based on
c++ enum with the same name.

Bug: b/148146536
Change-Id: I049cce21d59f454c7ce507fdfc3a85d168f96223
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170048
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30728}
This commit is contained in:
Danil Chapovalov
2020-03-09 15:39:39 +01:00
committed by Commit Bot
parent afa2e5f18c
commit 4e1d6ce384
9 changed files with 44 additions and 43 deletions

View File

@ -56,7 +56,7 @@ class AndroidVideoDecoder implements VideoDecoder, VideoSink {
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
private final String codecName;
private final VideoCodecType codecType;
private final VideoCodecMimeType codecType;
private static class FrameInfo {
final long decodeStartTimeMs;
@ -129,7 +129,7 @@ class AndroidVideoDecoder implements VideoDecoder, VideoSink {
@Nullable private MediaCodecWrapper codec;
AndroidVideoDecoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
VideoCodecType codecType, int colorFormat, @Nullable EglBase.Context sharedContext) {
VideoCodecMimeType codecType, int colorFormat, @Nullable EglBase.Context sharedContext) {
if (!isSupportedColorFormat(colorFormat)) {
throw new IllegalArgumentException("Unsupported color format: " + colorFormat);
}

View File

@ -103,7 +103,7 @@ class HardwareVideoEncoder implements VideoEncoder {
// --- Initialized on construction.
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
private final String codecName;
private final VideoCodecType codecType;
private final VideoCodecMimeType codecType;
private final Integer surfaceColorFormat;
private final Integer yuvColorFormat;
private final YuvFormat yuvFormat;
@ -180,7 +180,7 @@ class HardwareVideoEncoder implements VideoEncoder {
* @throws IllegalArgumentException if colorFormat is unsupported
*/
public HardwareVideoEncoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
VideoCodecType codecType, Integer surfaceColorFormat, Integer yuvColorFormat,
VideoCodecMimeType codecType, Integer surfaceColorFormat, Integer yuvColorFormat,
Map<String, String> params, int keyFrameIntervalSec, int forceKeyFrameIntervalMs,
BitrateAdjuster bitrateAdjuster, EglBase14.Context sharedContext) {
this.mediaCodecWrapperFactory = mediaCodecWrapperFactory;
@ -240,7 +240,7 @@ class HardwareVideoEncoder implements VideoEncoder {
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
format.setInteger(MediaFormat.KEY_FRAME_RATE, bitrateAdjuster.getCodecConfigFramerate());
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, keyFrameIntervalSec);
if (codecType == VideoCodecType.H264) {
if (codecType == VideoCodecMimeType.H264) {
String profileLevelId = params.get(VideoCodecInfo.H264_FMTP_PROFILE_LEVEL_ID);
if (profileLevelId == null) {
profileLevelId = VideoCodecInfo.H264_CONSTRAINED_BASELINE_3_1;
@ -465,11 +465,11 @@ class HardwareVideoEncoder implements VideoEncoder {
public ScalingSettings getScalingSettings() {
encodeThreadChecker.checkIsOnValidThread();
if (automaticResizeOn) {
if (codecType == VideoCodecType.VP8) {
if (codecType == VideoCodecMimeType.VP8) {
final int kLowVp8QpThreshold = 29;
final int kHighVp8QpThreshold = 95;
return new ScalingSettings(kLowVp8QpThreshold, kHighVp8QpThreshold);
} else if (codecType == VideoCodecType.H264) {
} else if (codecType == VideoCodecMimeType.H264) {
final int kLowH264QpThreshold = 24;
final int kHighH264QpThreshold = 37;
return new ScalingSettings(kLowH264QpThreshold, kHighH264QpThreshold);
@ -563,7 +563,7 @@ class HardwareVideoEncoder implements VideoEncoder {
}
final ByteBuffer frameBuffer;
if (isKeyFrame && codecType == VideoCodecType.H264) {
if (isKeyFrame && codecType == VideoCodecMimeType.H264) {
Logging.d(TAG,
"Prepending config frame of size " + configBuffer.capacity()
+ " to output buffer with offset " + info.offset + ", size " + info.size);

View File

@ -76,7 +76,7 @@ class MediaCodecUtils {
return null;
}
static boolean codecSupportsType(MediaCodecInfo info, VideoCodecType type) {
static boolean codecSupportsType(MediaCodecInfo info, VideoCodecMimeType type) {
for (String mimeType : info.getSupportedTypes()) {
if (type.mimeType().equals(mimeType)) {
return true;
@ -85,7 +85,7 @@ class MediaCodecUtils {
return false;
}
static Map<String, String> getCodecProperties(VideoCodecType type, boolean highProfile) {
static Map<String, String> getCodecProperties(VideoCodecMimeType type, boolean highProfile) {
switch (type) {
case VP8:
case VP9:

View File

@ -46,7 +46,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
@Nullable
@Override
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
VideoCodecType type = VideoCodecType.valueOf(codecType.getName());
VideoCodecMimeType type = VideoCodecMimeType.valueOf(codecType.getName());
MediaCodecInfo info = findCodecForType(type);
if (info == null) {
@ -64,12 +64,12 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
// Generate a list of supported codecs in order of preference:
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
for (VideoCodecType type :
new VideoCodecType[] {VideoCodecType.VP8, VideoCodecType.VP9, VideoCodecType.H264}) {
for (VideoCodecMimeType type : new VideoCodecMimeType[] {
VideoCodecMimeType.VP8, VideoCodecMimeType.VP9, VideoCodecMimeType.H264}) {
MediaCodecInfo codec = findCodecForType(type);
if (codec != null) {
String name = type.name();
if (type == VideoCodecType.H264 && isH264HighProfileSupported(codec)) {
if (type == VideoCodecMimeType.H264 && isH264HighProfileSupported(codec)) {
supportedCodecInfos.add(new VideoCodecInfo(
name, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true)));
}
@ -82,7 +82,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
}
private @Nullable MediaCodecInfo findCodecForType(VideoCodecType type) {
private @Nullable MediaCodecInfo findCodecForType(VideoCodecMimeType type) {
// HW decoding is not supported on builds before KITKAT.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return null;
@ -109,7 +109,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
}
// Returns true if the given MediaCodecInfo indicates a supported encoder for the given type.
private boolean isSupportedCodec(MediaCodecInfo info, VideoCodecType type) {
private boolean isSupportedCodec(MediaCodecInfo info, VideoCodecMimeType type) {
String name = info.getName();
if (!MediaCodecUtils.codecSupportsType(info, type)) {
return false;

View File

@ -11,14 +11,14 @@
package org.webrtc;
/** Enumeration of supported video codec types. */
enum VideoCodecType {
enum VideoCodecMimeType {
VP8("video/x-vnd.on2.vp8"),
VP9("video/x-vnd.on2.vp9"),
H264("video/avc");
private final String mimeType;
private VideoCodecType(String mimeType) {
private VideoCodecMimeType(String mimeType) {
this.mimeType = mimeType;
}