| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 RTC_DCHECK_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); | 139 RTC_DCHECK_EQ(1U, config.rtp.flexfec.protected_media_ssrcs.size()); |
| 140 return std::unique_ptr<FlexfecSender>(new FlexfecSender( | 140 return std::unique_ptr<FlexfecSender>(new FlexfecSender( |
| 141 config.rtp.flexfec.payload_type, config.rtp.flexfec.ssrc, | 141 config.rtp.flexfec.payload_type, config.rtp.flexfec.ssrc, |
| 142 config.rtp.flexfec.protected_media_ssrcs[0], config.rtp.extensions, | 142 config.rtp.flexfec.protected_media_ssrcs[0], config.rtp.extensions, |
| 143 RTPSender::FecExtensionSizes(), rtp_state, Clock::GetRealTimeClock())); | 143 RTPSender::FecExtensionSizes(), rtp_state, Clock::GetRealTimeClock())); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace | 146 } // namespace |
| 147 | 147 |
| 148 std::string | |
| 149 VideoSendStream::Config::EncoderSettings::ToString() const { | |
| 150 std::stringstream ss; | |
| 151 ss << "{payload_name: " << payload_name; | |
| 152 ss << ", payload_type: " << payload_type; | |
| 153 ss << ", encoder: " << (encoder ? "(VideoEncoder)" : "nullptr"); | |
| 154 ss << '}'; | |
| 155 return ss.str(); | |
| 156 } | |
| 157 | |
| 158 std::string VideoSendStream::Config::Rtp::Rtx::ToString() | |
| 159 const { | |
| 160 std::stringstream ss; | |
| 161 ss << "{ssrcs: ["; | |
| 162 for (size_t i = 0; i < ssrcs.size(); ++i) { | |
| 163 ss << ssrcs[i]; | |
| 164 if (i != ssrcs.size() - 1) | |
| 165 ss << ", "; | |
| 166 } | |
| 167 ss << ']'; | |
| 168 | |
| 169 ss << ", payload_type: " << payload_type; | |
| 170 ss << '}'; | |
| 171 return ss.str(); | |
| 172 } | |
| 173 | |
| 174 std::string VideoSendStream::Config::Rtp::ToString() const { | |
| 175 std::stringstream ss; | |
| 176 ss << "{ssrcs: ["; | |
| 177 for (size_t i = 0; i < ssrcs.size(); ++i) { | |
| 178 ss << ssrcs[i]; | |
| 179 if (i != ssrcs.size() - 1) | |
| 180 ss << ", "; | |
| 181 } | |
| 182 ss << ']'; | |
| 183 ss << ", rtcp_mode: " | |
| 184 << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound" | |
| 185 : "RtcpMode::kReducedSize"); | |
| 186 ss << ", max_packet_size: " << max_packet_size; | |
| 187 ss << ", extensions: ["; | |
| 188 for (size_t i = 0; i < extensions.size(); ++i) { | |
| 189 ss << extensions[i].ToString(); | |
| 190 if (i != extensions.size() - 1) | |
| 191 ss << ", "; | |
| 192 } | |
| 193 ss << ']'; | |
| 194 | |
| 195 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}'; | |
| 196 ss << ", ulpfec: " << ulpfec.ToString(); | |
| 197 | |
| 198 ss << ", flexfec: {payload_type: " << flexfec.payload_type; | |
| 199 ss << ", ssrc: " << flexfec.ssrc; | |
| 200 ss << ", protected_media_ssrcs: ["; | |
| 201 for (size_t i = 0; i < flexfec.protected_media_ssrcs.size(); ++i) { | |
| 202 ss << flexfec.protected_media_ssrcs[i]; | |
| 203 if (i != flexfec.protected_media_ssrcs.size() - 1) | |
| 204 ss << ", "; | |
| 205 } | |
| 206 ss << "]}"; | |
| 207 | |
| 208 ss << ", rtx: " << rtx.ToString(); | |
| 209 ss << ", c_name: " << c_name; | |
| 210 ss << '}'; | |
| 211 return ss.str(); | |
| 212 } | |
| 213 | |
| 214 std::string VideoSendStream::Config::ToString() const { | |
| 215 std::stringstream ss; | |
| 216 ss << "{encoder_settings: " << encoder_settings.ToString(); | |
| 217 ss << ", rtp: " << rtp.ToString(); | |
| 218 ss << ", pre_encode_callback: " | |
| 219 << (pre_encode_callback ? "(VideoSinkInterface)" : "nullptr"); | |
| 220 ss << ", post_encode_callback: " | |
| 221 << (post_encode_callback ? "(EncodedFrameObserver)" : "nullptr"); | |
| 222 ss << ", render_delay_ms: " << render_delay_ms; | |
| 223 ss << ", target_delay_ms: " << target_delay_ms; | |
| 224 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" | |
| 225 : "off"); | |
| 226 ss << '}'; | |
| 227 return ss.str(); | |
| 228 } | |
| 229 | |
| 230 std::string VideoSendStream::Stats::ToString(int64_t time_ms) const { | |
| 231 std::stringstream ss; | |
| 232 ss << "VideoSendStream stats: " << time_ms << ", {"; | |
| 233 ss << "input_fps: " << input_frame_rate << ", "; | |
| 234 ss << "encode_fps: " << encode_frame_rate << ", "; | |
| 235 ss << "encode_ms: " << avg_encode_time_ms << ", "; | |
| 236 ss << "encode_usage_perc: " << encode_usage_percent << ", "; | |
| 237 ss << "target_bps: " << target_media_bitrate_bps << ", "; | |
| 238 ss << "media_bps: " << media_bitrate_bps << ", "; | |
| 239 ss << "preferred_media_bitrate_bps: " << preferred_media_bitrate_bps << ", "; | |
| 240 ss << "suspended: " << (suspended ? "true" : "false") << ", "; | |
| 241 ss << "bw_adapted: " << (bw_limited_resolution ? "true" : "false"); | |
| 242 ss << '}'; | |
| 243 for (const auto& substream : substreams) { | |
| 244 if (!substream.second.is_rtx && !substream.second.is_flexfec) { | |
| 245 ss << " {ssrc: " << substream.first << ", "; | |
| 246 ss << substream.second.ToString(); | |
| 247 ss << '}'; | |
| 248 } | |
| 249 } | |
| 250 return ss.str(); | |
| 251 } | |
| 252 | |
| 253 std::string VideoSendStream::StreamStats::ToString() const { | |
| 254 std::stringstream ss; | |
| 255 ss << "width: " << width << ", "; | |
| 256 ss << "height: " << height << ", "; | |
| 257 ss << "key: " << frame_counts.key_frames << ", "; | |
| 258 ss << "delta: " << frame_counts.delta_frames << ", "; | |
| 259 ss << "total_bps: " << total_bitrate_bps << ", "; | |
| 260 ss << "retransmit_bps: " << retransmit_bitrate_bps << ", "; | |
| 261 ss << "avg_delay_ms: " << avg_delay_ms << ", "; | |
| 262 ss << "max_delay_ms: " << max_delay_ms << ", "; | |
| 263 ss << "cum_loss: " << rtcp_stats.packets_lost << ", "; | |
| 264 ss << "max_ext_seq: " << rtcp_stats.extended_highest_sequence_number << ", "; | |
| 265 ss << "nack: " << rtcp_packet_type_counts.nack_packets << ", "; | |
| 266 ss << "fir: " << rtcp_packet_type_counts.fir_packets << ", "; | |
| 267 ss << "pli: " << rtcp_packet_type_counts.pli_packets; | |
| 268 return ss.str(); | |
| 269 } | |
| 270 | |
| 271 namespace { | 148 namespace { |
| 272 | 149 |
| 273 bool PayloadTypeSupportsSkippingFecPackets(const std::string& payload_name) { | 150 bool PayloadTypeSupportsSkippingFecPackets(const std::string& payload_name) { |
| 274 rtc::Optional<VideoCodecType> codecType = | 151 rtc::Optional<VideoCodecType> codecType = |
| 275 PayloadNameToCodecType(payload_name); | 152 PayloadNameToCodecType(payload_name); |
| 276 if (codecType && | 153 if (codecType && |
| 277 (*codecType == kVideoCodecVP8 || *codecType == kVideoCodecVP9)) { | 154 (*codecType == kVideoCodecVP8 || *codecType == kVideoCodecVP9)) { |
| 278 return true; | 155 return true; |
| 279 } | 156 } |
| 280 RTC_DCHECK((codecType && *codecType == kVideoCodecH264) || | 157 RTC_DCHECK((codecType && *codecType == kVideoCodecH264) || |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 std::min(config_->rtp.max_packet_size, | 1256 std::min(config_->rtp.max_packet_size, |
| 1380 kPathMTU - transport_overhead_bytes_per_packet_); | 1257 kPathMTU - transport_overhead_bytes_per_packet_); |
| 1381 | 1258 |
| 1382 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 1259 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 1383 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); | 1260 rtp_rtcp->SetMaxRtpPacketSize(rtp_packet_size); |
| 1384 } | 1261 } |
| 1385 } | 1262 } |
| 1386 | 1263 |
| 1387 } // namespace internal | 1264 } // namespace internal |
| 1388 } // namespace webrtc | 1265 } // namespace webrtc |
| OLD | NEW |