Automate conversion from c++ VideoCodeType to java VideoCodecType

Bug: b/148146536
Change-Id: I030c7c6c2a1a9d002bcc60f45c8d6025bd0935b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167301
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30751}
This commit is contained in:
Danil Chapovalov
2020-03-10 13:57:07 +01:00
committed by Commit Bot
parent 984dc32776
commit 59f3b71c04
8 changed files with 29 additions and 50 deletions

View File

@ -134,20 +134,6 @@ public class MediaCodecVideoDecoder {
private static final String FORMAT_KEY_CROP_TOP = "crop-top";
private static final String FORMAT_KEY_CROP_BOTTOM = "crop-bottom";
// Tracks webrtc::VideoCodecType.
public enum VideoCodecType {
VIDEO_CODEC_UNKNOWN,
VIDEO_CODEC_VP8,
VIDEO_CODEC_VP9,
VIDEO_CODEC_AV1,
VIDEO_CODEC_H264;
@CalledByNative("VideoCodecType")
static VideoCodecType fromNativeIndex(int nativeIndex) {
return values()[nativeIndex];
}
}
// Timeout for input buffer dequeue.
private static final int DEQUEUE_INPUT_TIMEOUT = 500000;
// Timeout for codec releasing.
@ -423,7 +409,7 @@ public class MediaCodecVideoDecoder {
}
@CalledByNativeUnchecked
private boolean initDecode(VideoCodecType type, int width, int height) {
private boolean initDecode(@VideoCodecType int type, int width, int height) {
if (mediaCodecThread != null) {
throw new RuntimeException("initDecode: Forgot to release()?");
}

View File

@ -135,20 +135,6 @@ public class MediaCodecVideoEncoder {
}
}
// Tracks webrtc::VideoCodecType.
public enum VideoCodecType {
VIDEO_CODEC_UNKNOWN,
VIDEO_CODEC_VP8,
VIDEO_CODEC_VP9,
VIDEO_CODEC_AV1,
VIDEO_CODEC_H264;
@CalledByNative("VideoCodecType")
static VideoCodecType fromNativeIndex(int nativeIndex) {
return values()[nativeIndex];
}
}
private static final int MEDIA_CODEC_RELEASE_TIMEOUT_MS = 5000; // Timeout for codec releasing.
private static final int DEQUEUE_TIMEOUT = 0; // Non-blocking, no wait.
private static final int BITRATE_ADJUSTMENT_FPS = 30;
@ -331,7 +317,7 @@ public class MediaCodecVideoEncoder {
CodecCapabilities.COLOR_QCOM_FormatYUV420SemiPlanar,
COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m};
private static final int[] supportedSurfaceColorList = {CodecCapabilities.COLOR_FormatSurface};
private VideoCodecType type;
@VideoCodecType private int type;
private int colorFormat;
// Variables used for dynamic bitrate adjustment.
@ -559,8 +545,8 @@ public class MediaCodecVideoEncoder {
}
@CalledByNativeUnchecked
boolean initEncode(VideoCodecType type, int profile, int width, int height, int kbps, int fps,
boolean useSurface) {
boolean initEncode(@VideoCodecType int type, int profile, int width, int height, int kbps,
int fps, boolean useSurface) {
Logging.d(TAG,
"Java initEncode: " + type + ". Profile: " + profile + " : " + width + " x " + height
+ ". @ " + kbps + " kbps. Fps: " + fps + ". Encode from texture : " + useSurface);