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 "webrtc/media/engine/fakewebrtccall.h" | 11 #include "webrtc/media/engine/fakewebrtccall.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/api/call/audio_sink.h" | 16 #include "webrtc/api/call/audio_sink.h" |
17 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/base/file.h" |
18 #include "webrtc/base/gunit.h" | 19 #include "webrtc/base/gunit.h" |
19 #include "webrtc/media/base/rtputils.h" | 20 #include "webrtc/media/base/rtputils.h" |
20 | 21 |
21 namespace cricket { | 22 namespace cricket { |
22 FakeAudioSendStream::FakeAudioSendStream( | 23 FakeAudioSendStream::FakeAudioSendStream( |
23 const webrtc::AudioSendStream::Config& config) : config_(config) { | 24 const webrtc::AudioSendStream::Config& config) : config_(config) { |
24 RTC_DCHECK(config.voe_channel_id != -1); | 25 RTC_DCHECK(config.voe_channel_id != -1); |
25 } | 26 } |
26 | 27 |
27 const webrtc::AudioSendStream::Config& | 28 const webrtc::AudioSendStream::Config& |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 171 |
171 void FakeVideoSendStream::SetStats( | 172 void FakeVideoSendStream::SetStats( |
172 const webrtc::VideoSendStream::Stats& stats) { | 173 const webrtc::VideoSendStream::Stats& stats) { |
173 stats_ = stats; | 174 stats_ = stats; |
174 } | 175 } |
175 | 176 |
176 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 177 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
177 return stats_; | 178 return stats_; |
178 } | 179 } |
179 | 180 |
| 181 void FakeVideoSendStream::SetLogFiles(rtc::PlatformFile file1, |
| 182 rtc::PlatformFile file2, |
| 183 rtc::PlatformFile file3) { |
| 184 rtc::File(file1).Close(); |
| 185 rtc::File(file2).Close(); |
| 186 rtc::File(file3).Close(); |
| 187 } |
| 188 |
180 void FakeVideoSendStream::ReconfigureVideoEncoder( | 189 void FakeVideoSendStream::ReconfigureVideoEncoder( |
181 webrtc::VideoEncoderConfig config) { | 190 webrtc::VideoEncoderConfig config) { |
182 if (config.encoder_specific_settings != NULL) { | 191 if (config.encoder_specific_settings != NULL) { |
183 if (config_.encoder_settings.payload_name == "VP8") { | 192 if (config_.encoder_settings.payload_name == "VP8") { |
184 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( | 193 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( |
185 config.encoder_specific_settings); | 194 config.encoder_specific_settings); |
186 if (!config.streams.empty()) { | 195 if (!config.streams.empty()) { |
187 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 196 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
188 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 197 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
189 } | 198 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 251 |
243 void FakeVideoReceiveStream::Stop() { | 252 void FakeVideoReceiveStream::Stop() { |
244 receiving_ = false; | 253 receiving_ = false; |
245 } | 254 } |
246 | 255 |
247 void FakeVideoReceiveStream::SetStats( | 256 void FakeVideoReceiveStream::SetStats( |
248 const webrtc::VideoReceiveStream::Stats& stats) { | 257 const webrtc::VideoReceiveStream::Stats& stats) { |
249 stats_ = stats; | 258 stats_ = stats; |
250 } | 259 } |
251 | 260 |
| 261 void FakeVideoReceiveStream::SetLogFile(rtc::PlatformFile file) { |
| 262 rtc::File(file).Close(); |
| 263 } |
| 264 |
252 FakeCall::FakeCall(const webrtc::Call::Config& config) | 265 FakeCall::FakeCall(const webrtc::Call::Config& config) |
253 : config_(config), | 266 : config_(config), |
254 audio_network_state_(webrtc::kNetworkUp), | 267 audio_network_state_(webrtc::kNetworkUp), |
255 video_network_state_(webrtc::kNetworkUp), | 268 video_network_state_(webrtc::kNetworkUp), |
256 num_created_send_streams_(0), | 269 num_created_send_streams_(0), |
257 num_created_receive_streams_(0) {} | 270 num_created_receive_streams_(0) {} |
258 | 271 |
259 FakeCall::~FakeCall() { | 272 FakeCall::~FakeCall() { |
260 EXPECT_EQ(0u, video_send_streams_.size()); | 273 EXPECT_EQ(0u, video_send_streams_.size()); |
261 EXPECT_EQ(0u, audio_send_streams_.size()); | 274 EXPECT_EQ(0u, audio_send_streams_.size()); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 493 } |
481 | 494 |
482 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 495 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
483 int64_t max_size_bytes) { | 496 int64_t max_size_bytes) { |
484 return false; | 497 return false; |
485 } | 498 } |
486 | 499 |
487 void FakeCall::StopEventLog() {} | 500 void FakeCall::StopEventLog() {} |
488 | 501 |
489 } // namespace cricket | 502 } // namespace cricket |
OLD | NEW |