blob: 8d3f62cb1f725a9d6c9557bbf2a1d5e80612b2f9 [file] [log] [blame]
aleloi440b6d92017-08-22 05:43:23 -07001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#include "call/video_send_stream.h"
Yves Gerey988cc082018-10-23 12:03:01 +020012
13#include <utility>
14
Steve Anton10542f22019-01-11 09:11:00 -080015#include "api/crypto/frame_encryptor_interface.h"
Jonas Olsson0a713b62018-04-04 15:49:32 +020016#include "rtc_base/strings/string_builder.h"
aleloi440b6d92017-08-22 05:43:23 -070017
18namespace webrtc {
19
20VideoSendStream::StreamStats::StreamStats() = default;
21VideoSendStream::StreamStats::~StreamStats() = default;
22
23std::string VideoSendStream::StreamStats::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020024 char buf[1024];
25 rtc::SimpleStringBuilder ss(buf);
aleloi440b6d92017-08-22 05:43:23 -070026 ss << "width: " << width << ", ";
27 ss << "height: " << height << ", ";
28 ss << "key: " << frame_counts.key_frames << ", ";
29 ss << "delta: " << frame_counts.delta_frames << ", ";
30 ss << "total_bps: " << total_bitrate_bps << ", ";
31 ss << "retransmit_bps: " << retransmit_bitrate_bps << ", ";
32 ss << "avg_delay_ms: " << avg_delay_ms << ", ";
33 ss << "max_delay_ms: " << max_delay_ms << ", ";
34 ss << "cum_loss: " << rtcp_stats.packets_lost << ", ";
35 ss << "max_ext_seq: " << rtcp_stats.extended_highest_sequence_number << ", ";
36 ss << "nack: " << rtcp_packet_type_counts.nack_packets << ", ";
37 ss << "fir: " << rtcp_packet_type_counts.fir_packets << ", ";
38 ss << "pli: " << rtcp_packet_type_counts.pli_packets;
39 return ss.str();
40}
41
42VideoSendStream::Stats::Stats() = default;
43VideoSendStream::Stats::~Stats() = default;
44
45std::string VideoSendStream::Stats::ToString(int64_t time_ms) const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020046 char buf[1024];
47 rtc::SimpleStringBuilder ss(buf);
aleloi440b6d92017-08-22 05:43:23 -070048 ss << "VideoSendStream stats: " << time_ms << ", {";
49 ss << "input_fps: " << input_frame_rate << ", ";
50 ss << "encode_fps: " << encode_frame_rate << ", ";
51 ss << "encode_ms: " << avg_encode_time_ms << ", ";
52 ss << "encode_usage_perc: " << encode_usage_percent << ", ";
53 ss << "target_bps: " << target_media_bitrate_bps << ", ";
54 ss << "media_bps: " << media_bitrate_bps << ", ";
aleloi440b6d92017-08-22 05:43:23 -070055 ss << "suspended: " << (suspended ? "true" : "false") << ", ";
Rasmus Brandt034f1912019-04-16 14:46:49 +000056 ss << "bw_adapted: " << (bw_limited_resolution ? "true" : "false");
aleloi440b6d92017-08-22 05:43:23 -070057 ss << '}';
58 for (const auto& substream : substreams) {
59 if (!substream.second.is_rtx && !substream.second.is_flexfec) {
60 ss << " {ssrc: " << substream.first << ", ";
61 ss << substream.second.ToString();
62 ss << '}';
63 }
64 }
65 return ss.str();
66}
67
68VideoSendStream::Config::Config(const Config&) = default;
69VideoSendStream::Config::Config(Config&&) = default;
Niels Möller46879152019-01-07 15:54:47 +010070VideoSendStream::Config::Config(Transport* send_transport,
71 MediaTransportInterface* media_transport)
72 : send_transport(send_transport), media_transport(media_transport) {}
aleloi440b6d92017-08-22 05:43:23 -070073VideoSendStream::Config::Config(Transport* send_transport)
Niels Möller46879152019-01-07 15:54:47 +010074 : Config(send_transport, nullptr) {}
aleloi440b6d92017-08-22 05:43:23 -070075
76VideoSendStream::Config& VideoSendStream::Config::operator=(Config&&) = default;
77VideoSendStream::Config::Config::~Config() = default;
78
79std::string VideoSendStream::Config::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020080 char buf[2 * 1024];
81 rtc::SimpleStringBuilder ss(buf);
Niels Möller213618e2018-07-24 09:29:58 +020082 ss << "{encoder_settings: { experiment_cpu_load_estimator: "
83 << (encoder_settings.experiment_cpu_load_estimator ? "on" : "off") << "}}";
aleloi440b6d92017-08-22 05:43:23 -070084 ss << ", rtp: " << rtp.ToString();
Jiawei Ou55718122018-11-09 13:17:39 -080085 ss << ", rtcp_report_interval_ms: " << rtcp_report_interval_ms;
Niels Möller46879152019-01-07 15:54:47 +010086 ss << ", send_transport: " << (send_transport ? "(Transport)" : "nullptr");
87 ss << ", media_transport: " << (media_transport ? "(Transport)" : "nullptr");
aleloi440b6d92017-08-22 05:43:23 -070088 ss << ", render_delay_ms: " << render_delay_ms;
89 ss << ", target_delay_ms: " << target_delay_ms;
90 ss << ", suspend_below_min_bitrate: "
91 << (suspend_below_min_bitrate ? "on" : "off");
92 ss << '}';
93 return ss.str();
94}
95
aleloi440b6d92017-08-22 05:43:23 -070096} // namespace webrtc