Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 3008373002: Only return stats for the most recent unsignaled audio stream. (Closed)
Patch Set: Only return stats for the most recent unsignaled stream. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index d202106be09025ed3215525b70eae77c055e2388..fc2213c6525b0b6b9b558d3a6ee153c7742a7f66 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -2267,6 +2267,23 @@ bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) {
// Get SSRC and stats for each receiver.
RTC_DCHECK_EQ(info->receivers.size(), 0U);
for (const auto& stream : recv_streams_) {
+ uint32_t ssrc = stream.first;
+ // When SSRCs are unsignaled, there's only one audio MediaStreamTrack, but
+ // multiple RTP streams can be received over time (if the SSRC changes for
+ // whatever reason). We only want the RTCMediaStreamTrackStats to represent
+ // the stats for the most recent stream (the one whose audio is actually
+ // routed to the MediaStreamTrack), so here we ignore any unsignaled SSRCs
+ // except for the most recent one (last in the vector). This is somewhat of
+ // a hack, and means you don't get *any* stats for these inactive streams,
+ // but it's slightly better than the previous behavior, which was "highest
+ // SSRC wins".
+ // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8158
+ if (!unsignaled_recv_ssrcs_.empty() &&
+ std::find(unsignaled_recv_ssrcs_.begin(),
+ --unsignaled_recv_ssrcs_.end(),
the sun 2017/09/18 18:59:35 nit: I would've done it auto end_it = --unsignale
Taylor Brandstetter 2017/09/20 00:19:45 Can't quite do that since if the list is empty end
+ ssrc) != --unsignaled_recv_ssrcs_.end()) {
+ continue;
+ }
webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats();
VoiceReceiverInfo rinfo;
rinfo.add_ssrc(stats.remote_ssrc);
« no previous file with comments | « no previous file | webrtc/pc/peerconnection_integrationtest.cc » ('j') | webrtc/pc/peerconnection_integrationtest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698