Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: webrtc/api/android/jni/androidmediaencoder_jni.cc

Issue 2449993003: Replace WebRtcVideoEncoderFactory::VideoCodec with cricket::VideoCodec (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/android/jni/androidmediaencoder_jni.cc
diff --git a/webrtc/api/android/jni/androidmediaencoder_jni.cc b/webrtc/api/android/jni/androidmediaencoder_jni.cc
index 9ee99f0495c05fde1541b6591700dc3217e0cd28..a3d0ca594c38e1ed145e5806712a4271c3ac59b7 100644
--- a/webrtc/api/android/jni/androidmediaencoder_jni.cc
+++ b/webrtc/api/android/jni/androidmediaencoder_jni.cc
@@ -57,9 +57,6 @@ namespace webrtc_jni {
#define H264_SC_LENGTH 4
// Maximum allowed NALUs in one output frame.
#define MAX_NALUS_PERFRAME 32
-// Maximum supported HW video encoder resolution.
-#define MAX_VIDEO_WIDTH 1280
-#define MAX_VIDEO_HEIGHT 1280
// Maximum supported HW video encoder fps.
#define MAX_VIDEO_FPS 30
// Maximum allowed fps value in SetRates() call.
@@ -1310,8 +1307,7 @@ MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory()
CHECK_EXCEPTION(jni);
if (is_vp8_hw_supported) {
ALOGD << "VP8 HW Encoder supported.";
- supported_codecs_.push_back(VideoCodec(kVideoCodecVP8, "VP8",
- MAX_VIDEO_WIDTH, MAX_VIDEO_HEIGHT, MAX_VIDEO_FPS));
+ supported_codecs_.push_back(cricket::VideoCodec("VP8"));
}
bool is_vp9_hw_supported = jni->CallStaticBooleanMethod(
@@ -1320,8 +1316,7 @@ MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory()
CHECK_EXCEPTION(jni);
if (is_vp9_hw_supported) {
ALOGD << "VP9 HW Encoder supported.";
- supported_codecs_.push_back(VideoCodec(kVideoCodecVP9, "VP9",
- MAX_VIDEO_WIDTH, MAX_VIDEO_HEIGHT, MAX_VIDEO_FPS));
+ supported_codecs_.push_back(cricket::VideoCodec("VP9"));
}
bool is_h264_hw_supported = jni->CallStaticBooleanMethod(
@@ -1330,8 +1325,7 @@ MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory()
CHECK_EXCEPTION(jni);
if (is_h264_hw_supported) {
ALOGD << "H.264 HW Encoder supported.";
- supported_codecs_.push_back(VideoCodec(kVideoCodecH264, "H264",
- MAX_VIDEO_WIDTH, MAX_VIDEO_HEIGHT, MAX_VIDEO_FPS));
+ supported_codecs_.push_back(cricket::VideoCodec("H264"));
}
}
@@ -1357,26 +1351,25 @@ void MediaCodecVideoEncoderFactory::SetEGLContext(
}
webrtc::VideoEncoder* MediaCodecVideoEncoderFactory::CreateVideoEncoder(
- VideoCodecType type) {
+ const cricket::VideoCodec& codec) {
if (supported_codecs_.empty()) {
- ALOGW << "No HW video encoder for type " << (int)type;
+ ALOGW << "No HW video encoder for codec " << codec.name;
return nullptr;
}
- for (std::vector<VideoCodec>::const_iterator it = supported_codecs_.begin();
- it != supported_codecs_.end(); ++it) {
- if (it->type == type) {
- ALOGD << "Create HW video encoder for type " << (int)type <<
- " (" << it->name << ").";
+ for (const cricket::VideoCodec& supported_codec : supported_codecs_) {
+ if (supported_codec.Matches(codec)) {
+ ALOGD << "Create HW video encoder for " << codec.name;
+ const VideoCodecType type = cricket::CodecTypeFromName(codec.name);
return new MediaCodecVideoEncoder(AttachCurrentThreadIfNeeded(), type,
egl_context_);
}
}
- ALOGW << "Can not find HW video encoder for type " << (int)type;
+ ALOGW << "Can not find HW video encoder for type " << codec.name;
return nullptr;
}
-const std::vector<MediaCodecVideoEncoderFactory::VideoCodec>&
-MediaCodecVideoEncoderFactory::codecs() const {
+const std::vector<cricket::VideoCodec>&
+MediaCodecVideoEncoderFactory::supported_codecs() const {
return supported_codecs_;
}

Powered by Google App Engine
This is Rietveld 408576698