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