OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 | 1206 |
1207 bool is_vp9_hw_supported = jni->CallStaticBooleanMethod( | 1207 bool is_vp9_hw_supported = jni->CallStaticBooleanMethod( |
1208 j_encoder_class, | 1208 j_encoder_class, |
1209 GetStaticMethodID(jni, j_encoder_class, "isVp9HwSupported", "()Z")); | 1209 GetStaticMethodID(jni, j_encoder_class, "isVp9HwSupported", "()Z")); |
1210 CHECK_EXCEPTION(jni); | 1210 CHECK_EXCEPTION(jni); |
1211 if (is_vp9_hw_supported) { | 1211 if (is_vp9_hw_supported) { |
1212 ALOGD << "VP9 HW Encoder supported."; | 1212 ALOGD << "VP9 HW Encoder supported."; |
1213 supported_codecs_.push_back(cricket::VideoCodec("VP9")); | 1213 supported_codecs_.push_back(cricket::VideoCodec("VP9")); |
1214 } | 1214 } |
1215 | 1215 |
| 1216 bool is_h264_high_porfile_hw_supported = jni->CallStaticBooleanMethod( |
| 1217 j_encoder_class, |
| 1218 GetStaticMethodID(jni, j_encoder_class, "isH264HighProfileHwSupported", |
| 1219 "()Z")); |
| 1220 CHECK_EXCEPTION(jni); |
| 1221 if (is_h264_high_porfile_hw_supported) { |
| 1222 ALOGD << "H.264 High Profile HW Encoder supported."; |
| 1223 // TODO(magjed): Enumerate actual level instead of using hardcoded level |
| 1224 // 3.1. Level 3.1 is 1280x720@30fps which is enough for now. |
| 1225 cricket::VideoCodec avc_high(cricket::kH264CodecName); |
| 1226 const webrtc::H264::ProfileLevelId high_profile(webrtc::H264::kProfileHigh, |
| 1227 webrtc::H264::kLevel3_1); |
| 1228 avc_high.SetParam(cricket::kH264FmtpProfileLevelId, |
| 1229 *webrtc::H264::ProfileLevelIdToString(high_profile)); |
| 1230 avc_high.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); |
| 1231 avc_high.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
| 1232 supported_codecs_.push_back(avc_high); |
| 1233 } |
| 1234 |
1216 bool is_h264_hw_supported = jni->CallStaticBooleanMethod( | 1235 bool is_h264_hw_supported = jni->CallStaticBooleanMethod( |
1217 j_encoder_class, | 1236 j_encoder_class, |
1218 GetStaticMethodID(jni, j_encoder_class, "isH264HwSupported", "()Z")); | 1237 GetStaticMethodID(jni, j_encoder_class, "isH264HwSupported", "()Z")); |
1219 CHECK_EXCEPTION(jni); | 1238 CHECK_EXCEPTION(jni); |
1220 if (is_h264_hw_supported) { | 1239 if (is_h264_hw_supported) { |
1221 ALOGD << "H.264 HW Encoder supported."; | 1240 ALOGD << "H.264 HW Encoder supported."; |
1222 // TODO(magjed): Push Constrained High profile as well when negotiation is | 1241 // TODO(magjed): Push Constrained High profile as well when negotiation is |
1223 // ready, http://crbug/webrtc/6337. We can negotiate Constrained High | 1242 // ready, http://crbug/webrtc/6337. We can negotiate Constrained High |
1224 // profile as long as we have decode support for it and still send Baseline | 1243 // profile as long as we have decode support for it and still send Baseline |
1225 // since Baseline is a subset of the High profile. | 1244 // since Baseline is a subset of the High profile. |
1226 cricket::VideoCodec constrained_baseline(cricket::kH264CodecName); | 1245 cricket::VideoCodec avc_constrained_baseline(cricket::kH264CodecName); |
1227 // TODO(magjed): Enumerate actual level instead of using hardcoded level | |
1228 // 3.1. Level 3.1 is 1280x720@30fps which is enough for now. | |
1229 const webrtc::H264::ProfileLevelId constrained_baseline_profile( | 1246 const webrtc::H264::ProfileLevelId constrained_baseline_profile( |
1230 webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1); | 1247 webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1); |
1231 constrained_baseline.SetParam( | 1248 avc_constrained_baseline.SetParam( |
1232 cricket::kH264FmtpProfileLevelId, | 1249 cricket::kH264FmtpProfileLevelId, |
1233 *webrtc::H264::ProfileLevelIdToString(constrained_baseline_profile)); | 1250 *webrtc::H264::ProfileLevelIdToString(constrained_baseline_profile)); |
1234 constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); | 1251 avc_constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, |
1235 constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1"); | 1252 "1"); |
1236 supported_codecs_.push_back(constrained_baseline); | 1253 avc_constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
| 1254 supported_codecs_.push_back(avc_constrained_baseline); |
1237 } | 1255 } |
1238 } | 1256 } |
1239 | 1257 |
1240 MediaCodecVideoEncoderFactory::~MediaCodecVideoEncoderFactory() { | 1258 MediaCodecVideoEncoderFactory::~MediaCodecVideoEncoderFactory() { |
1241 ALOGD << "MediaCodecVideoEncoderFactory dtor"; | 1259 ALOGD << "MediaCodecVideoEncoderFactory dtor"; |
1242 if (egl_context_) { | 1260 if (egl_context_) { |
1243 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 1261 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
1244 jni->DeleteGlobalRef(egl_context_); | 1262 jni->DeleteGlobalRef(egl_context_); |
1245 } | 1263 } |
1246 } | 1264 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 return supported_codecs_; | 1297 return supported_codecs_; |
1280 } | 1298 } |
1281 | 1299 |
1282 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1300 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1283 webrtc::VideoEncoder* encoder) { | 1301 webrtc::VideoEncoder* encoder) { |
1284 ALOGD << "Destroy video encoder."; | 1302 ALOGD << "Destroy video encoder."; |
1285 delete encoder; | 1303 delete encoder; |
1286 } | 1304 } |
1287 | 1305 |
1288 } // namespace webrtc_jni | 1306 } // namespace webrtc_jni |
OLD | NEW |