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:
committed by
Commit Bot
parent
afa2e5f18c
commit
4e1d6ce384
@ -405,7 +405,7 @@ if (is_android) {
|
|||||||
"src/java/org/webrtc/MediaCodecWrapperFactory.java",
|
"src/java/org/webrtc/MediaCodecWrapperFactory.java",
|
||||||
"src/java/org/webrtc/MediaCodecWrapperFactoryImpl.java",
|
"src/java/org/webrtc/MediaCodecWrapperFactoryImpl.java",
|
||||||
"src/java/org/webrtc/NV12Buffer.java",
|
"src/java/org/webrtc/NV12Buffer.java",
|
||||||
"src/java/org/webrtc/VideoCodecType.java",
|
"src/java/org/webrtc/VideoCodecMimeType.java",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoCodecType type = VideoCodecType.valueOf(input.name);
|
VideoCodecMimeType type = VideoCodecMimeType.valueOf(input.name);
|
||||||
MediaCodecInfo info = findCodecForType(type);
|
MediaCodecInfo info = findCodecForType(type);
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
@ -108,7 +108,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
Integer yuvColorFormat = MediaCodecUtils.selectColorFormat(
|
Integer yuvColorFormat = MediaCodecUtils.selectColorFormat(
|
||||||
MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
|
MediaCodecUtils.ENCODER_COLOR_FORMATS, info.getCapabilitiesForType(mime));
|
||||||
|
|
||||||
if (type == VideoCodecType.H264) {
|
if (type == VideoCodecMimeType.H264) {
|
||||||
boolean isHighProfile = H264Utils.isSameH264Profile(
|
boolean isHighProfile = H264Utils.isSameH264Profile(
|
||||||
input.params, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true));
|
input.params, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true));
|
||||||
boolean isBaselineProfile = H264Utils.isSameH264Profile(
|
boolean isBaselineProfile = H264Utils.isSameH264Profile(
|
||||||
@ -138,14 +138,14 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
|
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
|
||||||
// Generate a list of supported codecs in order of preference:
|
// Generate a list of supported codecs in order of preference:
|
||||||
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
|
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
|
||||||
for (VideoCodecType type :
|
for (VideoCodecMimeType type : new VideoCodecMimeType[] {
|
||||||
new VideoCodecType[] {VideoCodecType.VP8, VideoCodecType.VP9, VideoCodecType.H264}) {
|
VideoCodecMimeType.VP8, VideoCodecMimeType.VP9, VideoCodecMimeType.H264}) {
|
||||||
MediaCodecInfo codec = findCodecForType(type);
|
MediaCodecInfo codec = findCodecForType(type);
|
||||||
if (codec != null) {
|
if (codec != null) {
|
||||||
String name = type.name();
|
String name = type.name();
|
||||||
// TODO(sakal): Always add H264 HP once WebRTC correctly removes codecs that are not
|
// TODO(sakal): Always add H264 HP once WebRTC correctly removes codecs that are not
|
||||||
// supported by the decoder.
|
// supported by the decoder.
|
||||||
if (type == VideoCodecType.H264 && isH264HighProfileSupported(codec)) {
|
if (type == VideoCodecMimeType.H264 && isH264HighProfileSupported(codec)) {
|
||||||
supportedCodecInfos.add(new VideoCodecInfo(
|
supportedCodecInfos.add(new VideoCodecInfo(
|
||||||
name, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true)));
|
name, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true)));
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
|
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable MediaCodecInfo findCodecForType(VideoCodecType type) {
|
private @Nullable MediaCodecInfo findCodecForType(VideoCodecMimeType type) {
|
||||||
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
|
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
|
||||||
MediaCodecInfo info = null;
|
MediaCodecInfo info = null;
|
||||||
try {
|
try {
|
||||||
@ -179,7 +179,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the given MediaCodecInfo indicates a supported encoder for the given type.
|
// 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) {
|
||||||
if (!MediaCodecUtils.codecSupportsType(info, type)) {
|
if (!MediaCodecUtils.codecSupportsType(info, type)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
|
|
||||||
// Returns true if the given MediaCodecInfo indicates a hardware module that is supported on the
|
// Returns true if the given MediaCodecInfo indicates a hardware module that is supported on the
|
||||||
// current SDK.
|
// current SDK.
|
||||||
private boolean isHardwareSupportedInCurrentSdk(MediaCodecInfo info, VideoCodecType type) {
|
private boolean isHardwareSupportedInCurrentSdk(MediaCodecInfo info, VideoCodecMimeType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VP8:
|
case VP8:
|
||||||
return isHardwareSupportedInCurrentSdkVp8(info);
|
return isHardwareSupportedInCurrentSdkVp8(info);
|
||||||
@ -244,7 +244,7 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
return codecAllowedPredicate.test(info);
|
return codecAllowedPredicate.test(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getKeyFrameIntervalSec(VideoCodecType type) {
|
private int getKeyFrameIntervalSec(VideoCodecMimeType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VP8: // Fallthrough intended.
|
case VP8: // Fallthrough intended.
|
||||||
case VP9:
|
case VP9:
|
||||||
@ -252,11 +252,11 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
case H264:
|
case H264:
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException("Unsupported VideoCodecType " + type);
|
throw new IllegalArgumentException("Unsupported VideoCodecMimeType " + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getForcedKeyFrameIntervalMs(VideoCodecType type, String codecName) {
|
private int getForcedKeyFrameIntervalMs(VideoCodecMimeType type, String codecName) {
|
||||||
if (type == VideoCodecType.VP8 && codecName.startsWith(QCOM_PREFIX)) {
|
if (type == VideoCodecMimeType.VP8 && codecName.startsWith(QCOM_PREFIX)) {
|
||||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP
|
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP
|
||||||
|| Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) {
|
|| Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||||
return QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_L_MS;
|
return QCOM_VP8_KEY_FRAME_INTERVAL_ANDROID_L_MS;
|
||||||
@ -270,9 +270,9 @@ public class HardwareVideoEncoderFactory implements VideoEncoderFactory {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BitrateAdjuster createBitrateAdjuster(VideoCodecType type, String codecName) {
|
private BitrateAdjuster createBitrateAdjuster(VideoCodecMimeType type, String codecName) {
|
||||||
if (codecName.startsWith(EXYNOS_PREFIX)) {
|
if (codecName.startsWith(EXYNOS_PREFIX)) {
|
||||||
if (type == VideoCodecType.VP8) {
|
if (type == VideoCodecMimeType.VP8) {
|
||||||
// Exynos VP8 encoders need dynamic bitrate adjustment.
|
// Exynos VP8 encoders need dynamic bitrate adjustment.
|
||||||
return new DynamicBitrateAdjuster();
|
return new DynamicBitrateAdjuster();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class AndroidVideoDecoder implements VideoDecoder, VideoSink {
|
|||||||
|
|
||||||
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
|
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
|
||||||
private final String codecName;
|
private final String codecName;
|
||||||
private final VideoCodecType codecType;
|
private final VideoCodecMimeType codecType;
|
||||||
|
|
||||||
private static class FrameInfo {
|
private static class FrameInfo {
|
||||||
final long decodeStartTimeMs;
|
final long decodeStartTimeMs;
|
||||||
@ -129,7 +129,7 @@ class AndroidVideoDecoder implements VideoDecoder, VideoSink {
|
|||||||
@Nullable private MediaCodecWrapper codec;
|
@Nullable private MediaCodecWrapper codec;
|
||||||
|
|
||||||
AndroidVideoDecoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
|
AndroidVideoDecoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
|
||||||
VideoCodecType codecType, int colorFormat, @Nullable EglBase.Context sharedContext) {
|
VideoCodecMimeType codecType, int colorFormat, @Nullable EglBase.Context sharedContext) {
|
||||||
if (!isSupportedColorFormat(colorFormat)) {
|
if (!isSupportedColorFormat(colorFormat)) {
|
||||||
throw new IllegalArgumentException("Unsupported color format: " + colorFormat);
|
throw new IllegalArgumentException("Unsupported color format: " + colorFormat);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class HardwareVideoEncoder implements VideoEncoder {
|
|||||||
// --- Initialized on construction.
|
// --- Initialized on construction.
|
||||||
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
|
private final MediaCodecWrapperFactory mediaCodecWrapperFactory;
|
||||||
private final String codecName;
|
private final String codecName;
|
||||||
private final VideoCodecType codecType;
|
private final VideoCodecMimeType codecType;
|
||||||
private final Integer surfaceColorFormat;
|
private final Integer surfaceColorFormat;
|
||||||
private final Integer yuvColorFormat;
|
private final Integer yuvColorFormat;
|
||||||
private final YuvFormat yuvFormat;
|
private final YuvFormat yuvFormat;
|
||||||
@ -180,7 +180,7 @@ class HardwareVideoEncoder implements VideoEncoder {
|
|||||||
* @throws IllegalArgumentException if colorFormat is unsupported
|
* @throws IllegalArgumentException if colorFormat is unsupported
|
||||||
*/
|
*/
|
||||||
public HardwareVideoEncoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
|
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,
|
Map<String, String> params, int keyFrameIntervalSec, int forceKeyFrameIntervalMs,
|
||||||
BitrateAdjuster bitrateAdjuster, EglBase14.Context sharedContext) {
|
BitrateAdjuster bitrateAdjuster, EglBase14.Context sharedContext) {
|
||||||
this.mediaCodecWrapperFactory = mediaCodecWrapperFactory;
|
this.mediaCodecWrapperFactory = mediaCodecWrapperFactory;
|
||||||
@ -240,7 +240,7 @@ class HardwareVideoEncoder implements VideoEncoder {
|
|||||||
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
|
format.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
|
||||||
format.setInteger(MediaFormat.KEY_FRAME_RATE, bitrateAdjuster.getCodecConfigFramerate());
|
format.setInteger(MediaFormat.KEY_FRAME_RATE, bitrateAdjuster.getCodecConfigFramerate());
|
||||||
format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, keyFrameIntervalSec);
|
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);
|
String profileLevelId = params.get(VideoCodecInfo.H264_FMTP_PROFILE_LEVEL_ID);
|
||||||
if (profileLevelId == null) {
|
if (profileLevelId == null) {
|
||||||
profileLevelId = VideoCodecInfo.H264_CONSTRAINED_BASELINE_3_1;
|
profileLevelId = VideoCodecInfo.H264_CONSTRAINED_BASELINE_3_1;
|
||||||
@ -465,11 +465,11 @@ class HardwareVideoEncoder implements VideoEncoder {
|
|||||||
public ScalingSettings getScalingSettings() {
|
public ScalingSettings getScalingSettings() {
|
||||||
encodeThreadChecker.checkIsOnValidThread();
|
encodeThreadChecker.checkIsOnValidThread();
|
||||||
if (automaticResizeOn) {
|
if (automaticResizeOn) {
|
||||||
if (codecType == VideoCodecType.VP8) {
|
if (codecType == VideoCodecMimeType.VP8) {
|
||||||
final int kLowVp8QpThreshold = 29;
|
final int kLowVp8QpThreshold = 29;
|
||||||
final int kHighVp8QpThreshold = 95;
|
final int kHighVp8QpThreshold = 95;
|
||||||
return new ScalingSettings(kLowVp8QpThreshold, kHighVp8QpThreshold);
|
return new ScalingSettings(kLowVp8QpThreshold, kHighVp8QpThreshold);
|
||||||
} else if (codecType == VideoCodecType.H264) {
|
} else if (codecType == VideoCodecMimeType.H264) {
|
||||||
final int kLowH264QpThreshold = 24;
|
final int kLowH264QpThreshold = 24;
|
||||||
final int kHighH264QpThreshold = 37;
|
final int kHighH264QpThreshold = 37;
|
||||||
return new ScalingSettings(kLowH264QpThreshold, kHighH264QpThreshold);
|
return new ScalingSettings(kLowH264QpThreshold, kHighH264QpThreshold);
|
||||||
@ -563,7 +563,7 @@ class HardwareVideoEncoder implements VideoEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ByteBuffer frameBuffer;
|
final ByteBuffer frameBuffer;
|
||||||
if (isKeyFrame && codecType == VideoCodecType.H264) {
|
if (isKeyFrame && codecType == VideoCodecMimeType.H264) {
|
||||||
Logging.d(TAG,
|
Logging.d(TAG,
|
||||||
"Prepending config frame of size " + configBuffer.capacity()
|
"Prepending config frame of size " + configBuffer.capacity()
|
||||||
+ " to output buffer with offset " + info.offset + ", size " + info.size);
|
+ " to output buffer with offset " + info.offset + ", size " + info.size);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class MediaCodecUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean codecSupportsType(MediaCodecInfo info, VideoCodecType type) {
|
static boolean codecSupportsType(MediaCodecInfo info, VideoCodecMimeType type) {
|
||||||
for (String mimeType : info.getSupportedTypes()) {
|
for (String mimeType : info.getSupportedTypes()) {
|
||||||
if (type.mimeType().equals(mimeType)) {
|
if (type.mimeType().equals(mimeType)) {
|
||||||
return true;
|
return true;
|
||||||
@ -85,7 +85,7 @@ class MediaCodecUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, String> getCodecProperties(VideoCodecType type, boolean highProfile) {
|
static Map<String, String> getCodecProperties(VideoCodecMimeType type, boolean highProfile) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VP8:
|
case VP8:
|
||||||
case VP9:
|
case VP9:
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
|
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
|
||||||
VideoCodecType type = VideoCodecType.valueOf(codecType.getName());
|
VideoCodecMimeType type = VideoCodecMimeType.valueOf(codecType.getName());
|
||||||
MediaCodecInfo info = findCodecForType(type);
|
MediaCodecInfo info = findCodecForType(type);
|
||||||
|
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
@ -64,12 +64,12 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
|
List<VideoCodecInfo> supportedCodecInfos = new ArrayList<VideoCodecInfo>();
|
||||||
// Generate a list of supported codecs in order of preference:
|
// Generate a list of supported codecs in order of preference:
|
||||||
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
|
// VP8, VP9, H264 (high profile), and H264 (baseline profile).
|
||||||
for (VideoCodecType type :
|
for (VideoCodecMimeType type : new VideoCodecMimeType[] {
|
||||||
new VideoCodecType[] {VideoCodecType.VP8, VideoCodecType.VP9, VideoCodecType.H264}) {
|
VideoCodecMimeType.VP8, VideoCodecMimeType.VP9, VideoCodecMimeType.H264}) {
|
||||||
MediaCodecInfo codec = findCodecForType(type);
|
MediaCodecInfo codec = findCodecForType(type);
|
||||||
if (codec != null) {
|
if (codec != null) {
|
||||||
String name = type.name();
|
String name = type.name();
|
||||||
if (type == VideoCodecType.H264 && isH264HighProfileSupported(codec)) {
|
if (type == VideoCodecMimeType.H264 && isH264HighProfileSupported(codec)) {
|
||||||
supportedCodecInfos.add(new VideoCodecInfo(
|
supportedCodecInfos.add(new VideoCodecInfo(
|
||||||
name, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true)));
|
name, MediaCodecUtils.getCodecProperties(type, /* highProfile= */ true)));
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);
|
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.
|
// HW decoding is not supported on builds before KITKAT.
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||||
return null;
|
return null;
|
||||||
@ -109,7 +109,7 @@ class MediaCodecVideoDecoderFactory implements VideoDecoderFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the given MediaCodecInfo indicates a supported encoder for the given type.
|
// 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();
|
String name = info.getName();
|
||||||
if (!MediaCodecUtils.codecSupportsType(info, type)) {
|
if (!MediaCodecUtils.codecSupportsType(info, type)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -11,14 +11,14 @@
|
|||||||
package org.webrtc;
|
package org.webrtc;
|
||||||
|
|
||||||
/** Enumeration of supported video codec types. */
|
/** Enumeration of supported video codec types. */
|
||||||
enum VideoCodecType {
|
enum VideoCodecMimeType {
|
||||||
VP8("video/x-vnd.on2.vp8"),
|
VP8("video/x-vnd.on2.vp8"),
|
||||||
VP9("video/x-vnd.on2.vp9"),
|
VP9("video/x-vnd.on2.vp9"),
|
||||||
H264("video/avc");
|
H264("video/avc");
|
||||||
|
|
||||||
private final String mimeType;
|
private final String mimeType;
|
||||||
|
|
||||||
private VideoCodecType(String mimeType) {
|
private VideoCodecMimeType(String mimeType) {
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class AndroidVideoDecoderTest {
|
|||||||
private boolean deliverDecodedFrameDone = true;
|
private boolean deliverDecodedFrameDone = true;
|
||||||
|
|
||||||
public TestDecoder(MediaCodecWrapperFactory mediaCodecFactory, String codecName,
|
public TestDecoder(MediaCodecWrapperFactory mediaCodecFactory, String codecName,
|
||||||
VideoCodecType codecType, int colorFormat, EglBase.Context sharedContext) {
|
VideoCodecMimeType codecType, int colorFormat, EglBase.Context sharedContext) {
|
||||||
super(mediaCodecFactory, codecName, codecType, colorFormat, sharedContext);
|
super(mediaCodecFactory, codecName, codecType, colorFormat, sharedContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,10 +143,10 @@ public class AndroidVideoDecoderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class TestDecoderBuilder {
|
private class TestDecoderBuilder {
|
||||||
private VideoCodecType codecType = VideoCodecType.VP8;
|
private VideoCodecMimeType codecType = VideoCodecMimeType.VP8;
|
||||||
private boolean useSurface = true;
|
private boolean useSurface = true;
|
||||||
|
|
||||||
public TestDecoderBuilder setCodecType(VideoCodecType codecType) {
|
public TestDecoderBuilder setCodecType(VideoCodecMimeType codecType) {
|
||||||
this.codecType = codecType;
|
this.codecType = codecType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -216,7 +216,8 @@ public class AndroidVideoDecoderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testInit() {
|
public void testInit() {
|
||||||
// Set-up.
|
// Set-up.
|
||||||
AndroidVideoDecoder decoder = new TestDecoderBuilder().setCodecType(VideoCodecType.VP8).build();
|
AndroidVideoDecoder decoder =
|
||||||
|
new TestDecoderBuilder().setCodecType(VideoCodecMimeType.VP8).build();
|
||||||
|
|
||||||
// Test.
|
// Test.
|
||||||
assertThat(decoder.initDecode(TEST_DECODER_SETTINGS, mockDecoderCallback))
|
assertThat(decoder.initDecode(TEST_DECODER_SETTINGS, mockDecoderCallback))
|
||||||
@ -232,7 +233,7 @@ public class AndroidVideoDecoderTest {
|
|||||||
assertThat(mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
assertThat(mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
||||||
.isEqualTo(TEST_DECODER_SETTINGS.height);
|
.isEqualTo(TEST_DECODER_SETTINGS.height);
|
||||||
assertThat(mediaFormat.getString(MediaFormat.KEY_MIME))
|
assertThat(mediaFormat.getString(MediaFormat.KEY_MIME))
|
||||||
.isEqualTo(VideoCodecType.VP8.mimeType());
|
.isEqualTo(VideoCodecMimeType.VP8.mimeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class HardwareVideoEncoderTest {
|
|||||||
private boolean deliverEncodedImageDone = true;
|
private boolean deliverEncodedImageDone = true;
|
||||||
|
|
||||||
TestEncoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
|
TestEncoder(MediaCodecWrapperFactory mediaCodecWrapperFactory, String codecName,
|
||||||
VideoCodecType codecType, Integer surfaceColorFormat, Integer yuvColorFormat,
|
VideoCodecMimeType codecType, Integer surfaceColorFormat, Integer yuvColorFormat,
|
||||||
Map<String, String> params, int keyFrameIntervalSec, int forceKeyFrameIntervalMs,
|
Map<String, String> params, int keyFrameIntervalSec, int forceKeyFrameIntervalMs,
|
||||||
BitrateAdjuster bitrateAdjuster, EglBase14.Context sharedContext) {
|
BitrateAdjuster bitrateAdjuster, EglBase14.Context sharedContext) {
|
||||||
super(mediaCodecWrapperFactory, codecName, codecType, surfaceColorFormat, yuvColorFormat,
|
super(mediaCodecWrapperFactory, codecName, codecType, surfaceColorFormat, yuvColorFormat,
|
||||||
@ -113,9 +113,9 @@ public class HardwareVideoEncoderTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class TestEncoderBuilder {
|
private class TestEncoderBuilder {
|
||||||
private VideoCodecType codecType = VideoCodecType.VP8;
|
private VideoCodecMimeType codecType = VideoCodecMimeType.VP8;
|
||||||
|
|
||||||
public TestEncoderBuilder setCodecType(VideoCodecType codecType) {
|
public TestEncoderBuilder setCodecType(VideoCodecMimeType codecType) {
|
||||||
this.codecType = codecType;
|
this.codecType = codecType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public class HardwareVideoEncoderTest {
|
|||||||
public void testInit() {
|
public void testInit() {
|
||||||
// Set-up.
|
// Set-up.
|
||||||
HardwareVideoEncoder encoder =
|
HardwareVideoEncoder encoder =
|
||||||
new TestEncoderBuilder().setCodecType(VideoCodecType.VP8).build();
|
new TestEncoderBuilder().setCodecType(VideoCodecMimeType.VP8).build();
|
||||||
|
|
||||||
// Test.
|
// Test.
|
||||||
assertThat(encoder.initEncode(TEST_ENCODER_SETTINGS, mockEncoderCallback))
|
assertThat(encoder.initEncode(TEST_ENCODER_SETTINGS, mockEncoderCallback))
|
||||||
@ -165,7 +165,7 @@ public class HardwareVideoEncoderTest {
|
|||||||
assertThat(mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
assertThat(mediaFormat.getInteger(MediaFormat.KEY_HEIGHT))
|
||||||
.isEqualTo(TEST_ENCODER_SETTINGS.height);
|
.isEqualTo(TEST_ENCODER_SETTINGS.height);
|
||||||
assertThat(mediaFormat.getString(MediaFormat.KEY_MIME))
|
assertThat(mediaFormat.getString(MediaFormat.KEY_MIME))
|
||||||
.isEqualTo(VideoCodecType.VP8.mimeType());
|
.isEqualTo(VideoCodecMimeType.VP8.mimeType());
|
||||||
|
|
||||||
assertThat(fakeMediaCodecWrapper.getConfiguredFlags())
|
assertThat(fakeMediaCodecWrapper.getConfiguredFlags())
|
||||||
.isEqualTo(MediaCodec.CONFIGURE_FLAG_ENCODE);
|
.isEqualTo(MediaCodec.CONFIGURE_FLAG_ENCODE);
|
||||||
|
|||||||
Reference in New Issue
Block a user