| 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> |
| 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 Loading... |
| 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 })); |
| 144 // If being called for the send channel, save a pointer to the channel | 150 // If being called for the send channel, save a pointer to the channel |
| 145 // proxy for later. | 151 // proxy for later. |
| 146 if (channel_id == kRecvChannelId) { | 152 if (channel_id == kRecvChannelId) { |
| 147 EXPECT_FALSE(recv_channel_proxy); | 153 EXPECT_FALSE(recv_channel_proxy); |
| 148 recv_channel_proxy = channel_proxy; | 154 recv_channel_proxy = channel_proxy; |
| 149 } | 155 } |
| 150 return channel_proxy; | 156 return channel_proxy; |
| 151 })); | 157 })); |
| 152 | 158 |
| 153 AudioReceiveStream::Config recv_config; | 159 AudioReceiveStream::Config recv_config; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 181 | 187 |
| 182 // Set up the mock to create a channel proxy which we know of, so that we can | 188 // Set up the mock to create a channel proxy which we know of, so that we can |
| 183 // add our expectations to it. | 189 // add our expectations to it. |
| 184 test::MockVoEChannelProxy* recv_channel_proxy = nullptr; | 190 test::MockVoEChannelProxy* recv_channel_proxy = nullptr; |
| 185 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_)) | 191 EXPECT_CALL(*call.voice_engine(), ChannelProxyFactory(testing::_)) |
| 186 .WillRepeatedly(testing::Invoke([&](int channel_id) { | 192 .WillRepeatedly(testing::Invoke([&](int channel_id) { |
| 187 test::MockVoEChannelProxy* channel_proxy = | 193 test::MockVoEChannelProxy* channel_proxy = |
| 188 new testing::NiceMock<test::MockVoEChannelProxy>(); | 194 new testing::NiceMock<test::MockVoEChannelProxy>(); |
| 189 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory()) | 195 EXPECT_CALL(*channel_proxy, GetAudioDecoderFactory()) |
| 190 .WillRepeatedly(testing::ReturnRef(decoder_factory)); | 196 .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 })); |
| 191 // If being called for the send channel, save a pointer to the channel | 202 // If being called for the send channel, save a pointer to the channel |
| 192 // proxy for later. | 203 // proxy for later. |
| 193 if (channel_id == kRecvChannelId) { | 204 if (channel_id == kRecvChannelId) { |
| 194 EXPECT_FALSE(recv_channel_proxy); | 205 EXPECT_FALSE(recv_channel_proxy); |
| 195 recv_channel_proxy = channel_proxy; | 206 recv_channel_proxy = channel_proxy; |
| 196 // We need to set this expectation here since the channel proxy is | 207 // We need to set this expectation here since the channel proxy is |
| 197 // created as a side effect of CreateAudioReceiveStream(). | 208 // created as a side effect of CreateAudioReceiveStream(). |
| 198 EXPECT_CALL(*recv_channel_proxy, | 209 EXPECT_CALL(*recv_channel_proxy, |
| 199 AssociateSendChannel(testing::_)).Times(1); | 210 AssociateSendChannel(testing::_)).Times(1); |
| 200 } | 211 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 stream = call->CreateFlexfecReceiveStream(config); | 299 stream = call->CreateFlexfecReceiveStream(config); |
| 289 EXPECT_NE(stream, nullptr); | 300 EXPECT_NE(stream, nullptr); |
| 290 streams.push_back(stream); | 301 streams.push_back(stream); |
| 291 | 302 |
| 292 for (auto s : streams) { | 303 for (auto s : streams) { |
| 293 call->DestroyFlexfecReceiveStream(s); | 304 call->DestroyFlexfecReceiveStream(s); |
| 294 } | 305 } |
| 295 } | 306 } |
| 296 | 307 |
| 297 } // namespace webrtc | 308 } // namespace webrtc |
| OLD | NEW |