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

Side by Side Diff: talk/app/webrtc/statscollector.cc

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Set media engine on voice channel Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 // the proxy map directly from the session stats. 685 // the proxy map directly from the session stats.
686 // As is, if GetStats() failed, we could be using old (incorrect?) proxy 686 // As is, if GetStats() failed, we could be using old (incorrect?) proxy
687 // data. 687 // data.
688 proxy_to_transport_ = stats.proxy_to_transport; 688 proxy_to_transport_ = stats.proxy_to_transport;
689 689
690 for (const auto& transport_iter : stats.transport_stats) { 690 for (const auto& transport_iter : stats.transport_stats) {
691 // Attempt to get a copy of the certificates from the transport and 691 // Attempt to get a copy of the certificates from the transport and
692 // expose them in stats reports. All channels in a transport share the 692 // expose them in stats reports. All channels in a transport share the
693 // same local and remote certificates. 693 // same local and remote certificates.
694 // 694 //
695 // Note that Transport::GetIdentity and Transport::GetRemoteCertificate
696 // invoke method calls on the worker thread and block this thread, but
697 // messages are still processed on this thread, which may blow way the
698 // existing transports. So we cannot reuse |transport| after these calls.
699 StatsReport::Id local_cert_report_id, remote_cert_report_id; 695 StatsReport::Id local_cert_report_id, remote_cert_report_id;
700
701 cricket::Transport* transport =
702 session_->GetTransport(transport_iter.second.content_name);
703 rtc::scoped_ptr<rtc::SSLIdentity> identity; 696 rtc::scoped_ptr<rtc::SSLIdentity> identity;
704 if (transport && transport->GetIdentity(identity.accept())) { 697 if (session_->GetIdentity(transport_iter.second.content_name,
698 identity.accept())) {
705 StatsReport* r = AddCertificateReports(&(identity->certificate())); 699 StatsReport* r = AddCertificateReports(&(identity->certificate()));
706 if (r) 700 if (r)
707 local_cert_report_id = r->id(); 701 local_cert_report_id = r->id();
708 } 702 }
709 703
710 transport = session_->GetTransport(transport_iter.second.content_name);
711 rtc::scoped_ptr<rtc::SSLCertificate> cert; 704 rtc::scoped_ptr<rtc::SSLCertificate> cert;
712 if (transport && transport->GetRemoteCertificate(cert.accept())) { 705 if (session_->GetRemoteCertificate(transport_iter.second.content_name,
706 cert.accept())) {
713 StatsReport* r = AddCertificateReports(cert.get()); 707 StatsReport* r = AddCertificateReports(cert.get());
714 if (r) 708 if (r)
715 remote_cert_report_id = r->id(); 709 remote_cert_report_id = r->id();
716 } 710 }
717 711
718 for (const auto& channel_iter : transport_iter.second.channel_stats) { 712 for (const auto& channel_iter : transport_iter.second.channel_stats) {
719 StatsReport::Id id(StatsReport::NewComponentId( 713 StatsReport::Id id(StatsReport::NewComponentId(
720 transport_iter.second.content_name, channel_iter.component)); 714 transport_iter.second.content_name, channel_iter.component));
721 StatsReport* channel_report = reports_.ReplaceOrAddNew(id); 715 StatsReport* channel_report = reports_.ReplaceOrAddNew(id);
722 channel_report->set_timestamp(stats_gathering_started_); 716 channel_report->set_timestamp(stats_gathering_started_);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 921
928 void StatsCollector::UpdateTrackReports() { 922 void StatsCollector::UpdateTrackReports() {
929 DCHECK(session_->signaling_thread()->IsCurrent()); 923 DCHECK(session_->signaling_thread()->IsCurrent());
930 924
931 rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls; 925 rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
932 926
933 for (const auto& entry : track_ids_) { 927 for (const auto& entry : track_ids_) {
934 StatsReport* report = entry.second; 928 StatsReport* report = entry.second;
935 report->set_timestamp(stats_gathering_started_); 929 report->set_timestamp(stats_gathering_started_);
936 } 930 }
937
938 } 931 }
939 932
940 void StatsCollector::ClearUpdateStatsCacheForTest() { 933 void StatsCollector::ClearUpdateStatsCacheForTest() {
941 stats_gathering_started_ = 0; 934 stats_gathering_started_ = 0;
942 } 935 }
943 936
944 } // namespace webrtc 937 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/statscollector_unittest.cc » ('j') | talk/app/webrtc/webrtcsession.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698