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

Side by Side Diff: webrtc/api/android/jni/androidmediaencoder_jni.cc

Issue 2497163002: Android HW encoder: Set constrained baseline as the profile (Closed)
Patch Set: Fix compile failures. Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 #include "webrtc/api/android/jni/classreferenceholder.h" 23 #include "webrtc/api/android/jni/classreferenceholder.h"
24 #include "webrtc/api/android/jni/native_handle_impl.h" 24 #include "webrtc/api/android/jni/native_handle_impl.h"
25 #include "webrtc/base/bind.h" 25 #include "webrtc/base/bind.h"
26 #include "webrtc/base/checks.h" 26 #include "webrtc/base/checks.h"
27 #include "webrtc/base/logging.h" 27 #include "webrtc/base/logging.h"
28 #include "webrtc/base/thread.h" 28 #include "webrtc/base/thread.h"
29 #include "webrtc/base/thread_checker.h" 29 #include "webrtc/base/thread_checker.h"
30 #include "webrtc/base/timeutils.h" 30 #include "webrtc/base/timeutils.h"
31 #include "webrtc/common_types.h" 31 #include "webrtc/common_types.h"
32 #include "webrtc/common_video/h264/h264_bitstream_parser.h" 32 #include "webrtc/common_video/h264/h264_bitstream_parser.h"
33 #include "webrtc/common_video/h264/profile_level_id.h"
33 #include "webrtc/media/engine/internalencoderfactory.h" 34 #include "webrtc/media/engine/internalencoderfactory.h"
34 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 35 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
35 #include "webrtc/modules/video_coding/utility/quality_scaler.h" 36 #include "webrtc/modules/video_coding/utility/quality_scaler.h"
36 #include "webrtc/modules/video_coding/utility/vp8_header_parser.h" 37 #include "webrtc/modules/video_coding/utility/vp8_header_parser.h"
37 #include "webrtc/system_wrappers/include/field_trial.h" 38 #include "webrtc/system_wrappers/include/field_trial.h"
38 #include "webrtc/system_wrappers/include/logcat_trace_context.h" 39 #include "webrtc/system_wrappers/include/logcat_trace_context.h"
39 40
40 using rtc::Bind; 41 using rtc::Bind;
41 using rtc::Thread; 42 using rtc::Thread;
42 using rtc::ThreadManager; 43 using rtc::ThreadManager;
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 ALOGD << "VP9 HW Encoder supported."; 1328 ALOGD << "VP9 HW Encoder supported.";
1328 supported_codecs_.push_back(cricket::VideoCodec("VP9")); 1329 supported_codecs_.push_back(cricket::VideoCodec("VP9"));
1329 } 1330 }
1330 1331
1331 bool is_h264_hw_supported = jni->CallStaticBooleanMethod( 1332 bool is_h264_hw_supported = jni->CallStaticBooleanMethod(
1332 j_encoder_class, 1333 j_encoder_class,
1333 GetStaticMethodID(jni, j_encoder_class, "isH264HwSupported", "()Z")); 1334 GetStaticMethodID(jni, j_encoder_class, "isH264HwSupported", "()Z"));
1334 CHECK_EXCEPTION(jni); 1335 CHECK_EXCEPTION(jni);
1335 if (is_h264_hw_supported) { 1336 if (is_h264_hw_supported) {
1336 ALOGD << "H.264 HW Encoder supported."; 1337 ALOGD << "H.264 HW Encoder supported.";
1337 supported_codecs_.push_back(cricket::VideoCodec("H264")); 1338 // TODO(magjed): Push Constrained High profile as well when negotiation is
1339 // ready, http://crbug/webrtc/6337. We can negotiate Constrained High
1340 // profile as long as we have decode support for it and still send Baseline
1341 // since Baseline is a subset of the High profile.
1342 cricket::VideoCodec constrained_baseline(cricket::kH264CodecName);
1343 // TODO(magjed): Enumerate actual level instead of using hardcoded level
1344 // 3.1. Level 3.1 is 1280x720@30fps which is enough for now.
1345 const webrtc::H264::ProfileLevelId constrained_baseline_profile(
1346 webrtc::H264::kProfileConstrainedBaseline, webrtc::H264::kLevel3_1);
1347 constrained_baseline.SetParam(
1348 cricket::kH264FmtpProfileLevelId,
1349 *webrtc::H264::ProfileLevelIdToString(constrained_baseline_profile));
1350 constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1");
1351 constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1");
1352 supported_codecs_.push_back(constrained_baseline);
1338 } 1353 }
1339 } 1354 }
1340 1355
1341 MediaCodecVideoEncoderFactory::~MediaCodecVideoEncoderFactory() { 1356 MediaCodecVideoEncoderFactory::~MediaCodecVideoEncoderFactory() {
1342 ALOGD << "MediaCodecVideoEncoderFactory dtor"; 1357 ALOGD << "MediaCodecVideoEncoderFactory dtor";
1343 if (egl_context_) { 1358 if (egl_context_) {
1344 JNIEnv* jni = AttachCurrentThreadIfNeeded(); 1359 JNIEnv* jni = AttachCurrentThreadIfNeeded();
1345 jni->DeleteGlobalRef(egl_context_); 1360 jni->DeleteGlobalRef(egl_context_);
1346 } 1361 }
1347 } 1362 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 return supported_codecs_; 1394 return supported_codecs_;
1380 } 1395 }
1381 1396
1382 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1397 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1383 webrtc::VideoEncoder* encoder) { 1398 webrtc::VideoEncoder* encoder) {
1384 ALOGD << "Destroy video encoder."; 1399 ALOGD << "Destroy video encoder.";
1385 delete encoder; 1400 delete encoder;
1386 } 1401 }
1387 1402
1388 } // namespace webrtc_jni 1403 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698