OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include "webrtc/video/video_send_stream.h" | 10 #include "webrtc/video/video_send_stream.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 rtp_rtcp->SetSendingMediaStatus(false); | 84 rtp_rtcp->SetSendingMediaStatus(false); |
85 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); | 85 rtp_rtcp->SetRTCPStatus(RtcpMode::kCompound); |
86 modules.push_back(rtp_rtcp); | 86 modules.push_back(rtp_rtcp); |
87 } | 87 } |
88 return modules; | 88 return modules; |
89 } | 89 } |
90 | 90 |
91 // TODO(brandtr): Update this function when we support multistream protection. | 91 // TODO(brandtr): Update this function when we support multistream protection. |
92 std::unique_ptr<FlexfecSender> MaybeCreateFlexfecSender( | 92 std::unique_ptr<FlexfecSender> MaybeCreateFlexfecSender( |
93 const VideoSendStream::Config& config) { | 93 const VideoSendStream::Config& config) { |
94 if (config.rtp.flexfec.flexfec_payload_type < 0) { | 94 if (config.rtp.flexfec.payload_type < 0) { |
95 return nullptr; | 95 return nullptr; |
96 } | 96 } |
97 RTC_DCHECK_GE(config.rtp.flexfec.flexfec_payload_type, 0); | 97 RTC_DCHECK_GE(config.rtp.flexfec.payload_type, 0); |
98 RTC_DCHECK_LE(config.rtp.flexfec.flexfec_payload_type, 127); | 98 RTC_DCHECK_LE(config.rtp.flexfec.payload_type, 127); |
99 if (config.rtp.flexfec.flexfec_ssrc == 0) { | 99 if (config.rtp.flexfec.ssrc == 0) { |
100 LOG(LS_WARNING) << "FlexFEC is enabled, but no FlexFEC SSRC given. " | 100 LOG(LS_WARNING) << "FlexFEC is enabled, but no FlexFEC SSRC given. " |
101 "Therefore disabling FlexFEC."; | 101 "Therefore disabling FlexFEC."; |
102 return nullptr; | 102 return nullptr; |
103 } | 103 } |
104 if (config.rtp.flexfec.protected_media_ssrcs.empty()) { | 104 if (config.rtp.flexfec.protected_media_ssrcs.empty()) { |
105 LOG(LS_WARNING) << "FlexFEC is enabled, but no protected media SSRC given. " | 105 LOG(LS_WARNING) << "FlexFEC is enabled, but no protected media SSRC given. " |
106 "Therefore disabling FlexFEC."; | 106 "Therefore disabling FlexFEC."; |
107 return nullptr; | 107 return nullptr; |
108 } | 108 } |
109 | 109 |
110 if (config.rtp.ssrcs.size() > 1) { | 110 if (config.rtp.ssrcs.size() > 1) { |
111 LOG(LS_WARNING) << "Both FlexFEC and simulcast are enabled. This " | 111 LOG(LS_WARNING) << "Both FlexFEC and simulcast are enabled. This " |
112 "combination is however not supported by our current " | 112 "combination is however not supported by our current " |
113 "FlexFEC implementation. Therefore disabling FlexFEC."; | 113 "FlexFEC implementation. Therefore disabling FlexFEC."; |
114 return nullptr; | 114 return nullptr; |
115 } | 115 } |
116 | 116 |
117 if (config.rtp.flexfec.protected_media_ssrcs.size() > 1) { | 117 if (config.rtp.flexfec.protected_media_ssrcs.size() > 1) { |
118 LOG(LS_WARNING) | 118 LOG(LS_WARNING) |
119 << "The supplied FlexfecConfig contained multiple protected " | 119 << "The supplied FlexfecConfig contained multiple protected " |
120 "media streams, but our implementation currently only " | 120 "media streams, but our implementation currently only " |
121 "supports protecting a single media stream. " | 121 "supports protecting a single media stream. " |
122 "To avoid confusion, disabling FlexFEC completely."; | 122 "To avoid confusion, disabling FlexFEC completely."; |
123 return nullptr; | 123 return nullptr; |
124 } | 124 } |
125 | 125 |
126 RTC_DCHECK_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); | 126 RTC_DCHECK_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); |
127 return std::unique_ptr<FlexfecSender>(new FlexfecSender( | 127 return std::unique_ptr<FlexfecSender>(new FlexfecSender( |
128 config.rtp.flexfec.flexfec_payload_type, config.rtp.flexfec.flexfec_ssrc, | 128 config.rtp.flexfec.payload_type, config.rtp.flexfec.ssrc, |
129 config.rtp.flexfec.protected_media_ssrcs[0], config.rtp.extensions, | 129 config.rtp.flexfec.protected_media_ssrcs[0], config.rtp.extensions, |
130 Clock::GetRealTimeClock())); | 130 Clock::GetRealTimeClock())); |
131 } | 131 } |
132 | 132 |
133 } // namespace | 133 } // namespace |
134 | 134 |
135 std::string | 135 std::string |
136 VideoSendStream::Config::EncoderSettings::ToString() const { | 136 VideoSendStream::Config::EncoderSettings::ToString() const { |
137 std::stringstream ss; | 137 std::stringstream ss; |
138 ss << "{payload_name: " << payload_name; | 138 ss << "{payload_name: " << payload_name; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 ss << ", extensions: ["; | 174 ss << ", extensions: ["; |
175 for (size_t i = 0; i < extensions.size(); ++i) { | 175 for (size_t i = 0; i < extensions.size(); ++i) { |
176 ss << extensions[i].ToString(); | 176 ss << extensions[i].ToString(); |
177 if (i != extensions.size() - 1) | 177 if (i != extensions.size() - 1) |
178 ss << ", "; | 178 ss << ", "; |
179 } | 179 } |
180 ss << ']'; | 180 ss << ']'; |
181 | 181 |
182 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; | 182 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; |
183 ss << ", ulpfec: " << ulpfec.ToString(); | 183 ss << ", ulpfec: " << ulpfec.ToString(); |
184 ss << ", flexfec: " << flexfec.ToString(); | 184 |
185 ss << ", flexfec: {payload_type: " << flexfec.payload_type; | |
186 ss << ", ssrc: " << flexfec.ssrc; | |
187 ss << ", protected_media_ssrcs: ["; | |
188 size_t i = 0; | |
189 for (; i + 1 < flexfec.protected_media_ssrcs.size(); ++i) | |
190 ss << flexfec.protected_media_ssrcs[i] << ", "; | |
191 if (!flexfec.protected_media_ssrcs.empty()) | |
192 ss << flexfec.protected_media_ssrcs[i]; | |
stefan-webrtc
2017/01/10 11:43:25
Write this code in a similar fashion as line 175-1
brandtr
2017/01/10 12:17:27
Done.
Need to land https://codereview.webrtc.org/
| |
193 ss << ']'; | |
194 | |
185 ss << ", rtx: " << rtx.ToString(); | 195 ss << ", rtx: " << rtx.ToString(); |
186 ss << ", c_name: " << c_name; | 196 ss << ", c_name: " << c_name; |
187 ss << '}'; | 197 ss << '}'; |
188 return ss.str(); | 198 return ss.str(); |
189 } | 199 } |
190 | 200 |
191 std::string VideoSendStream::Config::ToString() const { | 201 std::string VideoSendStream::Config::ToString() const { |
192 std::stringstream ss; | 202 std::stringstream ss; |
193 ss << "{encoder_settings: " << encoder_settings.ToString(); | 203 ss << "{encoder_settings: " << encoder_settings.ToString(); |
194 ss << ", rtp: " << rtp.ToString(); | 204 ss << ", rtp: " << rtp.ToString(); |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1270 const uint16_t mtu = static_cast<uint16_t>( | 1280 const uint16_t mtu = static_cast<uint16_t>( |
1271 config_->rtp.max_packet_size + transport_overhead_bytes_per_packet); | 1281 config_->rtp.max_packet_size + transport_overhead_bytes_per_packet); |
1272 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1282 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
1273 rtp_rtcp->SetTransportOverhead(transport_overhead_bytes_per_packet); | 1283 rtp_rtcp->SetTransportOverhead(transport_overhead_bytes_per_packet); |
1274 rtp_rtcp->SetMaxTransferUnit(mtu); | 1284 rtp_rtcp->SetMaxTransferUnit(mtu); |
1275 } | 1285 } |
1276 } | 1286 } |
1277 | 1287 |
1278 } // namespace internal | 1288 } // namespace internal |
1279 } // namespace webrtc | 1289 } // namespace webrtc |
OLD | NEW |