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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2710363003: Fix TSAN race in webrtc::voe::Channel (Closed)
Patch Set: EXCLUSIVE_LOCKS_REQUIRED used (and moved TODO to right function, whoops) Created 3 years, 9 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
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | 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 (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 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 2772
2773 void Channel::SetRtcEventLog(RtcEventLog* event_log) { 2773 void Channel::SetRtcEventLog(RtcEventLog* event_log) {
2774 event_log_proxy_->SetEventLog(event_log); 2774 event_log_proxy_->SetEventLog(event_log);
2775 } 2775 }
2776 2776
2777 void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { 2777 void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) {
2778 rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats); 2778 rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats);
2779 } 2779 }
2780 2780
2781 void Channel::UpdateOverheadForEncoder() { 2781 void Channel::UpdateOverheadForEncoder() {
2782 size_t overhead_per_packet =
2783 transport_overhead_per_packet_ + rtp_overhead_per_packet_;
2782 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { 2784 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) {
2783 if (*encoder) { 2785 if (*encoder) {
2784 (*encoder)->OnReceivedOverhead(transport_overhead_per_packet_ + 2786 (*encoder)->OnReceivedOverhead(overhead_per_packet);
2785 rtp_overhead_per_packet_);
2786 } 2787 }
2787 }); 2788 });
2788 } 2789 }
2789 2790
2790 void Channel::SetTransportOverhead(size_t transport_overhead_per_packet) { 2791 void Channel::SetTransportOverhead(size_t transport_overhead_per_packet) {
2792 rtc::CritScope cs(&overhead_per_packet_lock_);
2791 transport_overhead_per_packet_ = transport_overhead_per_packet; 2793 transport_overhead_per_packet_ = transport_overhead_per_packet;
2792 UpdateOverheadForEncoder(); 2794 UpdateOverheadForEncoder();
2793 } 2795 }
2794 2796
2797 // TODO(solenberg): Make AudioSendStream an OverheadObserver instead.
2795 void Channel::OnOverheadChanged(size_t overhead_bytes_per_packet) { 2798 void Channel::OnOverheadChanged(size_t overhead_bytes_per_packet) {
2799 rtc::CritScope cs(&overhead_per_packet_lock_);
2796 rtp_overhead_per_packet_ = overhead_bytes_per_packet; 2800 rtp_overhead_per_packet_ = overhead_bytes_per_packet;
2797 UpdateOverheadForEncoder(); 2801 UpdateOverheadForEncoder();
2798 } 2802 }
2799 2803
2800 int Channel::GetNetworkStatistics(NetworkStatistics& stats) { 2804 int Channel::GetNetworkStatistics(NetworkStatistics& stats) {
2801 return audio_coding_->GetNetworkStatistics(&stats); 2805 return audio_coding_->GetNetworkStatistics(&stats);
2802 } 2806 }
2803 2807
2804 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const { 2808 void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const {
2805 audio_coding_->GetDecodingCallStatistics(stats); 2809 audio_coding_->GetDecodingCallStatistics(stats);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 int64_t min_rtt = 0; 3080 int64_t min_rtt = 0;
3077 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3081 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3078 0) { 3082 0) {
3079 return 0; 3083 return 0;
3080 } 3084 }
3081 return rtt; 3085 return rtt;
3082 } 3086 }
3083 3087
3084 } // namespace voe 3088 } // namespace voe
3085 } // namespace webrtc 3089 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698