OLD | NEW |
---|---|
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970, | 403 // "Now" using a system clock, relative to the UNIX epoch (Jan 1, 1970, |
404 // UTC), in microseconds. The system clock could be modified and is not | 404 // UTC), in microseconds. The system clock could be modified and is not |
405 // necessarily monotonically increasing. | 405 // necessarily monotonically increasing. |
406 int64_t timestamp_us = rtc::TimeUTCMicros(); | 406 int64_t timestamp_us = rtc::TimeUTCMicros(); |
407 | 407 |
408 num_pending_partial_reports_ = 3; | 408 num_pending_partial_reports_ = 3; |
409 partial_report_timestamp_us_ = cache_now_us; | 409 partial_report_timestamp_us_ = cache_now_us; |
410 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, | 410 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, |
411 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread, | 411 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnSignalingThread, |
412 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); | 412 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
413 | |
414 // TODO(hbos): No stats are gathered by | |
415 // |ProducePartialResultsOnWorkerThread|, remove it. | |
413 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_, | 416 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, worker_thread_, |
414 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread, | 417 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnWorkerThread, |
415 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); | 418 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
419 | |
420 // Prepare |channel_names_| and |media_info_| for use in | |
421 // |ProducePartialResultsOnNetworkThread|. | |
422 channel_name_pairs_.reset(pc_->session()->GetChannelNamePairs().release()); | |
Taylor Brandstetter
2016/12/15 01:12:53
I still feel that GetChannelNamePairs isn't really
hbos
2016/12/15 16:12:45
Okah, I removed it, it's only invoked in two place
| |
423 media_info_.reset(PrepareMediaInfo_s().release()); | |
416 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, | 424 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, network_thread_, |
417 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread, | 425 rtc::Bind(&RTCStatsCollector::ProducePartialResultsOnNetworkThread, |
418 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); | 426 rtc::scoped_refptr<RTCStatsCollector>(this), timestamp_us)); |
419 } | 427 } |
420 } | 428 } |
421 | 429 |
422 void RTCStatsCollector::ClearCachedStatsReport() { | 430 void RTCStatsCollector::ClearCachedStatsReport() { |
423 RTC_DCHECK(signaling_thread_->IsCurrent()); | 431 RTC_DCHECK(signaling_thread_->IsCurrent()); |
424 cached_report_ = nullptr; | 432 cached_report_ = nullptr; |
425 } | 433 } |
426 | 434 |
427 void RTCStatsCollector::ProducePartialResultsOnSignalingThread( | 435 void RTCStatsCollector::ProducePartialResultsOnSignalingThread( |
428 int64_t timestamp_us) { | 436 int64_t timestamp_us) { |
429 RTC_DCHECK(signaling_thread_->IsCurrent()); | 437 RTC_DCHECK(signaling_thread_->IsCurrent()); |
430 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( | 438 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( |
431 timestamp_us); | 439 timestamp_us); |
432 | 440 |
433 SessionStats session_stats; | |
434 if (pc_->session()->GetTransportStats(&session_stats)) { | |
435 std::map<std::string, CertificateStatsPair> transport_cert_stats = | |
436 PrepareTransportCertificateStats(session_stats); | |
437 MediaInfo media_info = PrepareMediaInfo(session_stats); | |
438 | |
439 ProduceCertificateStats_s( | |
440 timestamp_us, transport_cert_stats, report.get()); | |
441 ProduceCodecStats_s( | |
442 timestamp_us, media_info, report.get()); | |
443 ProduceIceCandidateAndPairStats_s( | |
444 timestamp_us, session_stats, report.get()); | |
445 ProduceRTPStreamStats_s( | |
446 timestamp_us, session_stats, media_info, report.get()); | |
447 ProduceTransportStats_s( | |
448 timestamp_us, session_stats, transport_cert_stats, report.get()); | |
449 } | |
450 ProduceDataChannelStats_s(timestamp_us, report.get()); | 441 ProduceDataChannelStats_s(timestamp_us, report.get()); |
451 ProduceMediaStreamAndTrackStats_s(timestamp_us, report.get()); | 442 ProduceMediaStreamAndTrackStats_s(timestamp_us, report.get()); |
452 ProducePeerConnectionStats_s(timestamp_us, report.get()); | 443 ProducePeerConnectionStats_s(timestamp_us, report.get()); |
453 | 444 |
454 AddPartialResults(report); | 445 AddPartialResults(report); |
455 } | 446 } |
456 | 447 |
457 void RTCStatsCollector::ProducePartialResultsOnWorkerThread( | 448 void RTCStatsCollector::ProducePartialResultsOnWorkerThread( |
458 int64_t timestamp_us) { | 449 int64_t timestamp_us) { |
459 RTC_DCHECK(worker_thread_->IsCurrent()); | 450 RTC_DCHECK(worker_thread_->IsCurrent()); |
460 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( | 451 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( |
461 timestamp_us); | 452 timestamp_us); |
462 | 453 |
463 // TODO(hbos): Gather stats on worker thread. | 454 // TODO(hbos): There are no stats to be gathered on this thread, remove this |
464 // pc_->session()'s channels are owned by the signaling thread but there are | 455 // method. |
465 // some stats that are gathered on the worker thread. Instead of a synchronous | |
466 // invoke on "s->w" we could to the "w" work here asynchronously if it wasn't | |
467 // for the ownership issue. Synchronous invokes in other places makes it | |
468 // difficult to introduce locks without introducing deadlocks and the channels | |
469 // are not reference counted. | |
470 | 456 |
471 AddPartialResults(report); | 457 AddPartialResults(report); |
472 } | 458 } |
473 | 459 |
474 void RTCStatsCollector::ProducePartialResultsOnNetworkThread( | 460 void RTCStatsCollector::ProducePartialResultsOnNetworkThread( |
475 int64_t timestamp_us) { | 461 int64_t timestamp_us) { |
476 RTC_DCHECK(network_thread_->IsCurrent()); | 462 RTC_DCHECK(network_thread_->IsCurrent()); |
477 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( | 463 rtc::scoped_refptr<RTCStatsReport> report = RTCStatsReport::Create( |
478 timestamp_us); | 464 timestamp_us); |
479 | 465 |
480 // TODO(hbos): Gather stats on network thread. | 466 std::unique_ptr<SessionStats> session_stats = |
481 // pc_->session()'s channels are owned by the signaling thread but there are | 467 pc_->session()->GetSessionStats(*channel_name_pairs_); |
482 // some stats that are gathered on the network thread. Instead of a | 468 if (session_stats) { |
483 // synchronous invoke on "s->n" we could to the "n" work here asynchronously | 469 std::map<std::string, CertificateStatsPair> transport_cert_stats = |
484 // if it wasn't for the ownership issue. Synchronous invokes in other places | 470 PrepareTransportCertificateStats_n(*session_stats); |
485 // makes it difficult to introduce locks without introducing deadlocks and the | 471 |
486 // channels are not reference counted. | 472 ProduceCertificateStats_n( |
473 timestamp_us, transport_cert_stats, report.get()); | |
474 ProduceCodecStats_n( | |
475 timestamp_us, *media_info_, report.get()); | |
476 ProduceIceCandidateAndPairStats_n( | |
477 timestamp_us, *session_stats, report.get()); | |
478 ProduceRTPStreamStats_n( | |
479 timestamp_us, *session_stats, *media_info_, report.get()); | |
480 ProduceTransportStats_n( | |
481 timestamp_us, *session_stats, transport_cert_stats, report.get()); | |
482 } | |
487 | 483 |
488 AddPartialResults(report); | 484 AddPartialResults(report); |
489 } | 485 } |
490 | 486 |
491 void RTCStatsCollector::AddPartialResults( | 487 void RTCStatsCollector::AddPartialResults( |
492 const rtc::scoped_refptr<RTCStatsReport>& partial_report) { | 488 const rtc::scoped_refptr<RTCStatsReport>& partial_report) { |
493 if (!signaling_thread_->IsCurrent()) { | 489 if (!signaling_thread_->IsCurrent()) { |
494 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, | 490 invoker_.AsyncInvoke<void>(RTC_FROM_HERE, signaling_thread_, |
495 rtc::Bind(&RTCStatsCollector::AddPartialResults_s, | 491 rtc::Bind(&RTCStatsCollector::AddPartialResults_s, |
496 rtc::scoped_refptr<RTCStatsCollector>(this), | 492 rtc::scoped_refptr<RTCStatsCollector>(this), |
(...skipping 24 matching lines...) Expand all Loading... | |
521 RTC_DCHECK(signaling_thread_->IsCurrent()); | 517 RTC_DCHECK(signaling_thread_->IsCurrent()); |
522 RTC_DCHECK(!callbacks_.empty()); | 518 RTC_DCHECK(!callbacks_.empty()); |
523 RTC_DCHECK(cached_report_); | 519 RTC_DCHECK(cached_report_); |
524 for (const rtc::scoped_refptr<RTCStatsCollectorCallback>& callback : | 520 for (const rtc::scoped_refptr<RTCStatsCollectorCallback>& callback : |
525 callbacks_) { | 521 callbacks_) { |
526 callback->OnStatsDelivered(cached_report_); | 522 callback->OnStatsDelivered(cached_report_); |
527 } | 523 } |
528 callbacks_.clear(); | 524 callbacks_.clear(); |
529 } | 525 } |
530 | 526 |
531 void RTCStatsCollector::ProduceCertificateStats_s( | 527 void RTCStatsCollector::ProduceCertificateStats_n( |
532 int64_t timestamp_us, | 528 int64_t timestamp_us, |
533 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, | 529 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, |
534 RTCStatsReport* report) const { | 530 RTCStatsReport* report) const { |
535 RTC_DCHECK(signaling_thread_->IsCurrent()); | 531 RTC_DCHECK(network_thread_->IsCurrent()); |
536 for (const auto& transport_cert_stats_pair : transport_cert_stats) { | 532 for (const auto& transport_cert_stats_pair : transport_cert_stats) { |
537 if (transport_cert_stats_pair.second.local) { | 533 if (transport_cert_stats_pair.second.local) { |
538 ProduceCertificateStatsFromSSLCertificateStats( | 534 ProduceCertificateStatsFromSSLCertificateStats( |
539 timestamp_us, *transport_cert_stats_pair.second.local.get(), report); | 535 timestamp_us, *transport_cert_stats_pair.second.local.get(), report); |
540 } | 536 } |
541 if (transport_cert_stats_pair.second.remote) { | 537 if (transport_cert_stats_pair.second.remote) { |
542 ProduceCertificateStatsFromSSLCertificateStats( | 538 ProduceCertificateStatsFromSSLCertificateStats( |
543 timestamp_us, *transport_cert_stats_pair.second.remote.get(), report); | 539 timestamp_us, *transport_cert_stats_pair.second.remote.get(), report); |
544 } | 540 } |
545 } | 541 } |
546 } | 542 } |
547 | 543 |
548 void RTCStatsCollector::ProduceCodecStats_s( | 544 void RTCStatsCollector::ProduceCodecStats_n( |
549 int64_t timestamp_us, const MediaInfo& media_info, | 545 int64_t timestamp_us, const MediaInfo& media_info, |
550 RTCStatsReport* report) const { | 546 RTCStatsReport* report) const { |
551 RTC_DCHECK(signaling_thread_->IsCurrent()); | 547 RTC_DCHECK(network_thread_->IsCurrent()); |
552 // Audio | 548 // Audio |
553 if (media_info.voice) { | 549 if (media_info.voice) { |
554 // Inbound | 550 // Inbound |
555 for (const auto& pair : media_info.voice->receive_codecs) { | 551 for (const auto& pair : media_info.voice->receive_codecs) { |
556 report->AddStats(CodecStatsFromRtpCodecParameters( | 552 report->AddStats(CodecStatsFromRtpCodecParameters( |
557 timestamp_us, true, true, pair.second)); | 553 timestamp_us, true, true, pair.second)); |
558 } | 554 } |
559 // Outbound | 555 // Outbound |
560 for (const auto& pair : media_info.voice->send_codecs) { | 556 for (const auto& pair : media_info.voice->send_codecs) { |
561 report->AddStats(CodecStatsFromRtpCodecParameters( | 557 report->AddStats(CodecStatsFromRtpCodecParameters( |
(...skipping 30 matching lines...) Expand all Loading... | |
592 data_channel_stats->state = | 588 data_channel_stats->state = |
593 DataStateToRTCDataChannelState(data_channel->state()); | 589 DataStateToRTCDataChannelState(data_channel->state()); |
594 data_channel_stats->messages_sent = data_channel->messages_sent(); | 590 data_channel_stats->messages_sent = data_channel->messages_sent(); |
595 data_channel_stats->bytes_sent = data_channel->bytes_sent(); | 591 data_channel_stats->bytes_sent = data_channel->bytes_sent(); |
596 data_channel_stats->messages_received = data_channel->messages_received(); | 592 data_channel_stats->messages_received = data_channel->messages_received(); |
597 data_channel_stats->bytes_received = data_channel->bytes_received(); | 593 data_channel_stats->bytes_received = data_channel->bytes_received(); |
598 report->AddStats(std::move(data_channel_stats)); | 594 report->AddStats(std::move(data_channel_stats)); |
599 } | 595 } |
600 } | 596 } |
601 | 597 |
602 void RTCStatsCollector::ProduceIceCandidateAndPairStats_s( | 598 void RTCStatsCollector::ProduceIceCandidateAndPairStats_n( |
603 int64_t timestamp_us, const SessionStats& session_stats, | 599 int64_t timestamp_us, const SessionStats& session_stats, |
604 RTCStatsReport* report) const { | 600 RTCStatsReport* report) const { |
605 RTC_DCHECK(signaling_thread_->IsCurrent()); | 601 RTC_DCHECK(network_thread_->IsCurrent()); |
606 for (const auto& transport_stats : session_stats.transport_stats) { | 602 for (const auto& transport_stats : session_stats.transport_stats) { |
607 for (const auto& channel_stats : transport_stats.second.channel_stats) { | 603 for (const auto& channel_stats : transport_stats.second.channel_stats) { |
608 std::string transport_id = RTCTransportStatsIDFromTransportChannel( | 604 std::string transport_id = RTCTransportStatsIDFromTransportChannel( |
609 transport_stats.second.transport_name, channel_stats.component); | 605 transport_stats.second.transport_name, channel_stats.component); |
610 for (const cricket::ConnectionInfo& info : | 606 for (const cricket::ConnectionInfo& info : |
611 channel_stats.connection_infos) { | 607 channel_stats.connection_infos) { |
612 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( | 608 std::unique_ptr<RTCIceCandidatePairStats> candidate_pair_stats( |
613 new RTCIceCandidatePairStats( | 609 new RTCIceCandidatePairStats( |
614 RTCIceCandidatePairStatsIDFromConnectionInfo(info), | 610 RTCIceCandidatePairStatsIDFromConnectionInfo(info), |
615 timestamp_us)); | 611 timestamp_us)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
668 void RTCStatsCollector::ProducePeerConnectionStats_s( | 664 void RTCStatsCollector::ProducePeerConnectionStats_s( |
669 int64_t timestamp_us, RTCStatsReport* report) const { | 665 int64_t timestamp_us, RTCStatsReport* report) const { |
670 RTC_DCHECK(signaling_thread_->IsCurrent()); | 666 RTC_DCHECK(signaling_thread_->IsCurrent()); |
671 std::unique_ptr<RTCPeerConnectionStats> stats( | 667 std::unique_ptr<RTCPeerConnectionStats> stats( |
672 new RTCPeerConnectionStats("RTCPeerConnection", timestamp_us)); | 668 new RTCPeerConnectionStats("RTCPeerConnection", timestamp_us)); |
673 stats->data_channels_opened = internal_record_.data_channels_opened; | 669 stats->data_channels_opened = internal_record_.data_channels_opened; |
674 stats->data_channels_closed = internal_record_.data_channels_closed; | 670 stats->data_channels_closed = internal_record_.data_channels_closed; |
675 report->AddStats(std::move(stats)); | 671 report->AddStats(std::move(stats)); |
676 } | 672 } |
677 | 673 |
678 void RTCStatsCollector::ProduceRTPStreamStats_s( | 674 void RTCStatsCollector::ProduceRTPStreamStats_n( |
679 int64_t timestamp_us, const SessionStats& session_stats, | 675 int64_t timestamp_us, const SessionStats& session_stats, |
680 const MediaInfo& media_info, RTCStatsReport* report) const { | 676 const MediaInfo& media_info, RTCStatsReport* report) const { |
681 RTC_DCHECK(signaling_thread_->IsCurrent()); | 677 RTC_DCHECK(network_thread_->IsCurrent()); |
682 | 678 |
683 // Audio | 679 // Audio |
684 if (media_info.voice) { | 680 if (media_info.voice) { |
685 std::string transport_id = RTCTransportStatsIDFromBaseChannel( | 681 std::string transport_id = RTCTransportStatsIDFromBaseChannel( |
686 session_stats.proxy_to_transport, *pc_->session()->voice_channel()); | 682 session_stats.proxy_to_transport, *pc_->session()->voice_channel()); |
687 RTC_DCHECK(!transport_id.empty()); | 683 RTC_DCHECK(!transport_id.empty()); |
688 // Inbound | 684 // Inbound |
689 for (const cricket::VoiceReceiverInfo& voice_receiver_info : | 685 for (const cricket::VoiceReceiverInfo& voice_receiver_info : |
690 media_info.voice->receivers) { | 686 media_info.voice->receivers) { |
691 // TODO(nisse): SSRC == 0 currently means none. Delete check when that | 687 // TODO(nisse): SSRC == 0 currently means none. Delete check when that |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 if (video_sender_info.codec_payload_type) { | 771 if (video_sender_info.codec_payload_type) { |
776 outbound_video->codec_id = | 772 outbound_video->codec_id = |
777 RTCCodecStatsIDFromDirectionMediaAndPayload( | 773 RTCCodecStatsIDFromDirectionMediaAndPayload( |
778 false, false, *video_sender_info.codec_payload_type); | 774 false, false, *video_sender_info.codec_payload_type); |
779 } | 775 } |
780 report->AddStats(std::move(outbound_video)); | 776 report->AddStats(std::move(outbound_video)); |
781 } | 777 } |
782 } | 778 } |
783 } | 779 } |
784 | 780 |
785 void RTCStatsCollector::ProduceTransportStats_s( | 781 void RTCStatsCollector::ProduceTransportStats_n( |
786 int64_t timestamp_us, const SessionStats& session_stats, | 782 int64_t timestamp_us, const SessionStats& session_stats, |
787 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, | 783 const std::map<std::string, CertificateStatsPair>& transport_cert_stats, |
788 RTCStatsReport* report) const { | 784 RTCStatsReport* report) const { |
789 RTC_DCHECK(signaling_thread_->IsCurrent()); | 785 RTC_DCHECK(network_thread_->IsCurrent()); |
790 for (const auto& transport : session_stats.transport_stats) { | 786 for (const auto& transport : session_stats.transport_stats) { |
791 // Get reference to RTCP channel, if it exists. | 787 // Get reference to RTCP channel, if it exists. |
792 std::string rtcp_transport_stats_id; | 788 std::string rtcp_transport_stats_id; |
793 for (const auto& channel_stats : transport.second.channel_stats) { | 789 for (const auto& channel_stats : transport.second.channel_stats) { |
794 if (channel_stats.component == | 790 if (channel_stats.component == |
795 cricket::ICE_CANDIDATE_COMPONENT_RTCP) { | 791 cricket::ICE_CANDIDATE_COMPONENT_RTCP) { |
796 rtcp_transport_stats_id = RTCTransportStatsIDFromTransportChannel( | 792 rtcp_transport_stats_id = RTCTransportStatsIDFromTransportChannel( |
797 transport.second.transport_name, channel_stats.component); | 793 transport.second.transport_name, channel_stats.component); |
798 break; | 794 break; |
799 } | 795 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
842 if (!local_certificate_id.empty()) | 838 if (!local_certificate_id.empty()) |
843 transport_stats->local_certificate_id = local_certificate_id; | 839 transport_stats->local_certificate_id = local_certificate_id; |
844 if (!remote_certificate_id.empty()) | 840 if (!remote_certificate_id.empty()) |
845 transport_stats->remote_certificate_id = remote_certificate_id; | 841 transport_stats->remote_certificate_id = remote_certificate_id; |
846 report->AddStats(std::move(transport_stats)); | 842 report->AddStats(std::move(transport_stats)); |
847 } | 843 } |
848 } | 844 } |
849 } | 845 } |
850 | 846 |
851 std::map<std::string, RTCStatsCollector::CertificateStatsPair> | 847 std::map<std::string, RTCStatsCollector::CertificateStatsPair> |
852 RTCStatsCollector::PrepareTransportCertificateStats( | 848 RTCStatsCollector::PrepareTransportCertificateStats_n( |
853 const SessionStats& session_stats) const { | 849 const SessionStats& session_stats) const { |
854 RTC_DCHECK(signaling_thread_->IsCurrent()); | 850 RTC_DCHECK(network_thread_->IsCurrent()); |
855 std::map<std::string, CertificateStatsPair> transport_cert_stats; | 851 std::map<std::string, CertificateStatsPair> transport_cert_stats; |
856 for (const auto& transport_stats : session_stats.transport_stats) { | 852 for (const auto& transport_stats : session_stats.transport_stats) { |
857 CertificateStatsPair certificate_stats_pair; | 853 CertificateStatsPair certificate_stats_pair; |
858 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate; | 854 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate; |
859 if (pc_->session()->GetLocalCertificate( | 855 if (pc_->session()->GetLocalCertificate( |
860 transport_stats.second.transport_name, &local_certificate)) { | 856 transport_stats.second.transport_name, &local_certificate)) { |
861 certificate_stats_pair.local = | 857 certificate_stats_pair.local = |
862 local_certificate->ssl_certificate().GetStats(); | 858 local_certificate->ssl_certificate().GetStats(); |
863 } | 859 } |
864 std::unique_ptr<rtc::SSLCertificate> remote_certificate = | 860 std::unique_ptr<rtc::SSLCertificate> remote_certificate = |
865 pc_->session()->GetRemoteSSLCertificate( | 861 pc_->session()->GetRemoteSSLCertificate( |
866 transport_stats.second.transport_name); | 862 transport_stats.second.transport_name); |
867 if (remote_certificate) { | 863 if (remote_certificate) { |
868 certificate_stats_pair.remote = remote_certificate->GetStats(); | 864 certificate_stats_pair.remote = remote_certificate->GetStats(); |
869 } | 865 } |
870 transport_cert_stats.insert( | 866 transport_cert_stats.insert( |
871 std::make_pair(transport_stats.second.transport_name, | 867 std::make_pair(transport_stats.second.transport_name, |
872 std::move(certificate_stats_pair))); | 868 std::move(certificate_stats_pair))); |
873 } | 869 } |
874 return transport_cert_stats; | 870 return transport_cert_stats; |
875 } | 871 } |
876 | 872 |
877 RTCStatsCollector::MediaInfo RTCStatsCollector::PrepareMediaInfo( | 873 std::unique_ptr<RTCStatsCollector::MediaInfo> |
878 const SessionStats& session_stats) const { | 874 RTCStatsCollector::PrepareMediaInfo_s() const { |
879 MediaInfo media_info; | 875 RTC_DCHECK(signaling_thread_->IsCurrent()); |
876 std::unique_ptr<MediaInfo> media_info(new MediaInfo()); | |
880 if (pc_->session()->voice_channel()) { | 877 if (pc_->session()->voice_channel()) { |
881 cricket::VoiceMediaInfo voice_media_info; | 878 cricket::VoiceMediaInfo voice_media_info; |
882 if (pc_->session()->voice_channel()->GetStats(&voice_media_info)) { | 879 if (pc_->session()->voice_channel()->GetStats(&voice_media_info)) { |
883 media_info.voice = rtc::Optional<cricket::VoiceMediaInfo>( | 880 media_info->voice = rtc::Optional<cricket::VoiceMediaInfo>( |
884 std::move(voice_media_info)); | 881 std::move(voice_media_info)); |
885 } | 882 } |
886 } | 883 } |
887 if (pc_->session()->video_channel()) { | 884 if (pc_->session()->video_channel()) { |
888 cricket::VideoMediaInfo video_media_info; | 885 cricket::VideoMediaInfo video_media_info; |
889 if (pc_->session()->video_channel()->GetStats(&video_media_info)) { | 886 if (pc_->session()->video_channel()->GetStats(&video_media_info)) { |
890 media_info.video = rtc::Optional<cricket::VideoMediaInfo>( | 887 media_info->video = rtc::Optional<cricket::VideoMediaInfo>( |
891 std::move(video_media_info)); | 888 std::move(video_media_info)); |
892 } | 889 } |
893 } | 890 } |
894 return media_info; | 891 return media_info; |
895 } | 892 } |
896 | 893 |
897 void RTCStatsCollector::OnDataChannelCreated(DataChannel* channel) { | 894 void RTCStatsCollector::OnDataChannelCreated(DataChannel* channel) { |
898 channel->SignalOpened.connect(this, &RTCStatsCollector::OnDataChannelOpened); | 895 channel->SignalOpened.connect(this, &RTCStatsCollector::OnDataChannelOpened); |
899 channel->SignalClosed.connect(this, &RTCStatsCollector::OnDataChannelClosed); | 896 channel->SignalClosed.connect(this, &RTCStatsCollector::OnDataChannelClosed); |
900 } | 897 } |
(...skipping 21 matching lines...) Expand all Loading... | |
922 const std::string& type) { | 919 const std::string& type) { |
923 return CandidateTypeToRTCIceCandidateType(type); | 920 return CandidateTypeToRTCIceCandidateType(type); |
924 } | 921 } |
925 | 922 |
926 const char* DataStateToRTCDataChannelStateForTesting( | 923 const char* DataStateToRTCDataChannelStateForTesting( |
927 DataChannelInterface::DataState state) { | 924 DataChannelInterface::DataState state) { |
928 return DataStateToRTCDataChannelState(state); | 925 return DataStateToRTCDataChannelState(state); |
929 } | 926 } |
930 | 927 |
931 } // namespace webrtc | 928 } // namespace webrtc |
OLD | NEW |