blob: c8ba308fa54236a2bf05733a4146b119c4d7371e [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
Benjamin Wright192eeec2018-10-17 17:27:25 -070015#include "api/crypto/frameencryptorinterface.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") << ", ";
56 ss << "bw_adapted: " << (bw_limited_resolution ? "true" : "false");
57 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;
70VideoSendStream::Config::Config(Transport* send_transport)
71 : send_transport(send_transport) {}
72
73VideoSendStream::Config& VideoSendStream::Config::operator=(Config&&) = default;
74VideoSendStream::Config::Config::~Config() = default;
75
76std::string VideoSendStream::Config::ToString() const {
Jonas Olsson0a713b62018-04-04 15:49:32 +020077 char buf[2 * 1024];
78 rtc::SimpleStringBuilder ss(buf);
Niels Möller213618e2018-07-24 09:29:58 +020079 ss << "{encoder_settings: { experiment_cpu_load_estimator: "
80 << (encoder_settings.experiment_cpu_load_estimator ? "on" : "off") << "}}";
aleloi440b6d92017-08-22 05:43:23 -070081 ss << ", rtp: " << rtp.ToString();
Jiawei Ou55718122018-11-09 13:17:39 -080082 ss << ", rtcp_report_interval_ms: " << rtcp_report_interval_ms;
aleloi440b6d92017-08-22 05:43:23 -070083 ss << ", pre_encode_callback: "
84 << (pre_encode_callback ? "(VideoSinkInterface)" : "nullptr");
aleloi440b6d92017-08-22 05:43:23 -070085 ss << ", render_delay_ms: " << render_delay_ms;
86 ss << ", target_delay_ms: " << target_delay_ms;
87 ss << ", suspend_below_min_bitrate: "
88 << (suspend_below_min_bitrate ? "on" : "off");
89 ss << '}';
90 return ss.str();
91}
92
aleloi440b6d92017-08-22 05:43:23 -070093} // namespace webrtc