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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc

Issue 2707763004: Rename ReceiveInfo to TmmbrInfo (Closed)
Patch Set: +comment Created 3 years, 10 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 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 std::vector<uint16_t> nack_sequence_numbers; 66 std::vector<uint16_t> nack_sequence_numbers;
67 ReportBlockList report_blocks; 67 ReportBlockList report_blocks;
68 int64_t rtt_ms = 0; 68 int64_t rtt_ms = 0;
69 uint8_t sli_picture_id = 0; 69 uint8_t sli_picture_id = 0;
70 uint64_t rpsi_picture_id = 0; 70 uint64_t rpsi_picture_id = 0;
71 uint32_t receiver_estimated_max_bitrate_bps = 0; 71 uint32_t receiver_estimated_max_bitrate_bps = 0;
72 std::unique_ptr<rtcp::TransportFeedback> transport_feedback; 72 std::unique_ptr<rtcp::TransportFeedback> transport_feedback;
73 rtc::Optional<BitrateAllocation> target_bitrate_allocation; 73 rtc::Optional<BitrateAllocation> target_bitrate_allocation;
74 }; 74 };
75 75
76 struct RTCPReceiver::ReceiveInformation { 76 // Structure for handing TMMBR and TMMBN rtcp messages (RFC5104, section 3.5.4).
77 struct RTCPReceiver::TmmbrInformation {
77 struct TimedTmmbrItem { 78 struct TimedTmmbrItem {
78 rtcp::TmmbItem tmmbr_item; 79 rtcp::TmmbItem tmmbr_item;
79 int64_t last_updated_ms; 80 int64_t last_updated_ms;
80 }; 81 };
81 82
82 int64_t last_time_received_ms = 0; 83 int64_t last_time_received_ms = 0;
83 84
84 bool ready_for_delete = false; 85 bool ready_for_delete = false;
85 86
86 std::vector<rtcp::TmmbItem> tmmbn; 87 std::vector<rtcp::TmmbItem> tmmbn;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 rtcp::SenderReport sender_report; 405 rtcp::SenderReport sender_report;
405 if (!sender_report.Parse(rtcp_block)) { 406 if (!sender_report.Parse(rtcp_block)) {
406 ++num_skipped_packets_; 407 ++num_skipped_packets_;
407 return; 408 return;
408 } 409 }
409 410
410 const uint32_t remote_ssrc = sender_report.sender_ssrc(); 411 const uint32_t remote_ssrc = sender_report.sender_ssrc();
411 412
412 packet_information->remote_ssrc = remote_ssrc; 413 packet_information->remote_ssrc = remote_ssrc;
413 414
414 CreateReceiveInformation(remote_ssrc); 415 CreateTmmbrInformation(remote_ssrc);
415 416
416 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "SR", 417 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "SR",
417 "remote_ssrc", remote_ssrc, "ssrc", main_ssrc_); 418 "remote_ssrc", remote_ssrc, "ssrc", main_ssrc_);
418 419
419 // Have I received RTP packets from this party? 420 // Have I received RTP packets from this party?
420 if (remote_ssrc_ == remote_ssrc) { 421 if (remote_ssrc_ == remote_ssrc) {
421 // Only signal that we have received a SR when we accept one. 422 // Only signal that we have received a SR when we accept one.
422 packet_information->packet_type_flags |= kRtcpSr; 423 packet_information->packet_type_flags |= kRtcpSr;
423 424
424 // Save the NTP time of this report. 425 // Save the NTP time of this report.
(...skipping 21 matching lines...) Expand all
446 ++num_skipped_packets_; 447 ++num_skipped_packets_;
447 return; 448 return;
448 } 449 }
449 450
450 last_received_rr_ms_ = clock_->TimeInMilliseconds(); 451 last_received_rr_ms_ = clock_->TimeInMilliseconds();
451 452
452 const uint32_t remote_ssrc = receiver_report.sender_ssrc(); 453 const uint32_t remote_ssrc = receiver_report.sender_ssrc();
453 454
454 packet_information->remote_ssrc = remote_ssrc; 455 packet_information->remote_ssrc = remote_ssrc;
455 456
456 CreateReceiveInformation(remote_ssrc); 457 CreateTmmbrInformation(remote_ssrc);
457 458
458 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR", 459 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR",
459 "remote_ssrc", remote_ssrc, "ssrc", main_ssrc_); 460 "remote_ssrc", remote_ssrc, "ssrc", main_ssrc_);
460 461
461 packet_information->packet_type_flags |= kRtcpRr; 462 packet_information->packet_type_flags |= kRtcpRr;
462 463
463 for (const ReportBlock& report_block : receiver_report.report_blocks()) 464 for (const ReportBlock& report_block : receiver_report.report_blocks())
464 HandleReportBlock(report_block, packet_information, remote_ssrc); 465 HandleReportBlock(report_block, packet_information, remote_ssrc);
465 } 466 }
466 467
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 ++report_block_info->num_rtts; 528 ++report_block_info->num_rtts;
528 } 529 }
529 530
530 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR_RTT", 531 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RR_RTT",
531 report_block.source_ssrc(), rtt_ms); 532 report_block.source_ssrc(), rtt_ms);
532 533
533 packet_information->rtt_ms = rtt_ms; 534 packet_information->rtt_ms = rtt_ms;
534 packet_information->report_blocks.push_back(report_block_info->report_block); 535 packet_information->report_blocks.push_back(report_block_info->report_block);
535 } 536 }
536 537
537 void RTCPReceiver::CreateReceiveInformation(uint32_t remote_ssrc) { 538 void RTCPReceiver::CreateTmmbrInformation(uint32_t remote_ssrc) {
538 // Create or find receive information. 539 // Create or find receive information.
539 ReceiveInformation* receive_info = &received_infos_[remote_ssrc]; 540 TmmbrInformation* tmmbr_info = &tmmbr_infos_[remote_ssrc];
540 // Update that this remote is alive. 541 // Update that this remote is alive.
541 receive_info->last_time_received_ms = clock_->TimeInMilliseconds(); 542 tmmbr_info->last_time_received_ms = clock_->TimeInMilliseconds();
542 } 543 }
543 544
544 RTCPReceiver::ReceiveInformation* RTCPReceiver::GetReceiveInformation( 545 RTCPReceiver::TmmbrInformation* RTCPReceiver::GetTmmbrInformation(
545 uint32_t remote_ssrc) { 546 uint32_t remote_ssrc) {
546 auto it = received_infos_.find(remote_ssrc); 547 auto it = tmmbr_infos_.find(remote_ssrc);
547 if (it == received_infos_.end()) 548 if (it == tmmbr_infos_.end())
548 return nullptr; 549 return nullptr;
549 return &it->second; 550 return &it->second;
550 } 551 }
551 552
552 bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) { 553 bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) {
553 rtc::CritScope lock(&rtcp_receiver_lock_); 554 rtc::CritScope lock(&rtcp_receiver_lock_);
554 if (last_received_rr_ms_ == 0) 555 if (last_received_rr_ms_ == 0)
555 return false; 556 return false;
556 557
557 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms; 558 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
(...skipping 13 matching lines...) Expand all
571 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms; 572 int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
572 if (clock_->TimeInMilliseconds() > 573 if (clock_->TimeInMilliseconds() >
573 last_increased_sequence_number_ms_ + time_out_ms) { 574 last_increased_sequence_number_ms_ + time_out_ms) {
574 // Reset the timer to only trigger one log. 575 // Reset the timer to only trigger one log.
575 last_increased_sequence_number_ms_ = 0; 576 last_increased_sequence_number_ms_ = 0;
576 return true; 577 return true;
577 } 578 }
578 return false; 579 return false;
579 } 580 }
580 581
581 bool RTCPReceiver::UpdateRTCPReceiveInformationTimers() { 582 bool RTCPReceiver::UpdateTmmbrTimers() {
582 rtc::CritScope lock(&rtcp_receiver_lock_); 583 rtc::CritScope lock(&rtcp_receiver_lock_);
583 584
584 int64_t now_ms = clock_->TimeInMilliseconds(); 585 int64_t now_ms = clock_->TimeInMilliseconds();
585 // Use audio define since we don't know what interval the remote peer use. 586 // Use audio define since we don't know what interval the remote peer use.
586 int64_t timeout_ms = now_ms - 5 * RTCP_INTERVAL_AUDIO_MS; 587 int64_t timeout_ms = now_ms - 5 * RTCP_INTERVAL_AUDIO_MS;
587 588
588 if (oldest_received_info_ms_ >= timeout_ms) 589 if (oldest_tmmbr_info_ms_ >= timeout_ms)
589 return false; 590 return false;
590 591
591 bool update_bounding_set = false; 592 bool update_bounding_set = false;
592 oldest_received_info_ms_ = -1; 593 oldest_tmmbr_info_ms_ = -1;
593 for (auto receive_info_it = received_infos_.begin(); 594 for (auto tmmbr_it = tmmbr_infos_.begin(); tmmbr_it != tmmbr_infos_.end();) {
594 receive_info_it != received_infos_.end();) { 595 TmmbrInformation* tmmbr_info = &tmmbr_it->second;
595 ReceiveInformation* receive_info = &receive_info_it->second; 596 if (tmmbr_info->last_time_received_ms > 0) {
596 if (receive_info->last_time_received_ms > 0) { 597 if (tmmbr_info->last_time_received_ms < timeout_ms) {
597 if (receive_info->last_time_received_ms < timeout_ms) {
598 // No rtcp packet for the last 5 regular intervals, reset limitations. 598 // No rtcp packet for the last 5 regular intervals, reset limitations.
599 receive_info->tmmbr.clear(); 599 tmmbr_info->tmmbr.clear();
600 // Prevent that we call this over and over again. 600 // Prevent that we call this over and over again.
601 receive_info->last_time_received_ms = 0; 601 tmmbr_info->last_time_received_ms = 0;
602 // Send new TMMBN to all channels using the default codec. 602 // Send new TMMBN to all channels using the default codec.
603 update_bounding_set = true; 603 update_bounding_set = true;
604 } else if (oldest_received_info_ms_ == -1 || 604 } else if (oldest_tmmbr_info_ms_ == -1 ||
605 receive_info->last_time_received_ms < 605 tmmbr_info->last_time_received_ms < oldest_tmmbr_info_ms_) {
606 oldest_received_info_ms_) { 606 oldest_tmmbr_info_ms_ = tmmbr_info->last_time_received_ms;
607 oldest_received_info_ms_ = receive_info->last_time_received_ms;
608 } 607 }
609 ++receive_info_it; 608 ++tmmbr_it;
610 } else if (receive_info->ready_for_delete) { 609 } else if (tmmbr_info->ready_for_delete) {
611 // When we dont have a last_time_received_ms and the object is marked 610 // When we dont have a last_time_received_ms and the object is marked
612 // ready_for_delete it's removed from the map. 611 // ready_for_delete it's removed from the map.
613 receive_info_it = received_infos_.erase(receive_info_it); 612 tmmbr_it = tmmbr_infos_.erase(tmmbr_it);
614 } else { 613 } else {
615 ++receive_info_it; 614 ++tmmbr_it;
616 } 615 }
617 } 616 }
618 return update_bounding_set; 617 return update_bounding_set;
619 } 618 }
620 619
621 std::vector<rtcp::TmmbItem> RTCPReceiver::BoundingSet(bool* tmmbr_owner) { 620 std::vector<rtcp::TmmbItem> RTCPReceiver::BoundingSet(bool* tmmbr_owner) {
622 rtc::CritScope lock(&rtcp_receiver_lock_); 621 rtc::CritScope lock(&rtcp_receiver_lock_);
623 ReceiveInformation* receive_info = GetReceiveInformation(remote_ssrc_); 622 TmmbrInformation* tmmbr_info = GetTmmbrInformation(remote_ssrc_);
624 if (!receive_info) 623 if (!tmmbr_info)
625 return std::vector<rtcp::TmmbItem>(); 624 return std::vector<rtcp::TmmbItem>();
626 625
627 *tmmbr_owner = TMMBRHelp::IsOwner(receive_info->tmmbn, main_ssrc_); 626 *tmmbr_owner = TMMBRHelp::IsOwner(tmmbr_info->tmmbn, main_ssrc_);
628 return receive_info->tmmbn; 627 return tmmbr_info->tmmbn;
629 } 628 }
630 629
631 void RTCPReceiver::HandleSdes(const CommonHeader& rtcp_block, 630 void RTCPReceiver::HandleSdes(const CommonHeader& rtcp_block,
632 PacketInformation* packet_information) { 631 PacketInformation* packet_information) {
633 rtcp::Sdes sdes; 632 rtcp::Sdes sdes;
634 if (!sdes.Parse(rtcp_block)) { 633 if (!sdes.Parse(rtcp_block)) {
635 ++num_skipped_packets_; 634 ++num_skipped_packets_;
636 return; 635 return;
637 } 636 }
638 637
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 rtcp::Bye bye; 675 rtcp::Bye bye;
677 if (!bye.Parse(rtcp_block)) { 676 if (!bye.Parse(rtcp_block)) {
678 ++num_skipped_packets_; 677 ++num_skipped_packets_;
679 return; 678 return;
680 } 679 }
681 680
682 // Clear our lists. 681 // Clear our lists.
683 for (auto& reports_per_receiver : received_report_blocks_) 682 for (auto& reports_per_receiver : received_report_blocks_)
684 reports_per_receiver.second.erase(bye.sender_ssrc()); 683 reports_per_receiver.second.erase(bye.sender_ssrc());
685 684
686 // We can't delete it due to TMMBR. 685 TmmbrInformation* tmmbr_info = GetTmmbrInformation(bye.sender_ssrc());
687 ReceiveInformation* receive_info = GetReceiveInformation(bye.sender_ssrc()); 686 if (tmmbr_info)
688 if (receive_info) 687 tmmbr_info->ready_for_delete = true;
689 receive_info->ready_for_delete = true;
690 688
691 last_fir_.erase(bye.sender_ssrc()); 689 last_fir_.erase(bye.sender_ssrc());
692 received_cnames_.erase(bye.sender_ssrc()); 690 received_cnames_.erase(bye.sender_ssrc());
693 xr_rr_rtt_ms_ = 0; 691 xr_rr_rtt_ms_ = 0;
694 } 692 }
695 693
696 void RTCPReceiver::HandleXr(const CommonHeader& rtcp_block, 694 void RTCPReceiver::HandleXr(const CommonHeader& rtcp_block,
697 PacketInformation* packet_information) { 695 PacketInformation* packet_information) {
698 rtcp::ExtendedReports xr; 696 rtcp::ExtendedReports xr;
699 if (!xr.Parse(rtcp_block)) { 697 if (!xr.Parse(rtcp_block)) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 776
779 void RTCPReceiver::HandleTmmbr(const CommonHeader& rtcp_block, 777 void RTCPReceiver::HandleTmmbr(const CommonHeader& rtcp_block,
780 PacketInformation* packet_information) { 778 PacketInformation* packet_information) {
781 rtcp::Tmmbr tmmbr; 779 rtcp::Tmmbr tmmbr;
782 if (!tmmbr.Parse(rtcp_block)) { 780 if (!tmmbr.Parse(rtcp_block)) {
783 ++num_skipped_packets_; 781 ++num_skipped_packets_;
784 return; 782 return;
785 } 783 }
786 784
787 uint32_t sender_ssrc = tmmbr.sender_ssrc(); 785 uint32_t sender_ssrc = tmmbr.sender_ssrc();
788 ReceiveInformation* receive_info = GetReceiveInformation(sender_ssrc); 786 TmmbrInformation* receive_info = GetTmmbrInformation(sender_ssrc);
789 if (!receive_info) // This remote SSRC must be saved before. 787 if (!receive_info) // This remote SSRC must be saved before.
790 return; 788 return;
791 789
792 if (tmmbr.media_ssrc()) { 790 if (tmmbr.media_ssrc()) {
793 // media_ssrc() SHOULD be 0 if same as SenderSSRC. 791 // media_ssrc() SHOULD be 0 if same as SenderSSRC.
794 // In relay mode this is a valid number. 792 // In relay mode this is a valid number.
795 sender_ssrc = tmmbr.media_ssrc(); 793 sender_ssrc = tmmbr.media_ssrc();
796 } 794 }
797 795
798 for (const rtcp::TmmbItem& request : tmmbr.requests()) { 796 for (const rtcp::TmmbItem& request : tmmbr.requests()) {
(...skipping 10 matching lines...) Expand all
809 } 807 }
810 808
811 void RTCPReceiver::HandleTmmbn(const CommonHeader& rtcp_block, 809 void RTCPReceiver::HandleTmmbn(const CommonHeader& rtcp_block,
812 PacketInformation* packet_information) { 810 PacketInformation* packet_information) {
813 rtcp::Tmmbn tmmbn; 811 rtcp::Tmmbn tmmbn;
814 if (!tmmbn.Parse(rtcp_block)) { 812 if (!tmmbn.Parse(rtcp_block)) {
815 ++num_skipped_packets_; 813 ++num_skipped_packets_;
816 return; 814 return;
817 } 815 }
818 816
819 ReceiveInformation* receive_info = GetReceiveInformation(tmmbn.sender_ssrc()); 817 TmmbrInformation* receive_info = GetTmmbrInformation(tmmbn.sender_ssrc());
820 if (!receive_info) // This remote SSRC must be saved before. 818 if (!receive_info) // This remote SSRC must be saved before.
821 return; 819 return;
822 820
823 packet_information->packet_type_flags |= kRtcpTmmbn; 821 packet_information->packet_type_flags |= kRtcpTmmbn;
824 822
825 for (const auto& item : tmmbn.items()) 823 for (const auto& item : tmmbn.items())
826 receive_info->tmmbn.push_back(item); 824 receive_info->tmmbn.push_back(item);
827 } 825 }
828 826
829 void RTCPReceiver::HandleSrReq(const CommonHeader& rtcp_block, 827 void RTCPReceiver::HandleSrReq(const CommonHeader& rtcp_block,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 new rtcp::TransportFeedback()); 920 new rtcp::TransportFeedback());
923 if (!transport_feedback->Parse(rtcp_block)) { 921 if (!transport_feedback->Parse(rtcp_block)) {
924 ++num_skipped_packets_; 922 ++num_skipped_packets_;
925 return; 923 return;
926 } 924 }
927 925
928 packet_information->packet_type_flags |= kRtcpTransportFeedback; 926 packet_information->packet_type_flags |= kRtcpTransportFeedback;
929 packet_information->transport_feedback = std::move(transport_feedback); 927 packet_information->transport_feedback = std::move(transport_feedback);
930 } 928 }
931 929
932 void RTCPReceiver::UpdateTmmbr() { 930 void RTCPReceiver::NotifyTmmbrUpdated() {
933 // Find bounding set. 931 // Find bounding set.
934 std::vector<rtcp::TmmbItem> bounding = 932 std::vector<rtcp::TmmbItem> bounding =
935 TMMBRHelp::FindBoundingSet(TmmbrReceived()); 933 TMMBRHelp::FindBoundingSet(TmmbrReceived());
936 934
937 if (!bounding.empty() && rtcp_bandwidth_observer_) { 935 if (!bounding.empty() && rtcp_bandwidth_observer_) {
938 // We have a new bandwidth estimate on this channel. 936 // We have a new bandwidth estimate on this channel.
939 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding); 937 uint64_t bitrate_bps = TMMBRHelp::CalcMinBitrateBps(bounding);
940 if (bitrate_bps <= std::numeric_limits<uint32_t>::max()) 938 if (bitrate_bps <= std::numeric_limits<uint32_t>::max())
941 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(bitrate_bps); 939 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(bitrate_bps);
942 } 940 }
943 941
944 // Set bounding set: inform remote clients about the new bandwidth. 942 // Send tmmbn to inform remote clients about the new bandwidth.
945 rtp_rtcp_->SetTmmbn(std::move(bounding)); 943 rtp_rtcp_->SetTmmbn(std::move(bounding));
946 } 944 }
947 945
948 void RTCPReceiver::RegisterRtcpStatisticsCallback( 946 void RTCPReceiver::RegisterRtcpStatisticsCallback(
949 RtcpStatisticsCallback* callback) { 947 RtcpStatisticsCallback* callback) {
950 rtc::CritScope cs(&feedbacks_lock_); 948 rtc::CritScope cs(&feedbacks_lock_);
951 stats_callback_ = callback; 949 stats_callback_ = callback;
952 } 950 }
953 951
954 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() { 952 RtcpStatisticsCallback* RTCPReceiver::GetRtcpStatisticsCallback() {
955 rtc::CritScope cs(&feedbacks_lock_); 953 rtc::CritScope cs(&feedbacks_lock_);
956 return stats_callback_; 954 return stats_callback_;
957 } 955 }
958 956
959 // Holding no Critical section. 957 // Holding no Critical section.
960 void RTCPReceiver::TriggerCallbacksFromRtcpPacket( 958 void RTCPReceiver::TriggerCallbacksFromRtcpPacket(
961 const PacketInformation& packet_information) { 959 const PacketInformation& packet_information) {
962 // Process TMMBR and REMB first to avoid multiple callbacks 960 // Process TMMBR and REMB first to avoid multiple callbacks
963 // to OnNetworkChanged. 961 // to OnNetworkChanged.
964 if (packet_information.packet_type_flags & kRtcpTmmbr) { 962 if (packet_information.packet_type_flags & kRtcpTmmbr) {
965 // Might trigger a OnReceivedBandwidthEstimateUpdate. 963 // Might trigger a OnReceivedBandwidthEstimateUpdate.
966 UpdateTmmbr(); 964 NotifyTmmbrUpdated();
967 } 965 }
968 uint32_t local_ssrc; 966 uint32_t local_ssrc;
969 std::set<uint32_t> registered_ssrcs; 967 std::set<uint32_t> registered_ssrcs;
970 { 968 {
971 // We don't want to hold this critsect when triggering the callbacks below. 969 // We don't want to hold this critsect when triggering the callbacks below.
972 rtc::CritScope lock(&rtcp_receiver_lock_); 970 rtc::CritScope lock(&rtcp_receiver_lock_);
973 local_ssrc = main_ssrc_; 971 local_ssrc = main_ssrc_;
974 registered_ssrcs = registered_ssrcs_; 972 registered_ssrcs = registered_ssrcs_;
975 } 973 }
976 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) { 974 if (!receiver_only_ && (packet_information.packet_type_flags & kRtcpSrReq)) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 } 1076 }
1079 1077
1080 std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() { 1078 std::vector<rtcp::TmmbItem> RTCPReceiver::TmmbrReceived() {
1081 rtc::CritScope lock(&rtcp_receiver_lock_); 1079 rtc::CritScope lock(&rtcp_receiver_lock_);
1082 std::vector<rtcp::TmmbItem> candidates; 1080 std::vector<rtcp::TmmbItem> candidates;
1083 1081
1084 int64_t now_ms = clock_->TimeInMilliseconds(); 1082 int64_t now_ms = clock_->TimeInMilliseconds();
1085 // Use audio define since we don't know what interval the remote peer use. 1083 // Use audio define since we don't know what interval the remote peer use.
1086 int64_t timeout_ms = now_ms - 5 * RTCP_INTERVAL_AUDIO_MS; 1084 int64_t timeout_ms = now_ms - 5 * RTCP_INTERVAL_AUDIO_MS;
1087 1085
1088 for (auto& kv : received_infos_) { 1086 for (auto& kv : tmmbr_infos_) {
1089 for (auto it = kv.second.tmmbr.begin(); it != kv.second.tmmbr.end();) { 1087 for (auto it = kv.second.tmmbr.begin(); it != kv.second.tmmbr.end();) {
1090 if (it->second.last_updated_ms < timeout_ms) { 1088 if (it->second.last_updated_ms < timeout_ms) {
1091 // Erase timeout entries. 1089 // Erase timeout entries.
1092 it = kv.second.tmmbr.erase(it); 1090 it = kv.second.tmmbr.erase(it);
1093 } else { 1091 } else {
1094 candidates.push_back(it->second.tmmbr_item); 1092 candidates.push_back(it->second.tmmbr_item);
1095 ++it; 1093 ++it;
1096 } 1094 }
1097 } 1095 }
1098 } 1096 }
1099 return candidates; 1097 return candidates;
1100 } 1098 }
1101 1099
1102 } // namespace webrtc 1100 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698