| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 sinfo.residual_echo_likelihood_recent_max = | 2258 sinfo.residual_echo_likelihood_recent_max = |
| 2259 stats.residual_echo_likelihood_recent_max; | 2259 stats.residual_echo_likelihood_recent_max; |
| 2260 sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false); | 2260 sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false); |
| 2261 sinfo.ana_statistics = stats.ana_statistics; | 2261 sinfo.ana_statistics = stats.ana_statistics; |
| 2262 info->senders.push_back(sinfo); | 2262 info->senders.push_back(sinfo); |
| 2263 } | 2263 } |
| 2264 | 2264 |
| 2265 // Get SSRC and stats for each receiver. | 2265 // Get SSRC and stats for each receiver. |
| 2266 RTC_DCHECK_EQ(info->receivers.size(), 0U); | 2266 RTC_DCHECK_EQ(info->receivers.size(), 0U); |
| 2267 for (const auto& stream : recv_streams_) { | 2267 for (const auto& stream : recv_streams_) { |
| 2268 uint32_t ssrc = stream.first; |
| 2269 // When SSRCs are unsignaled, there's only one audio MediaStreamTrack, but |
| 2270 // multiple RTP streams can be received over time (if the SSRC changes for |
| 2271 // whatever reason). We only want the RTCMediaStreamTrackStats to represent |
| 2272 // the stats for the most recent stream (the one whose audio is actually |
| 2273 // routed to the MediaStreamTrack), so here we ignore any unsignaled SSRCs |
| 2274 // except for the most recent one (last in the vector). This is somewhat of |
| 2275 // a hack, and means you don't get *any* stats for these inactive streams, |
| 2276 // but it's slightly better than the previous behavior, which was "highest |
| 2277 // SSRC wins". |
| 2278 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8158 |
| 2279 if (!unsignaled_recv_ssrcs_.empty()) { |
| 2280 auto end_it = --unsignaled_recv_ssrcs_.end(); |
| 2281 if (std::find(unsignaled_recv_ssrcs_.begin(), end_it, ssrc) != end_it) { |
| 2282 continue; |
| 2283 } |
| 2284 } |
| 2268 webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats(); | 2285 webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats(); |
| 2269 VoiceReceiverInfo rinfo; | 2286 VoiceReceiverInfo rinfo; |
| 2270 rinfo.add_ssrc(stats.remote_ssrc); | 2287 rinfo.add_ssrc(stats.remote_ssrc); |
| 2271 rinfo.bytes_rcvd = stats.bytes_rcvd; | 2288 rinfo.bytes_rcvd = stats.bytes_rcvd; |
| 2272 rinfo.packets_rcvd = stats.packets_rcvd; | 2289 rinfo.packets_rcvd = stats.packets_rcvd; |
| 2273 rinfo.packets_lost = stats.packets_lost; | 2290 rinfo.packets_lost = stats.packets_lost; |
| 2274 rinfo.fraction_lost = stats.fraction_lost; | 2291 rinfo.fraction_lost = stats.fraction_lost; |
| 2275 rinfo.codec_name = stats.codec_name; | 2292 rinfo.codec_name = stats.codec_name; |
| 2276 rinfo.codec_payload_type = stats.codec_payload_type; | 2293 rinfo.codec_payload_type = stats.codec_payload_type; |
| 2277 rinfo.ext_seqnum = stats.ext_seqnum; | 2294 rinfo.ext_seqnum = stats.ext_seqnum; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2376 ssrc); | 2393 ssrc); |
| 2377 if (it != unsignaled_recv_ssrcs_.end()) { | 2394 if (it != unsignaled_recv_ssrcs_.end()) { |
| 2378 unsignaled_recv_ssrcs_.erase(it); | 2395 unsignaled_recv_ssrcs_.erase(it); |
| 2379 return true; | 2396 return true; |
| 2380 } | 2397 } |
| 2381 return false; | 2398 return false; |
| 2382 } | 2399 } |
| 2383 } // namespace cricket | 2400 } // namespace cricket |
| 2384 | 2401 |
| 2385 #endif // HAVE_WEBRTC_VOICE | 2402 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |