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

Unified Diff: webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc

Issue 2484493002: Prepare iOS H264 HW encoder for High Profile (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
diff --git a/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc b/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
index b7a5141dfd29a9432f9ee8f89a5cd3636f4ec256..8bfcf705fb75fbef8683708e0cbb89b8e2764b3f 100644
--- a/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
+++ b/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc
@@ -10,6 +10,7 @@
#include "webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h"
#include "webrtc/base/logging.h"
+#include "webrtc/common_video/h264/profile_level_id.h"
#include "webrtc/media/base/codec.h"
#if defined(WEBRTC_IOS)
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h"
@@ -38,7 +39,19 @@ namespace webrtc {
VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() {
// Hardware H264 encoding only supported on iOS for now.
#if defined(WEBRTC_IOS)
- supported_codecs_.push_back(cricket::VideoCodec(cricket::kH264CodecName));
+ // TODO(magjed): Push Constrained High profile as well when negotiation is
+ // ready, http://crbug/webrtc/6337.
+ 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.
+ const H264::ProfileLevelId constrained_baseline_profile(
+ H264::kProfileConstrainedBaseline, H264::kLevel3_1);
tkchin_webrtc 2016/11/14 18:27:27 I don't know how this will affect the encoder. But
magjed_webrtc 2016/11/15 17:14:24 It looks good in AppRTCMobile as far as I can tell
+ constrained_baseline.SetParam(
+ cricket::kH264FmtpProfileLevelId,
+ *H264::ProfileLevelIdToString(constrained_baseline_profile));
+ constrained_baseline.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1");
+ constrained_baseline.SetParam(cricket::kH264FmtpPacketizationMode, "1");
+ supported_codecs_.push_back(constrained_baseline);
#endif
}
@@ -49,7 +62,7 @@ VideoEncoder* VideoToolboxVideoEncoderFactory::CreateVideoEncoder(
#if defined(WEBRTC_IOS)
if (IsCodecSupported(supported_codecs_, codec)) {
LOG(LS_INFO) << "Creating HW encoder for " << codec.name;
- return new H264VideoToolboxEncoder();
+ return new H264VideoToolboxEncoder(codec);
}
#endif
LOG(LS_INFO) << "No HW encoder found for codec " << codec.name;

Powered by Google App Engine
This is Rietveld 408576698