Index: webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc |
diff --git a/webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc b/webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc |
index 17c6a1833cbdc59a0f6532f600b95ca7fada2c8b..206bc1eb5a911f5da582ce154bcdd6c7ef4fecda 100644 |
--- a/webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc |
+++ b/webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc |
@@ -1213,6 +1213,25 @@ MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() |
supported_codecs_.push_back(cricket::VideoCodec("VP9")); |
} |
+ bool is_h264_high_porfile_hw_supported = jni->CallStaticBooleanMethod( |
+ j_encoder_class, |
+ GetStaticMethodID(jni, j_encoder_class, "isH264HighProfileHwSupported", |
+ "()Z")); |
+ CHECK_EXCEPTION(jni); |
+ if (is_h264_high_porfile_hw_supported) { |
+ ALOGD << "H.264 High Profile HW Encoder supported."; |
+ // TODO(magjed): Enumerate actual level instead of using hardcoded level |
+ // 3.1. Level 3.1 is 1280x720@30fps which is enough for now. |
+ cricket::VideoCodec avc_high(cricket::kH264CodecName); |
+ const webrtc::H264::ProfileLevelId high_profile(webrtc::H264::kProfileHigh, |
+ webrtc::H264::kLevel3_1); |
+ avc_high.SetParam(cricket::kH264FmtpProfileLevelId, |
+ *webrtc::H264::ProfileLevelIdToString(high_profile)); |
+ avc_high.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); |
+ avc_high.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
+ supported_codecs_.push_back(avc_high); |
+ } |
+ |
bool is_h264_hw_supported = jni->CallStaticBooleanMethod( |
j_encoder_class, |
GetStaticMethodID(jni, j_encoder_class, "isH264HwSupported", "()Z")); |
@@ -1223,17 +1242,16 @@ MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() |
// ready, http://crbug/webrtc/6337. We can negotiate Constrained High |
// profile as long as we have decode support for it and still send Baseline |
// since Baseline is a subset of the High profile. |
- cricket::VideoCodec constrained_baseline(cricket::kH264CodecName); |
- // TODO(magjed): Enumerate actual level instead of using hardcoded level |
- // 3.1. Level 3.1 is 1280x720@30fps which is enough for now. |
+ cricket::VideoCodec avc_constrained_baseline(cricket::kH264CodecName); |
const webrtc::H264::ProfileLevelId constrained_baseline_profile( |
webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1); |
- constrained_baseline.SetParam( |
+ avc_constrained_baseline.SetParam( |
cricket::kH264FmtpProfileLevelId, |
*webrtc::H264::ProfileLevelIdToString(constrained_baseline_profile)); |
- constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); |
- constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
- supported_codecs_.push_back(constrained_baseline); |
+ avc_constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, |
+ "1"); |
+ avc_constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
+ supported_codecs_.push_back(avc_constrained_baseline); |
} |
} |