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

Side by Side Diff: webrtc/call/call_unittest.cc

Issue 2686043006: WebRtcVoiceMediaChannel::AddRecvStream: Don't call SetRecPayloadType (Closed)
Patch Set: Discard packets when updating payload type map 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
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 <list> 11 #include <list>
12 #include <map>
12 #include <memory> 13 #include <memory>
13 14
14 #include "webrtc/call/audio_state.h" 15 #include "webrtc/call/audio_state.h"
15 #include "webrtc/call/call.h" 16 #include "webrtc/call/call.h"
16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 17 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" 18 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
18 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" 19 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
19 #include "webrtc/test/gtest.h" 20 #include "webrtc/test/gtest.h"
20 #include "webrtc/test/mock_transport.h" 21 #include "webrtc/test/mock_transport.h"
21 #include "webrtc/test/mock_voice_engine.h" 22 #include "webrtc/test/mock_voice_engine.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 135
135 // Set up the mock to create a channel proxy which we know of, so that we can 136 // Set up the mock to create a channel proxy which we know of, so that we can
136 // add our expectations to it. 137 // add our expectations to it.
137 test::MockVoEChannelProxy* recv_channel_proxy = nullptr; 138 test::MockVoEChannelProxy* recv_channel_proxy = nullptr;
138 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_)) 139 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_))
139 .WillRepeatedly(testing::Invoke([&](int channel_id) { 140 .WillRepeatedly(testing::Invoke([&](int channel_id) {
140 test::MockVoEChannelProxy* channel_proxy = 141 test::MockVoEChannelProxy* channel_proxy =
141 new testing::NiceMock<test::MockVoEChannelProxy>(); 142 new testing::NiceMock<test::MockVoEChannelProxy>();
142 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory()) 143 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory())
143 .WillRepeatedly(testing::ReturnRef(decoder_factory)); 144 .WillRepeatedly(testing::ReturnRef(decoder_factory));
145 EXPECT_CALL(*channel_proxy, SetReceiveCodecs(testing::_))
146 .WillRepeatedly(testing::Invoke(
147 [](const std::map<int, SdpAudioFormat>& codecs) {
148 EXPECT_THAT(codecs, testing::IsEmpty());
149 return true;
150 }));
144 // If being called for the send channel, save a pointer to the channel 151 // If being called for the send channel, save a pointer to the channel
145 // proxy for later. 152 // proxy for later.
146 if (channel_id == kRecvChannelId) { 153 if (channel_id == kRecvChannelId) {
147 EXPECT_FALSE(recv_channel_proxy); 154 EXPECT_FALSE(recv_channel_proxy);
148 recv_channel_proxy = channel_proxy; 155 recv_channel_proxy = channel_proxy;
149 } 156 }
150 return channel_proxy; 157 return channel_proxy;
151 })); 158 }));
152 159
153 AudioReceiveStream::Config recv_config; 160 AudioReceiveStream::Config recv_config;
(...skipping 27 matching lines...) Expand all
181 188
182 // Set up the mock to create a channel proxy which we know of, so that we can 189 // Set up the mock to create a channel proxy which we know of, so that we can
183 // add our expectations to it. 190 // add our expectations to it.
184 test::MockVoEChannelProxy* recv_channel_proxy = nullptr; 191 test::MockVoEChannelProxy* recv_channel_proxy = nullptr;
185 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_)) 192 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_))
186 .WillRepeatedly(testing::Invoke([&](int channel_id) { 193 .WillRepeatedly(testing::Invoke([&](int channel_id) {
187 test::MockVoEChannelProxy* channel_proxy = 194 test::MockVoEChannelProxy* channel_proxy =
188 new testing::NiceMock<test::MockVoEChannelProxy>(); 195 new testing::NiceMock<test::MockVoEChannelProxy>();
189 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory()) 196 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory())
190 .WillRepeatedly(testing::ReturnRef(decoder_factory)); 197 .WillRepeatedly(testing::ReturnRef(decoder_factory));
198 EXPECT_CALL(*channel_proxy, SetReceiveCodecs(testing::_))
199 .WillRepeatedly(testing::Invoke(
200 [](const std::map<int, SdpAudioFormat>& codecs) {
201 EXPECT_THAT(codecs, testing::IsEmpty());
202 return true;
203 }));
191 // If being called for the send channel, save a pointer to the channel 204 // If being called for the send channel, save a pointer to the channel
192 // proxy for later. 205 // proxy for later.
193 if (channel_id == kRecvChannelId) { 206 if (channel_id == kRecvChannelId) {
194 EXPECT_FALSE(recv_channel_proxy); 207 EXPECT_FALSE(recv_channel_proxy);
195 recv_channel_proxy = channel_proxy; 208 recv_channel_proxy = channel_proxy;
196 // We need to set this expectation here since the channel proxy is 209 // We need to set this expectation here since the channel proxy is
197 // created as a side effect of CreateAudioReceiveStream(). 210 // created as a side effect of CreateAudioReceiveStream().
198 EXPECT_CALL(*recv_channel_proxy, 211 EXPECT_CALL(*recv_channel_proxy,
199 AssociateSendChannel(testing::_)).Times(1); 212 AssociateSendChannel(testing::_)).Times(1);
200 } 213 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 stream = call->CreateFlexfecReceiveStream(config); 301 stream = call->CreateFlexfecReceiveStream(config);
289 EXPECT_NE(stream, nullptr); 302 EXPECT_NE(stream, nullptr);
290 streams.push_back(stream); 303 streams.push_back(stream);
291 304
292 for (auto s : streams) { 305 for (auto s : streams) {
293 call->DestroyFlexfecReceiveStream(s); 306 call->DestroyFlexfecReceiveStream(s);
294 } 307 }
295 } 308 }
296 309
297 } // namespace webrtc 310 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698