Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/media/webrtc_browsertest_perf.h" | 5 #include "chrome/browser/media/webrtc_browsertest_perf.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 value, "bit/s", false); | 233 value, "bit/s", false); |
| 234 ASSERT_TRUE(pc_dict.GetString( | 234 ASSERT_TRUE(pc_dict.GetString( |
| 235 Statistic("googTransmitBitrate", kBweStatsKey), &value)); | 235 Statistic("googTransmitBitrate", kBweStatsKey), &value)); |
| 236 perf_test::PrintResult("bwe_stats", video_modifier, "transmit_bitrate", value, | 236 perf_test::PrintResult("bwe_stats", video_modifier, "transmit_bitrate", value, |
| 237 "bit/s", false); | 237 "bit/s", false); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void PrintMetricsForAllStreams(const base::DictionaryValue& pc_dict, | 240 void PrintMetricsForAllStreams(const base::DictionaryValue& pc_dict, |
| 241 const std::string& modifier, | 241 const std::string& modifier, |
| 242 const std::string& video_codec) { | 242 const std::string& video_codec) { |
| 243 PrintMetricsForSendStreams(pc_dict, modifier, video_codec); | |
| 244 PrintMetricsForRecvStreams(pc_dict, modifier, video_codec); | |
| 245 } | |
| 246 | |
| 247 void PrintMetricsForSendStreams(const base::DictionaryValue& pc_dict, | |
| 248 const std::string& modifier, | |
| 249 const std::string& video_codec) { | |
| 243 std::string video_modifier = | 250 std::string video_modifier = |
| 244 video_codec.empty() ? modifier : modifier + "_" + video_codec; | 251 video_codec.empty() ? modifier : modifier + "_" + video_codec; |
| 245 const base::DictionaryValue* stats_dict; | 252 const base::DictionaryValue* stats_dict; |
| 253 ASSERT_TRUE(pc_dict.GetDictionary("stats", &stats_dict)); | |
| 254 std::set<std::string> ssrc_identifiers = FindAllSsrcIdentifiers(*stats_dict); | |
| 255 | |
| 256 std::set<std::string>::const_iterator ssrc_iterator = | |
| 257 ssrc_identifiers.begin(); | |
| 258 for (; ssrc_iterator != ssrc_identifiers.end(); ++ssrc_iterator) { | |
| 259 const std::string& ssrc = *ssrc_iterator; | |
| 260 MaybePrintResultsForAudioSend(ssrc, pc_dict, modifier); | |
|
kjellander_chromium
2016/03/29 12:52:26
Shouldn't we continue to check the result of these
phoglund_chromium
2016/03/29 14:02:09
That would be nice, but it seemed clunky to implem
kjellander_chromium
2016/03/29 14:10:31
OK, but if we now never look at the result from th
phoglund_chromium
2016/03/29 14:37:24
Good point. Done
| |
| 261 MaybePrintResultsForVideoSend(ssrc, pc_dict, video_modifier); | |
| 262 } | |
| 263 } | |
| 264 | |
| 265 void PrintMetricsForRecvStreams(const base::DictionaryValue& pc_dict, | |
| 266 const std::string& modifier, | |
| 267 const std::string& video_codec) { | |
| 268 std::string video_modifier = | |
| 269 video_codec.empty() ? modifier : modifier + "_" + video_codec; | |
| 270 const base::DictionaryValue* stats_dict; | |
| 246 ASSERT_TRUE(pc_dict.GetDictionary("stats", &stats_dict)); | 271 ASSERT_TRUE(pc_dict.GetDictionary("stats", &stats_dict)); |
| 247 std::set<std::string> ssrc_identifiers = FindAllSsrcIdentifiers(*stats_dict); | 272 std::set<std::string> ssrc_identifiers = FindAllSsrcIdentifiers(*stats_dict); |
| 248 | 273 |
| 249 std::set<std::string>::const_iterator ssrc_iterator = | 274 std::set<std::string>::const_iterator ssrc_iterator = |
| 250 ssrc_identifiers.begin(); | 275 ssrc_identifiers.begin(); |
| 251 for (; ssrc_iterator != ssrc_identifiers.end(); ++ssrc_iterator) { | 276 for (; ssrc_iterator != ssrc_identifiers.end(); ++ssrc_iterator) { |
| 252 // Figure out which stream type this ssrc represents and print all the | |
| 253 // interesting metrics for it. | |
| 254 const std::string& ssrc = *ssrc_iterator; | 277 const std::string& ssrc = *ssrc_iterator; |
| 255 bool did_recognize_stream_type = | 278 MaybePrintResultsForAudioReceive(ssrc, pc_dict, modifier); |
| 256 MaybePrintResultsForAudioReceive(ssrc, pc_dict, modifier) || | 279 MaybePrintResultsForVideoReceive(ssrc, pc_dict, video_modifier); |
| 257 MaybePrintResultsForAudioSend(ssrc, pc_dict, modifier) || | |
| 258 MaybePrintResultsForVideoReceive(ssrc, pc_dict, video_modifier) || | |
| 259 MaybePrintResultsForVideoSend(ssrc, pc_dict, video_modifier); | |
| 260 ASSERT_TRUE(did_recognize_stream_type) << "Failed to figure out which " | |
| 261 "kind of stream SSRC " << ssrc | |
| 262 << " is. "; | |
| 263 } | 280 } |
| 264 } | 281 } |
| 265 | 282 |
| 266 } // namespace test | 283 } // namespace test |
| OLD | NEW |