Put iOS H264 High profile under a field trial
H264 High profile is causing problems for some downstream apps. Therefore, put it behind a field trial instead. BUG=webrtc:6337 Review-Url: https://codereview.webrtc.org/2580963004 Cr-Commit-Position: refs/heads/master@{#15663}
This commit is contained in:
@ -20,6 +20,7 @@ NSString * const kRTCFieldTrialAudioSendSideBweKey = @"WebRTC-Audio-SendSideBwe"
|
||||
NSString * const kRTCFieldTrialFlexFec03Key = @"WebRTC-FlexFEC-03";
|
||||
NSString * const kRTCFieldTrialImprovedBitrateEstimateKey = @"WebRTC-ImprovedBitrateEstimate";
|
||||
NSString * const kRTCFieldTrialTrendlineFilterKey = @"WebRTC-BweTrendlineFilter";
|
||||
NSString * const kRTCFieldTrialH264HighProfileKey = @"WebRTC-H264HighProfile";
|
||||
NSString * const kRTCFieldTrialEnabledValue = @"Enabled";
|
||||
|
||||
static std::unique_ptr<char[]> gFieldTrialInitString;
|
||||
|
||||
@ -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 {
|
||||
|
||||
namespace {
|
||||
const char kHighProfileExperiment[] = "WebRTC-H264HighProfile";
|
||||
|
||||
bool IsHighProfileEnabled() {
|
||||
return field_trial::FindFullName(kHighProfileExperiment) == "Enabled";
|
||||
}
|
||||
}
|
||||
|
||||
// VideoToolboxVideoEncoderFactory
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,9 @@ class VideoToolboxVideoEncoderFactory
|
||||
const std::vector<cricket::VideoCodec>& supported_codecs() const override;
|
||||
|
||||
private:
|
||||
std::vector<cricket::VideoCodec> supported_codecs_;
|
||||
// TODO(magjed): Mutable because it depends on a field trial and it is
|
||||
// recalculated every call to supported_codecs().
|
||||
mutable std::vector<cricket::VideoCodec> supported_codecs_;
|
||||
};
|
||||
|
||||
class VideoToolboxVideoDecoderFactory
|
||||
|
||||
Reference in New Issue
Block a user