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

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.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/audio/audio_send_stream.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | 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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 config.voice_engine = &voice_engine_; 51 config.voice_engine = &voice_engine_;
52 audio_state_ = AudioState::Create(config); 52 audio_state_ = AudioState::Create(config);
53 53
54 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) 54 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
55 .WillOnce(Invoke([this](int channel_id) { 55 .WillOnce(Invoke([this](int channel_id) {
56 EXPECT_FALSE(channel_proxy_); 56 EXPECT_FALSE(channel_proxy_);
57 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); 57 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
58 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1); 58 EXPECT_CALL(*channel_proxy_, SetRTCPStatus(true)).Times(1);
59 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1); 59 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kSsrc)).Times(1);
60 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1); 60 EXPECT_CALL(*channel_proxy_, SetRTCP_CNAME(StrEq(kCName))).Times(1);
61 EXPECT_CALL(*channel_proxy_,
62 SetSendAbsoluteSenderTimeStatus(true, kAbsSendTimeId)).Times(1);
63 EXPECT_CALL(*channel_proxy_,
64 SetSendAudioLevelIndicationStatus(true, kAudioLevelId)).Times(1);
61 return channel_proxy_; 65 return channel_proxy_;
62 })); 66 }));
63 EXPECT_CALL(voice_engine_,
64 SetSendAbsoluteSenderTimeStatus(kChannelId, true, kAbsSendTimeId))
65 .WillOnce(Return(0));
66 EXPECT_CALL(voice_engine_,
67 SetSendAudioLevelIndicationStatus(kChannelId, true, kAudioLevelId))
68 .WillOnce(Return(0));
69 stream_config_.voe_channel_id = kChannelId; 67 stream_config_.voe_channel_id = kChannelId;
70 stream_config_.rtp.ssrc = kSsrc; 68 stream_config_.rtp.ssrc = kSsrc;
71 stream_config_.rtp.c_name = kCName; 69 stream_config_.rtp.c_name = kCName;
72 stream_config_.rtp.extensions.push_back( 70 stream_config_.rtp.extensions.push_back(
73 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); 71 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId));
74 stream_config_.rtp.extensions.push_back( 72 stream_config_.rtp.extensions.push_back(
75 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 73 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
76 } 74 }
77 75
78 AudioSendStream::Config& config() { return stream_config_; } 76 AudioSendStream::Config& config() { return stream_config_; }
79 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } 77 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
80 78
81 void SetupMockForGetStats() { 79 void SetupMockForGetStats() {
82 using testing::DoAll; 80 using testing::DoAll;
83 using testing::SetArgPointee;
84 using testing::SetArgReferee; 81 using testing::SetArgReferee;
85 82
86 std::vector<ReportBlock> report_blocks; 83 std::vector<ReportBlock> report_blocks;
87 webrtc::ReportBlock block = kReportBlock; 84 webrtc::ReportBlock block = kReportBlock;
88 report_blocks.push_back(block); // Has wrong SSRC. 85 report_blocks.push_back(block); // Has wrong SSRC.
89 block.source_SSRC = kSsrc; 86 block.source_SSRC = kSsrc;
90 report_blocks.push_back(block); // Correct block. 87 report_blocks.push_back(block); // Correct block.
91 block.fraction_lost = 0; 88 block.fraction_lost = 0;
92 report_blocks.push_back(block); // Duplicate SSRC, bad fraction_lost. 89 report_blocks.push_back(block); // Duplicate SSRC, bad fraction_lost.
93 90
94 EXPECT_CALL(voice_engine_, GetRTCPStatistics(kChannelId, _)) 91 EXPECT_TRUE(channel_proxy_);
95 .WillRepeatedly(DoAll(SetArgReferee<1>(kCallStats), Return(0))); 92 EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
93 .WillRepeatedly(Return(kCallStats));
94 EXPECT_CALL(*channel_proxy_, GetRemoteRTCPReportBlocks())
95 .WillRepeatedly(Return(report_blocks));
96
96 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _)) 97 EXPECT_CALL(voice_engine_, GetSendCodec(kChannelId, _))
97 .WillRepeatedly(DoAll(SetArgReferee<1>(kCodecInst), Return(0))); 98 .WillRepeatedly(DoAll(SetArgReferee<1>(kCodecInst), Return(0)));
98 EXPECT_CALL(voice_engine_, GetRemoteRTCPReportBlocks(kChannelId, _))
99 .WillRepeatedly(DoAll(SetArgPointee<1>(report_blocks), Return(0)));
100 EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_)) 99 EXPECT_CALL(voice_engine_, GetSpeechInputLevelFullRange(_))
101 .WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0))); 100 .WillRepeatedly(DoAll(SetArgReferee<0>(kSpeechInputLevel), Return(0)));
102 EXPECT_CALL(voice_engine_, GetEcMetricsStatus(_)) 101 EXPECT_CALL(voice_engine_, GetEcMetricsStatus(_))
103 .WillRepeatedly(DoAll(SetArgReferee<0>(true), Return(0))); 102 .WillRepeatedly(DoAll(SetArgReferee<0>(true), Return(0)));
104 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _)) 103 EXPECT_CALL(voice_engine_, GetEchoMetrics(_, _, _, _))
105 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss), 104 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoReturnLoss),
106 SetArgReferee<1>(kEchoReturnLossEnhancement), 105 SetArgReferee<1>(kEchoReturnLossEnhancement),
107 Return(0))); 106 Return(0)));
108 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) 107 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _))
109 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), 108 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 static_cast<internal::AudioState*>(helper.audio_state().get()); 176 static_cast<internal::AudioState*>(helper.audio_state().get());
178 VoiceEngineObserver* voe_observer = 177 VoiceEngineObserver* voe_observer =
179 static_cast<VoiceEngineObserver*>(internal_audio_state); 178 static_cast<VoiceEngineObserver*>(internal_audio_state);
180 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); 179 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING);
181 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); 180 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected);
182 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); 181 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING);
183 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); 182 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
184 } 183 }
185 } // namespace test 184 } // namespace test
186 } // namespace webrtc 185 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698