| 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/platform_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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 void FakeVideoSendStream::SetStats( | 177 void FakeVideoSendStream::SetStats( |
| 177 const webrtc::VideoSendStream::Stats& stats) { | 178 const webrtc::VideoSendStream::Stats& stats) { |
| 178 stats_ = stats; | 179 stats_ = stats; |
| 179 } | 180 } |
| 180 | 181 |
| 181 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 182 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
| 182 return stats_; | 183 return stats_; |
| 183 } | 184 } |
| 184 | 185 |
| 186 void FakeVideoSendStream::EnableEncodedFrameRecording( |
| 187 const std::vector<rtc::PlatformFile>& files, |
| 188 size_t byte_limit) { |
| 189 for (rtc::PlatformFile file : files) |
| 190 rtc::ClosePlatformFile(file); |
| 191 } |
| 192 |
| 185 void FakeVideoSendStream::ReconfigureVideoEncoder( | 193 void FakeVideoSendStream::ReconfigureVideoEncoder( |
| 186 webrtc::VideoEncoderConfig config) { | 194 webrtc::VideoEncoderConfig config) { |
| 187 if (config.encoder_specific_settings != NULL) { | 195 if (config.encoder_specific_settings != NULL) { |
| 188 if (config_.encoder_settings.payload_name == "VP8") { | 196 if (config_.encoder_settings.payload_name == "VP8") { |
| 189 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 197 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
| 190 if (!config.streams.empty()) { | 198 if (!config.streams.empty()) { |
| 191 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 199 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
| 192 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 200 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
| 193 } | 201 } |
| 194 } else if (config_.encoder_settings.payload_name == "VP9") { | 202 } else if (config_.encoder_settings.payload_name == "VP9") { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 259 |
| 252 void FakeVideoReceiveStream::Stop() { | 260 void FakeVideoReceiveStream::Stop() { |
| 253 receiving_ = false; | 261 receiving_ = false; |
| 254 } | 262 } |
| 255 | 263 |
| 256 void FakeVideoReceiveStream::SetStats( | 264 void FakeVideoReceiveStream::SetStats( |
| 257 const webrtc::VideoReceiveStream::Stats& stats) { | 265 const webrtc::VideoReceiveStream::Stats& stats) { |
| 258 stats_ = stats; | 266 stats_ = stats; |
| 259 } | 267 } |
| 260 | 268 |
| 269 void FakeVideoReceiveStream::EnableEncodedFrameRecording(rtc::PlatformFile file, |
| 270 size_t byte_limit) { |
| 271 rtc::ClosePlatformFile(file); |
| 272 } |
| 273 |
| 261 FakeCall::FakeCall(const webrtc::Call::Config& config) | 274 FakeCall::FakeCall(const webrtc::Call::Config& config) |
| 262 : config_(config), | 275 : config_(config), |
| 263 audio_network_state_(webrtc::kNetworkUp), | 276 audio_network_state_(webrtc::kNetworkUp), |
| 264 video_network_state_(webrtc::kNetworkUp), | 277 video_network_state_(webrtc::kNetworkUp), |
| 265 num_created_send_streams_(0), | 278 num_created_send_streams_(0), |
| 266 num_created_receive_streams_(0) {} | 279 num_created_receive_streams_(0) {} |
| 267 | 280 |
| 268 FakeCall::~FakeCall() { | 281 FakeCall::~FakeCall() { |
| 269 EXPECT_EQ(0u, video_send_streams_.size()); | 282 EXPECT_EQ(0u, video_send_streams_.size()); |
| 270 EXPECT_EQ(0u, audio_send_streams_.size()); | 283 EXPECT_EQ(0u, audio_send_streams_.size()); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 502 } |
| 490 | 503 |
| 491 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 504 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
| 492 int64_t max_size_bytes) { | 505 int64_t max_size_bytes) { |
| 493 return false; | 506 return false; |
| 494 } | 507 } |
| 495 | 508 |
| 496 void FakeCall::StopEventLog() {} | 509 void FakeCall::StopEventLog() {} |
| 497 | 510 |
| 498 } // namespace cricket | 511 } // namespace cricket |
| OLD | NEW |