blob: f338805746db4848a1430054451ba077c4f021e0 [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_receive_stream.h"
aleloi440b6d92017-08-22 05:43:23 -070012
13namespace webrtc {
14
15VideoReceiveStream::Decoder::Decoder() = default;
16VideoReceiveStream::Decoder::Decoder(const Decoder&) = default;
17VideoReceiveStream::Decoder::~Decoder() = default;
18
19std::string VideoReceiveStream::Decoder::ToString() const {
20 std::stringstream ss;
21 ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr");
22 ss << ", payload_type: " << payload_type;
23 ss << ", payload_name: " << payload_name;
24 ss << ", codec_params: {";
25 for (const auto& it : codec_params)
26 ss << it.first << ": " << it.second;
27 ss << '}';
28 ss << '}';
29
30 return ss.str();
31}
32
33VideoReceiveStream::Stats::Stats() = default;
34VideoReceiveStream::Stats::~Stats() = default;
35
36std::string VideoReceiveStream::Stats::ToString(int64_t time_ms) const {
37 std::stringstream ss;
38 ss << "VideoReceiveStream stats: " << time_ms << ", {ssrc: " << ssrc << ", ";
39 ss << "total_bps: " << total_bitrate_bps << ", ";
40 ss << "width: " << width << ", ";
41 ss << "height: " << height << ", ";
42 ss << "key: " << frame_counts.key_frames << ", ";
43 ss << "delta: " << frame_counts.delta_frames << ", ";
44 ss << "network_fps: " << network_frame_rate << ", ";
45 ss << "decode_fps: " << decode_frame_rate << ", ";
46 ss << "render_fps: " << render_frame_rate << ", ";
47 ss << "decode_ms: " << decode_ms << ", ";
48 ss << "max_decode_ms: " << max_decode_ms << ", ";
49 ss << "cur_delay_ms: " << current_delay_ms << ", ";
50 ss << "targ_delay_ms: " << target_delay_ms << ", ";
51 ss << "jb_delay_ms: " << jitter_buffer_ms << ", ";
52 ss << "min_playout_delay_ms: " << min_playout_delay_ms << ", ";
53 ss << "discarded: " << discarded_packets << ", ";
54 ss << "sync_offset_ms: " << sync_offset_ms << ", ";
55 ss << "cum_loss: " << rtcp_stats.packets_lost << ", ";
56 ss << "max_ext_seq: " << rtcp_stats.extended_highest_sequence_number << ", ";
57 ss << "nack: " << rtcp_packet_type_counts.nack_packets << ", ";
58 ss << "fir: " << rtcp_packet_type_counts.fir_packets << ", ";
59 ss << "pli: " << rtcp_packet_type_counts.pli_packets;
60 ss << '}';
61 return ss.str();
62}
63
64VideoReceiveStream::Config::Config(const Config&) = default;
65VideoReceiveStream::Config::Config(Config&&) = default;
66VideoReceiveStream::Config::Config(Transport* rtcp_send_transport)
67 : rtcp_send_transport(rtcp_send_transport) {}
68
69VideoReceiveStream::Config& VideoReceiveStream::Config::operator=(Config&&) =
70 default;
71VideoReceiveStream::Config::Config::~Config() = default;
72
73std::string VideoReceiveStream::Config::ToString() const {
74 std::stringstream ss;
75 ss << "{decoders: [";
76 for (size_t i = 0; i < decoders.size(); ++i) {
77 ss << decoders[i].ToString();
78 if (i != decoders.size() - 1)
79 ss << ", ";
80 }
81 ss << ']';
82 ss << ", rtp: " << rtp.ToString();
83 ss << ", renderer: " << (renderer ? "(renderer)" : "nullptr");
84 ss << ", render_delay_ms: " << render_delay_ms;
85 if (!sync_group.empty())
86 ss << ", sync_group: " << sync_group;
87 ss << ", pre_decode_callback: "
88 << (pre_decode_callback ? "(EncodedFrameObserver)" : "nullptr");
89 ss << ", target_delay_ms: " << target_delay_ms;
90 ss << '}';
91
92 return ss.str();
93}
94
95VideoReceiveStream::Config::Rtp::Rtp() = default;
96VideoReceiveStream::Config::Rtp::Rtp(const Rtp&) = default;
97VideoReceiveStream::Config::Rtp::~Rtp() = default;
98
99std::string VideoReceiveStream::Config::Rtp::ToString() const {
100 std::stringstream ss;
101 ss << "{remote_ssrc: " << remote_ssrc;
102 ss << ", local_ssrc: " << local_ssrc;
103 ss << ", rtcp_mode: "
104 << (rtcp_mode == RtcpMode::kCompound ? "RtcpMode::kCompound"
105 : "RtcpMode::kReducedSize");
106 ss << ", rtcp_xr: ";
107 ss << "{receiver_reference_time_report: "
108 << (rtcp_xr.receiver_reference_time_report ? "on" : "off");
109 ss << '}';
110 ss << ", remb: " << (remb ? "on" : "off");
111 ss << ", transport_cc: " << (transport_cc ? "on" : "off");
112 ss << ", nack: {rtp_history_ms: " << nack.rtp_history_ms << '}';
nisse3b3622f2017-09-26 02:49:21 -0700113 ss << ", ulpfec_payload_type: " << ulpfec_payload_type;
114 ss << ", red_type: " << red_payload_type;
aleloi440b6d92017-08-22 05:43:23 -0700115 ss << ", rtx_ssrc: " << rtx_ssrc;
116 ss << ", rtx_payload_types: {";
nisse26e3abb2017-08-25 04:44:25 -0700117 for (auto& kv : rtx_associated_payload_types) {
118 ss << kv.first << " (pt) -> " << kv.second << " (apt), ";
aleloi440b6d92017-08-22 05:43:23 -0700119 }
120 ss << '}';
121 ss << ", extensions: [";
122 for (size_t i = 0; i < extensions.size(); ++i) {
123 ss << extensions[i].ToString();
124 if (i != extensions.size() - 1)
125 ss << ", ";
126 }
127 ss << ']';
128 ss << '}';
129 return ss.str();
130}
131
132} // namespace webrtc