OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "webrtc/voice_engine/include/voe_codec.h" | 21 #include "webrtc/voice_engine/include/voe_codec.h" |
22 #include "webrtc/voice_engine/include/voe_neteq_stats.h" | 22 #include "webrtc/voice_engine/include/voe_neteq_stats.h" |
23 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 23 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
24 #include "webrtc/voice_engine/include/voe_video_sync.h" | 24 #include "webrtc/voice_engine/include/voe_video_sync.h" |
25 #include "webrtc/voice_engine/include/voe_volume_control.h" | 25 #include "webrtc/voice_engine/include/voe_volume_control.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 std::string AudioReceiveStream::Config::Rtp::ToString() const { | 28 std::string AudioReceiveStream::Config::Rtp::ToString() const { |
29 std::stringstream ss; | 29 std::stringstream ss; |
30 ss << "{remote_ssrc: " << remote_ssrc; | 30 ss << "{remote_ssrc: " << remote_ssrc; |
31 ss << ", local_ssrc: " << local_ssrc; | |
31 ss << ", extensions: ["; | 32 ss << ", extensions: ["; |
32 for (size_t i = 0; i < extensions.size(); ++i) { | 33 for (size_t i = 0; i < extensions.size(); ++i) { |
33 ss << extensions[i].ToString(); | 34 ss << extensions[i].ToString(); |
34 if (i != extensions.size() - 1) { | 35 if (i != extensions.size() - 1) { |
35 ss << ", "; | 36 ss << ", "; |
36 } | 37 } |
37 } | 38 } |
38 ss << ']'; | 39 ss << ']'; |
39 ss << '}'; | 40 ss << '}'; |
40 return ss.str(); | 41 return ss.str(); |
41 } | 42 } |
42 | 43 |
43 std::string AudioReceiveStream::Config::ToString() const { | 44 std::string AudioReceiveStream::Config::ToString() const { |
44 std::stringstream ss; | 45 std::stringstream ss; |
45 ss << "{rtp: " << rtp.ToString(); | 46 ss << "{rtp: " << rtp.ToString(); |
47 ss << ", receive_transport: " | |
48 << (receive_transport ? "(Transport)" : "nullptr"); | |
49 ss << ", rtcp_send_transport: " | |
50 << (rtcp_send_transport ? "(Transport)" : "nullptr"); | |
46 ss << ", voe_channel_id: " << voe_channel_id; | 51 ss << ", voe_channel_id: " << voe_channel_id; |
47 if (!sync_group.empty()) { | 52 if (!sync_group.empty()) { |
48 ss << ", sync_group: " << sync_group; | 53 ss << ", sync_group: " << sync_group; |
49 } | 54 } |
55 ss << ", combined_audio_video_bwe: " | |
56 << (combined_audio_video_bwe ? "true" : "false"); | |
50 ss << '}'; | 57 ss << '}'; |
51 return ss.str(); | 58 return ss.str(); |
52 } | 59 } |
53 | 60 |
54 namespace internal { | 61 namespace internal { |
55 AudioReceiveStream::AudioReceiveStream( | 62 AudioReceiveStream::AudioReceiveStream( |
56 RemoteBitrateEstimator* remote_bitrate_estimator, | 63 RemoteBitrateEstimator* remote_bitrate_estimator, |
57 const webrtc::AudioReceiveStream::Config& config, | 64 const webrtc::AudioReceiveStream::Config& config, |
58 VoiceEngine* voice_engine) | 65 VoiceEngine* voice_engine) |
59 : remote_bitrate_estimator_(remote_bitrate_estimator), | 66 : remote_bitrate_estimator_(remote_bitrate_estimator), |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { | 101 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { |
95 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 102 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
96 webrtc::AudioReceiveStream::Stats stats; | 103 webrtc::AudioReceiveStream::Stats stats; |
97 stats.remote_ssrc = config_.rtp.remote_ssrc; | 104 stats.remote_ssrc = config_.rtp.remote_ssrc; |
98 ScopedVoEInterface<VoECodec> codec(voice_engine_); | 105 ScopedVoEInterface<VoECodec> codec(voice_engine_); |
99 ScopedVoEInterface<VoENetEqStats> neteq(voice_engine_); | 106 ScopedVoEInterface<VoENetEqStats> neteq(voice_engine_); |
100 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine_); | 107 ScopedVoEInterface<VoERTP_RTCP> rtp(voice_engine_); |
101 ScopedVoEInterface<VoEVideoSync> sync(voice_engine_); | 108 ScopedVoEInterface<VoEVideoSync> sync(voice_engine_); |
102 ScopedVoEInterface<VoEVolumeControl> volume(voice_engine_); | 109 ScopedVoEInterface<VoEVolumeControl> volume(voice_engine_); |
103 unsigned int ssrc = 0; | 110 unsigned int ssrc = 0; |
104 webrtc::CallStatistics cs = {0}; | 111 webrtc::CallStatistics call_stats = {0}; |
tommi
2015/10/23 12:50:37
nice :)
the sun
2015/10/23 15:14:17
Acknowledged.
| |
105 webrtc::CodecInst ci = {0}; | 112 webrtc::CodecInst codec_inst = {0}; |
106 // Only collect stats if we have seen some traffic with the SSRC. | 113 // Only collect stats if we have seen some traffic with the SSRC. |
107 if (rtp->GetRemoteSSRC(config_.voe_channel_id, ssrc) == -1 || | 114 if (rtp->GetRemoteSSRC(config_.voe_channel_id, ssrc) == -1 || |
108 rtp->GetRTCPStatistics(config_.voe_channel_id, cs) == -1 || | 115 rtp->GetRTCPStatistics(config_.voe_channel_id, call_stats) == -1 || |
109 codec->GetRecCodec(config_.voe_channel_id, ci) == -1) { | 116 codec->GetRecCodec(config_.voe_channel_id, codec_inst) == -1) { |
110 return stats; | 117 return stats; |
111 } | 118 } |
112 | 119 |
113 stats.bytes_rcvd = cs.bytesReceived; | 120 stats.bytes_rcvd = call_stats.bytesReceived; |
114 stats.packets_rcvd = cs.packetsReceived; | 121 stats.packets_rcvd = call_stats.packetsReceived; |
115 stats.packets_lost = cs.cumulativeLost; | 122 stats.packets_lost = call_stats.cumulativeLost; |
116 stats.fraction_lost = static_cast<float>(cs.fractionLost) / (1 << 8); | 123 stats.fraction_lost = Q8ToFloat(call_stats.fractionLost); |
117 if (ci.pltype != -1) { | 124 if (codec_inst.pltype != -1) { |
118 stats.codec_name = ci.plname; | 125 stats.codec_name = codec_inst.plname; |
119 } | 126 } |
120 | 127 stats.ext_seqnum = call_stats.extendedMax; |
121 stats.ext_seqnum = cs.extendedMax; | 128 if (codec_inst.plfreq / 1000 > 0) { |
122 if (ci.plfreq / 1000 > 0) { | 129 stats.jitter_ms = call_stats.jitterSamples / (codec_inst.plfreq / 1000); |
123 stats.jitter_ms = cs.jitterSamples / (ci.plfreq / 1000); | |
124 } | 130 } |
125 { | 131 { |
126 int jitter_buffer_delay_ms = 0; | 132 int jitter_buffer_delay_ms = 0; |
127 int playout_buffer_delay_ms = 0; | 133 int playout_buffer_delay_ms = 0; |
128 sync->GetDelayEstimate(config_.voe_channel_id, &jitter_buffer_delay_ms, | 134 sync->GetDelayEstimate(config_.voe_channel_id, &jitter_buffer_delay_ms, |
129 &playout_buffer_delay_ms); | 135 &playout_buffer_delay_ms); |
130 stats.delay_estimate_ms = | 136 stats.delay_estimate_ms = |
131 jitter_buffer_delay_ms + playout_buffer_delay_ms; | 137 jitter_buffer_delay_ms + playout_buffer_delay_ms; |
132 } | 138 } |
133 { | 139 { |
(...skipping 20 matching lines...) Expand all Loading... | |
154 if (neteq->GetDecodingCallStatistics(config_.voe_channel_id, &ds) != -1) { | 160 if (neteq->GetDecodingCallStatistics(config_.voe_channel_id, &ds) != -1) { |
155 stats.decoding_calls_to_silence_generator = | 161 stats.decoding_calls_to_silence_generator = |
156 ds.calls_to_silence_generator; | 162 ds.calls_to_silence_generator; |
157 stats.decoding_calls_to_neteq = ds.calls_to_neteq; | 163 stats.decoding_calls_to_neteq = ds.calls_to_neteq; |
158 stats.decoding_normal = ds.decoded_normal; | 164 stats.decoding_normal = ds.decoded_normal; |
159 stats.decoding_plc = ds.decoded_plc; | 165 stats.decoding_plc = ds.decoded_plc; |
160 stats.decoding_cng = ds.decoded_cng; | 166 stats.decoding_cng = ds.decoded_cng; |
161 stats.decoding_plc_cng = ds.decoded_plc_cng; | 167 stats.decoding_plc_cng = ds.decoded_plc_cng; |
162 } | 168 } |
163 | 169 |
164 stats.capture_start_ntp_time_ms = cs.capture_start_ntp_time_ms_; | 170 stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_; |
165 | 171 |
166 return stats; | 172 return stats; |
167 } | 173 } |
168 | 174 |
169 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 175 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
170 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 176 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
171 return config_; | 177 return config_; |
172 } | 178 } |
173 | 179 |
174 void AudioReceiveStream::Start() { | 180 void AudioReceiveStream::Start() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 if (packet_time.timestamp >= 0) | 218 if (packet_time.timestamp >= 0) |
213 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 219 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
214 size_t payload_size = length - header.headerLength; | 220 size_t payload_size = length - header.headerLength; |
215 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, | 221 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, |
216 header, false); | 222 header, false); |
217 } | 223 } |
218 return true; | 224 return true; |
219 } | 225 } |
220 } // namespace internal | 226 } // namespace internal |
221 } // namespace webrtc | 227 } // namespace webrtc |
OLD | NEW |