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 b94194fe53276d7e22194091bac7cd75aac8e267..40273991be558cd05f8e0e68c4d4fee89ae3505a 100644 |
--- a/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc |
+++ b/webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.cc |
@@ -12,37 +12,23 @@ |
#include "webrtc/base/logging.h" |
#include "webrtc/common_video/h264/profile_level_id.h" |
#include "webrtc/media/base/codec.h" |
-#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h" |
#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_decoder.h" |
+#include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h" |
+#include "webrtc/system_wrappers/include/field_trial.h" |
namespace webrtc { |
-// VideoToolboxVideoEncoderFactory |
+namespace { |
+const char kHighProfileExperiment[] = "WebRTC-H264HighProfile"; |
-VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() { |
- // 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::Level level = H264::kLevel3_1; |
+bool IsHighProfileEnabled() { |
+ return field_trial::FindFullName(kHighProfileExperiment) == "Enabled"; |
+} |
+} |
- cricket::VideoCodec constrained_high(cricket::kH264CodecName); |
- const H264::ProfileLevelId constrained_high_profile( |
- H264::kProfileConstrainedHigh, level); |
- constrained_high.SetParam( |
- cricket::kH264FmtpProfileLevelId, |
- *H264::ProfileLevelIdToString(constrained_high_profile)); |
- constrained_high.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); |
- constrained_high.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
- supported_codecs_.push_back(constrained_high); |
+// VideoToolboxVideoEncoderFactory |
- cricket::VideoCodec constrained_baseline(cricket::kH264CodecName); |
- const H264::ProfileLevelId constrained_baseline_profile( |
- H264::kProfileConstrainedBaseline, level); |
- 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); |
+VideoToolboxVideoEncoderFactory::VideoToolboxVideoEncoderFactory() { |
} |
VideoToolboxVideoEncoderFactory::~VideoToolboxVideoEncoderFactory() {} |
@@ -65,6 +51,34 @@ void VideoToolboxVideoEncoderFactory::DestroyVideoEncoder( |
const std::vector<cricket::VideoCodec>& |
VideoToolboxVideoEncoderFactory::supported_codecs() const { |
+ supported_codecs_.clear(); |
+ |
+ // 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::Level level = H264::kLevel3_1; |
+ |
+ if (IsHighProfileEnabled()) { |
+ cricket::VideoCodec constrained_high(cricket::kH264CodecName); |
+ const H264::ProfileLevelId constrained_high_profile( |
+ H264::kProfileConstrainedHigh, level); |
+ constrained_high.SetParam( |
+ cricket::kH264FmtpProfileLevelId, |
+ *H264::ProfileLevelIdToString(constrained_high_profile)); |
+ constrained_high.SetParam(cricket::kH264FmtpLevelAsymmetryAllowed, "1"); |
+ constrained_high.SetParam(cricket::kH264FmtpPacketizationMode, "1"); |
+ supported_codecs_.push_back(constrained_high); |
+ } |
+ |
+ cricket::VideoCodec constrained_baseline(cricket::kH264CodecName); |
+ const H264::ProfileLevelId constrained_baseline_profile( |
+ H264::kProfileConstrainedBaseline, level); |
+ 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); |
+ |
return supported_codecs_; |
} |