Chromium Code Reviews| 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 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::EnableEncodedFrameRecording( | |
| 182 const std::vector<rtc::PlatformFile>& files, | |
| 183 size_t byte_limit) { | |
|
stefan-webrtc
2016/09/13 10:53:17
Why does this take a byte_limit?
palmkvist
2016/09/13 11:59:37
It's not used in the fake streams, but in the regu
| |
| 184 for (auto it = files.begin(); it < files.end(); ++it) { | |
|
stefan-webrtc
2016/09/13 10:53:17
Something like this instead:
for (rtc::PlatformFil
palmkvist
2016/09/13 11:59:37
Done.
| |
| 185 rtc::ClosePlatformFile(*it); | |
| 186 } | |
| 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::EnableEncodedFrameRecording(rtc::PlatformFile file, | |
| 262 size_t byte_limit) { | |
| 263 rtc::ClosePlatformFile(file); | |
| 264 } | |
| 265 | |
| 252 FakeCall::FakeCall(const webrtc::Call::Config& config) | 266 FakeCall::FakeCall(const webrtc::Call::Config& config) |
| 253 : config_(config), | 267 : config_(config), |
| 254 audio_network_state_(webrtc::kNetworkUp), | 268 audio_network_state_(webrtc::kNetworkUp), |
| 255 video_network_state_(webrtc::kNetworkUp), | 269 video_network_state_(webrtc::kNetworkUp), |
| 256 num_created_send_streams_(0), | 270 num_created_send_streams_(0), |
| 257 num_created_receive_streams_(0) {} | 271 num_created_receive_streams_(0) {} |
| 258 | 272 |
| 259 FakeCall::~FakeCall() { | 273 FakeCall::~FakeCall() { |
| 260 EXPECT_EQ(0u, video_send_streams_.size()); | 274 EXPECT_EQ(0u, video_send_streams_.size()); |
| 261 EXPECT_EQ(0u, audio_send_streams_.size()); | 275 EXPECT_EQ(0u, audio_send_streams_.size()); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 } | 494 } |
| 481 | 495 |
| 482 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 496 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
| 483 int64_t max_size_bytes) { | 497 int64_t max_size_bytes) { |
| 484 return false; | 498 return false; |
| 485 } | 499 } |
| 486 | 500 |
| 487 void FakeCall::StopEventLog() {} | 501 void FakeCall::StopEventLog() {} |
| 488 | 502 |
| 489 } // namespace cricket | 503 } // namespace cricket |
| OLD | NEW |