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

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

Issue 1482703002: Use ChannelProxy for most calls on voe::Channel in Audio[Receive|Send]Stream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added ThreadChecker to ChannelProxy Created 5 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/voice_engine/channel_proxy.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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
11 #include "webrtc/voice_engine/channel_proxy.h" 11 #include "webrtc/voice_engine/channel_proxy.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/voice_engine/channel.h" 14 #include "webrtc/voice_engine/channel.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 namespace voe { 17 namespace voe {
18 ChannelProxy::ChannelProxy() : channel_owner_(nullptr) {} 18 ChannelProxy::ChannelProxy() : channel_owner_(nullptr) {}
19 19
20 ChannelProxy::ChannelProxy(const ChannelOwner& channel_owner) : 20 ChannelProxy::ChannelProxy(const ChannelOwner& channel_owner) :
21 channel_owner_(channel_owner) { 21 channel_owner_(channel_owner) {
22 RTC_CHECK(channel_owner_.channel()); 22 RTC_CHECK(channel_owner_.channel());
23 } 23 }
24 24
25 void ChannelProxy::SetRTCPStatus(bool enable) { 25 void ChannelProxy::SetRTCPStatus(bool enable) {
26 RTC_DCHECK(channel_owner_.channel()); 26 channel()->SetRTCPStatus(enable);
27 channel_owner_.channel()->SetRTCPStatus(enable);
28 } 27 }
29 28
30 void ChannelProxy::SetLocalSSRC(uint32_t ssrc) { 29 void ChannelProxy::SetLocalSSRC(uint32_t ssrc) {
31 RTC_DCHECK(channel_owner_.channel()); 30 RTC_DCHECK(thread_checker_.CalledOnValidThread());
32 int error = channel_owner_.channel()->SetLocalSSRC(ssrc); 31 int error = channel()->SetLocalSSRC(ssrc);
33 RTC_DCHECK_EQ(0, error); 32 RTC_DCHECK_EQ(0, error);
34 } 33 }
35 34
36 void ChannelProxy::SetRTCP_CNAME(const std::string& c_name) { 35 void ChannelProxy::SetRTCP_CNAME(const std::string& c_name) {
36 RTC_DCHECK(thread_checker_.CalledOnValidThread());
37 // Note: VoERTP_RTCP::SetRTCP_CNAME() accepts a char[256] array. 37 // Note: VoERTP_RTCP::SetRTCP_CNAME() accepts a char[256] array.
38 std::string c_name_limited = c_name.substr(0, 255); 38 std::string c_name_limited = c_name.substr(0, 255);
39 int error = channel()->SetRTCP_CNAME(c_name_limited.c_str());
40 RTC_DCHECK_EQ(0, error);
41 }
42
43 void ChannelProxy::SetSendAbsoluteSenderTimeStatus(bool enable, int id) {
44 RTC_DCHECK(thread_checker_.CalledOnValidThread());
45 int error = channel()->SetSendAbsoluteSenderTimeStatus(enable, id);
46 RTC_DCHECK_EQ(0, error);
47 }
48
49 void ChannelProxy::SetSendAudioLevelIndicationStatus(bool enable, int id) {
50 RTC_DCHECK(thread_checker_.CalledOnValidThread());
51 int error = channel()->SetSendAudioLevelIndicationStatus(enable, id);
52 RTC_DCHECK_EQ(0, error);
53 }
54
55 void ChannelProxy::SetReceiveAbsoluteSenderTimeStatus(bool enable, int id) {
56 RTC_DCHECK(thread_checker_.CalledOnValidThread());
57 int error = channel()->SetReceiveAbsoluteSenderTimeStatus(enable, id);
58 RTC_DCHECK_EQ(0, error);
59 }
60
61 void ChannelProxy::SetReceiveAudioLevelIndicationStatus(bool enable, int id) {
62 RTC_DCHECK(thread_checker_.CalledOnValidThread());
63 int error = channel()->SetReceiveAudioLevelIndicationStatus(enable, id);
64 RTC_DCHECK_EQ(0, error);
65 }
66
67 CallStatistics ChannelProxy::GetRTCPStatistics() const {
68 RTC_DCHECK(thread_checker_.CalledOnValidThread());
69 CallStatistics stats = {0};
70 int error = channel()->GetRTPStatistics(stats);
71 RTC_DCHECK_EQ(0, error);
72 return stats;
73 }
74
75 std::vector<ReportBlock> ChannelProxy::GetRemoteRTCPReportBlocks() const {
76 RTC_DCHECK(thread_checker_.CalledOnValidThread());
77 std::vector<webrtc::ReportBlock> blocks;
78 int error = channel()->GetRemoteRTCPReportBlocks(&blocks);
79 RTC_DCHECK_EQ(0, error);
80 return blocks;
81 }
82
83 NetworkStatistics ChannelProxy::GetNetworkStatistics() const {
84 RTC_DCHECK(thread_checker_.CalledOnValidThread());
85 NetworkStatistics stats = {0};
86 int error = channel()->GetNetworkStatistics(stats);
87 RTC_DCHECK_EQ(0, error);
88 return stats;
89 }
90
91 AudioDecodingCallStats ChannelProxy::GetDecodingCallStatistics() const {
92 RTC_DCHECK(thread_checker_.CalledOnValidThread());
93 AudioDecodingCallStats stats;
94 channel()->GetDecodingCallStatistics(&stats);
95 return stats;
96 }
97
98 int32_t ChannelProxy::GetSpeechOutputLevelFullRange() const {
99 RTC_DCHECK(thread_checker_.CalledOnValidThread());
100 uint32_t level = 0;
101 int error = channel()->GetSpeechOutputLevelFullRange(level);
102 RTC_DCHECK_EQ(0, error);
103 return static_cast<int32_t>(level);
104 }
105
106 uint32_t ChannelProxy::GetDelayEstimate() const {
107 RTC_DCHECK(thread_checker_.CalledOnValidThread());
108 return channel()->GetDelayEstimate();
109 }
110
111 Channel* ChannelProxy::channel() const {
39 RTC_DCHECK(channel_owner_.channel()); 112 RTC_DCHECK(channel_owner_.channel());
40 int error = channel_owner_.channel()->SetRTCP_CNAME(c_name_limited.c_str()); 113 return channel_owner_.channel();
41 RTC_DCHECK_EQ(0, error);
42 } 114 }
43 } // namespace voe 115 } // namespace voe
44 } // namespace webrtc 116 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/channel_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698