OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
11 #include "webrtc/media/engine/internalencoderfactory.h" | 11 #include "webrtc/media/engine/internalencoderfactory.h" |
12 | 12 |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
18 #include "webrtc/system_wrappers/include/field_trial.h" | 18 #include "webrtc/system_wrappers/include/field_trial.h" |
19 | 19 |
20 namespace cricket { | 20 namespace cricket { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const char kFlexfecFieldTrialName[] = "WebRTC-FlexFEC-03"; | 24 // If this field trial is enabled, the "flexfec-03" codec will be advertised |
25 | 25 // as being supported by the InternalEncoderFactory. This means that |
26 bool IsFlexfecFieldTrialEnabled() { | 26 // "flexfec-03" will appear in the default local SDP, and we therefore need to |
27 return webrtc::field_trial::IsEnabled(kFlexfecFieldTrialName); | 27 // be ready to receive FlexFEC packets from the remote. |
| 28 bool IsFlexfecAdvertisedFieldTrialEnabled() { |
| 29 return webrtc::field_trial::FindFullName("WebRTC-FlexFEC-03-Advertised") == |
| 30 "Enabled"; |
28 } | 31 } |
29 | 32 |
30 } // namespace | 33 } // namespace |
31 | 34 |
32 InternalEncoderFactory::InternalEncoderFactory() { | 35 InternalEncoderFactory::InternalEncoderFactory() { |
33 supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName)); | 36 supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName)); |
34 if (webrtc::VP9Encoder::IsSupported()) | 37 if (webrtc::VP9Encoder::IsSupported()) |
35 supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName)); | 38 supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName)); |
36 if (webrtc::H264Encoder::IsSupported()) { | 39 if (webrtc::H264Encoder::IsSupported()) { |
37 cricket::VideoCodec codec(kH264CodecName); | 40 cricket::VideoCodec codec(kH264CodecName); |
38 // TODO(magjed): Move setting these parameters into webrtc::H264Encoder | 41 // TODO(magjed): Move setting these parameters into webrtc::H264Encoder |
39 // instead. | 42 // instead. |
40 codec.SetParam(kH264FmtpProfileLevelId, | 43 codec.SetParam(kH264FmtpProfileLevelId, |
41 kH264ProfileLevelConstrainedBaseline); | 44 kH264ProfileLevelConstrainedBaseline); |
42 codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1"); | 45 codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1"); |
43 supported_codecs_.push_back(std::move(codec)); | 46 supported_codecs_.push_back(std::move(codec)); |
44 } | 47 } |
45 | 48 |
46 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName)); | 49 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName)); |
47 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName)); | 50 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName)); |
48 | 51 |
49 if (IsFlexfecFieldTrialEnabled()) { | 52 if (IsFlexfecAdvertisedFieldTrialEnabled()) { |
50 cricket::VideoCodec flexfec_codec(kFlexfecCodecName); | 53 cricket::VideoCodec flexfec_codec(kFlexfecCodecName); |
51 // This value is currently arbitrarily set to 10 seconds. (The unit | 54 // This value is currently arbitrarily set to 10 seconds. (The unit |
52 // is microseconds.) This parameter MUST be present in the SDP, but | 55 // is microseconds.) This parameter MUST be present in the SDP, but |
53 // we never use the actual value anywhere in our code however. | 56 // we never use the actual value anywhere in our code however. |
54 // TODO(brandtr): Consider honouring this value in the sender and receiver. | 57 // TODO(brandtr): Consider honouring this value in the sender and receiver. |
55 flexfec_codec.SetParam(kFlexfecFmtpRepairWindow, "10000000"); | 58 flexfec_codec.SetParam(kFlexfecFmtpRepairWindow, "10000000"); |
56 flexfec_codec.AddFeedbackParam( | 59 flexfec_codec.AddFeedbackParam( |
57 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); | 60 FeedbackParam(kRtcpFbParamTransportCc, kParamValueEmpty)); |
58 flexfec_codec.AddFeedbackParam( | 61 flexfec_codec.AddFeedbackParam( |
59 FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); | 62 FeedbackParam(kRtcpFbParamRemb, kParamValueEmpty)); |
(...skipping 25 matching lines...) Expand all Loading... |
85 InternalEncoderFactory::supported_codecs() const { | 88 InternalEncoderFactory::supported_codecs() const { |
86 return supported_codecs_; | 89 return supported_codecs_; |
87 } | 90 } |
88 | 91 |
89 void InternalEncoderFactory::DestroyVideoEncoder( | 92 void InternalEncoderFactory::DestroyVideoEncoder( |
90 webrtc::VideoEncoder* encoder) { | 93 webrtc::VideoEncoder* encoder) { |
91 delete encoder; | 94 delete encoder; |
92 } | 95 } |
93 | 96 |
94 } // namespace cricket | 97 } // namespace cricket |
OLD | NEW |