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

Side by Side Diff: webrtc/api/rtcstatscollector.cc

Issue 2583193002: Removed RTCStatsCollector::ProducePartialResultsOnWorkerThread. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/rtcstatscollector.h ('k') | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } else if (!num_pending_partial_reports_) { 408 } else if (!num_pending_partial_reports_) {
409 // Only start gathering stats if we're not already gathering stats. In the 409 // Only start gathering stats if we're not already gathering stats. In the
410 // case of already gathering stats, |callback_| will be invoked when there 410 // case of already gathering stats, |callback_| will be invoked when there
411 // are no more pending partial reports. 411 // are no more pending partial reports.
412 412
413 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970, 413 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970,
414 // UTC), in microseconds. The system clock could be modified and is not 414 // UTC), in microseconds. The system clock could be modified and is not
415 // necessarily monotonically increasing. 415 // necessarily monotonically increasing.
416 int64_t timestamp_us = rtc::TimeUTCMicros(); 416 int64_t timestamp_us = rtc::TimeUTCMicros();
417 417
418 num_pending_partial_reports_ = 3; 418 num_pending_partial_reports_ = 2;
419 partial_report_timestamp_us_ = cache_now_us; 419 partial_report_timestamp_us_ = cache_now_us;
420 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_,
421 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread,
422 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
423
424 // TODO(hbos): No stats are gathered by
425 // |ProducePartialResultsOnWorkerThread|, remove it.
426 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_,
427 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread,
428 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
429 420
430 // Prepare |channel_names_| and |media_info_| for use in 421 // Prepare |channel_names_| and |media_info_| for use in
431 // |ProducePartialResultsOnNetworkThread|. 422 // |ProducePartialResultsOnNetworkThread|.
432 channel_name_pairs_.reset(new ChannelNamePairs()); 423 channel_name_pairs_.reset(new ChannelNamePairs());
433 if (pc_->session()->voice_channel()) { 424 if (pc_->session()->voice_channel()) {
434 channel_name_pairs_->voice = rtc::Optional<ChannelNamePair>( 425 channel_name_pairs_->voice = rtc::Optional<ChannelNamePair>(
435 ChannelNamePair(pc_->session()->voice_channel()->content_name(), 426 ChannelNamePair(pc_->session()->voice_channel()->content_name(),
436 pc_->session()->voice_channel()->transport_name())); 427 pc_->session()->voice_channel()->transport_name()));
437 } 428 }
438 if (pc_->session()->video_channel()) { 429 if (pc_->session()->video_channel()) {
439 channel_name_pairs_->video = rtc::Optional<ChannelNamePair>( 430 channel_name_pairs_->video = rtc::Optional<ChannelNamePair>(
440 ChannelNamePair(pc_->session()->video_channel()->content_name(), 431 ChannelNamePair(pc_->session()->video_channel()->content_name(),
441 pc_->session()->video_channel()->transport_name())); 432 pc_->session()->video_channel()->transport_name()));
442 } 433 }
443 if (pc_->session()->data_channel()) { 434 if (pc_->session()->data_channel()) {
444 channel_name_pairs_->data = rtc::Optional<ChannelNamePair>( 435 channel_name_pairs_->data = rtc::Optional<ChannelNamePair>(
445 ChannelNamePair(pc_->session()->data_channel()->content_name(), 436 ChannelNamePair(pc_->session()->data_channel()->content_name(),
446 pc_->session()->data_channel()->transport_name())); 437 pc_->session()->data_channel()->transport_name()));
447 } 438 }
448 media_info_.reset(PrepareMediaInfo_s().release()); 439 media_info_.reset(PrepareMediaInfo_s().release());
440
449 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, 441 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_,
450 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread, 442 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread,
451 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); 443 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us));
444 ProducePartialResultsOnSignalingThread(timestamp_us);
452 } 445 }
453 } 446 }
454 447
455 void RTCStatsCollector::ClearCachedStatsReport() { 448 void RTCStatsCollector::ClearCachedStatsReport() {
456 RTC_DCHECK(signaling_thread_->IsCurrent()); 449 RTC_DCHECK(signaling_thread_->IsCurrent());
457 cached_report_ = nullptr; 450 cached_report_ = nullptr;
458 } 451 }
459 452
460 void RTCStatsCollector::WaitForPendingRequest() { 453 void RTCStatsCollector::WaitForPendingRequest() {
461 RTC_DCHECK(signaling_thread_->IsCurrent()); 454 RTC_DCHECK(signaling_thread_->IsCurrent());
(...skipping 12 matching lines...) Expand all
474 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( 467 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(
475 timestamp_us); 468 timestamp_us);
476 469
477 ProduceDataChannelStats_s(timestamp_us, report.get()); 470 ProduceDataChannelStats_s(timestamp_us, report.get());
478 ProduceMediaStreamAndTrackStats_s(timestamp_us, report.get()); 471 ProduceMediaStreamAndTrackStats_s(timestamp_us, report.get());
479 ProducePeerConnectionStats_s(timestamp_us, report.get()); 472 ProducePeerConnectionStats_s(timestamp_us, report.get());
480 473
481 AddPartialResults(report); 474 AddPartialResults(report);
482 } 475 }
483 476
484 void RTCStatsCollector::ProducePartialResultsOnWorkerThread(
485 int64_t timestamp_us) {
486 RTC_DCHECK(worker_thread_->IsCurrent());
487 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(
488 timestamp_us);
489
490 // TODO(hbos): There are no stats to be gathered on this thread, remove this
491 // method.
492
493 AddPartialResults(report);
494 }
495
496 void RTCStatsCollector::ProducePartialResultsOnNetworkThread( 477 void RTCStatsCollector::ProducePartialResultsOnNetworkThread(
497 int64_t timestamp_us) { 478 int64_t timestamp_us) {
498 RTC_DCHECK(network_thread_->IsCurrent()); 479 RTC_DCHECK(network_thread_->IsCurrent());
499 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( 480 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create(
500 timestamp_us); 481 timestamp_us);
501 482
502 std::unique_ptr<SessionStats> session_stats = 483 std::unique_ptr<SessionStats> session_stats =
503 pc_->session()->GetStats(*channel_name_pairs_); 484 pc_->session()->GetStats(*channel_name_pairs_);
504 if (session_stats) { 485 if (session_stats) {
505 std::map<std::string, CertificateStatsPair> transport_cert_stats = 486 std::map<std::string, CertificateStatsPair> transport_cert_stats =
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 const std::string& type) { 936 const std::string& type) {
956 return CandidateTypeToRTCIceCandidateType(type); 937 return CandidateTypeToRTCIceCandidateType(type);
957 } 938 }
958 939
959 const char* DataStateToRTCDataChannelStateForTesting( 940 const char* DataStateToRTCDataChannelStateForTesting(
960 DataChannelInterface::DataState state) { 941 DataChannelInterface::DataState state) {
961 return DataStateToRTCDataChannelState(state); 942 return DataStateToRTCDataChannelState(state);
962 } 943 }
963 944
964 } // namespace webrtc 945 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/rtcstatscollector.h ('k') | webrtc/api/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698