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 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void FakeAudioReceiveStream::SetSink( | 91 void FakeAudioReceiveStream::SetSink( |
92 std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 92 std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
93 sink_ = std::move(sink); | 93 sink_ = std::move(sink); |
94 } | 94 } |
95 | 95 |
96 void FakeAudioReceiveStream::SetGain(float gain) { | 96 void FakeAudioReceiveStream::SetGain(float gain) { |
97 gain_ = gain; | 97 gain_ = gain; |
98 } | 98 } |
99 | 99 |
100 FakeVideoSendStream::FakeVideoSendStream( | 100 FakeVideoSendStream::FakeVideoSendStream( |
101 webrtc::VideoSendStream::Config config, | 101 const webrtc::VideoSendStream::Config& config, |
102 webrtc::VideoEncoderConfig encoder_config) | 102 const webrtc::VideoEncoderConfig& encoder_config) |
103 : sending_(false), | 103 : sending_(false), |
104 config_(std::move(config)), | 104 config_(config), |
105 codec_settings_set_(false), | 105 codec_settings_set_(false), |
106 num_swapped_frames_(0) { | 106 num_swapped_frames_(0) { |
107 RTC_DCHECK(config.encoder_settings.encoder != NULL); | 107 RTC_DCHECK(config.encoder_settings.encoder != NULL); |
108 ReconfigureVideoEncoder(std::move(encoder_config)); | 108 ReconfigureVideoEncoder(encoder_config); |
109 } | 109 } |
110 | 110 |
111 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 111 webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() const { |
112 return config_; | 112 return config_; |
113 } | 113 } |
114 | 114 |
115 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() | 115 webrtc::VideoEncoderConfig FakeVideoSendStream::GetEncoderConfig() const { |
116 const { | |
117 return encoder_config_; | 116 return encoder_config_; |
118 } | 117 } |
119 | 118 |
120 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { | 119 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
121 return encoder_config_.streams; | 120 return encoder_config_.streams; |
122 } | 121 } |
123 | 122 |
124 bool FakeVideoSendStream::IsSending() const { | 123 bool FakeVideoSendStream::IsSending() const { |
125 return sending_; | 124 return sending_; |
126 } | 125 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void FakeVideoSendStream::SetStats( | 170 void FakeVideoSendStream::SetStats( |
172 const webrtc::VideoSendStream::Stats& stats) { | 171 const webrtc::VideoSendStream::Stats& stats) { |
173 stats_ = stats; | 172 stats_ = stats; |
174 } | 173 } |
175 | 174 |
176 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 175 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
177 return stats_; | 176 return stats_; |
178 } | 177 } |
179 | 178 |
180 void FakeVideoSendStream::ReconfigureVideoEncoder( | 179 void FakeVideoSendStream::ReconfigureVideoEncoder( |
181 webrtc::VideoEncoderConfig config) { | 180 const webrtc::VideoEncoderConfig& config) { |
| 181 encoder_config_ = config; |
182 if (config.encoder_specific_settings != NULL) { | 182 if (config.encoder_specific_settings != NULL) { |
183 if (config_.encoder_settings.payload_name == "VP8") { | 183 if (config_.encoder_settings.payload_name == "VP8") { |
184 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( | 184 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( |
185 config.encoder_specific_settings); | 185 config.encoder_specific_settings); |
186 if (!config.streams.empty()) { | 186 if (!config.streams.empty()) { |
187 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 187 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
188 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 188 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
189 } | 189 } |
190 } else if (config_.encoder_settings.payload_name == "VP9") { | 190 } else if (config_.encoder_settings.payload_name == "VP9") { |
191 vpx_settings_.vp9 = *reinterpret_cast<const webrtc::VideoCodecVP9*>( | 191 vpx_settings_.vp9 = *reinterpret_cast<const webrtc::VideoCodecVP9*>( |
192 config.encoder_specific_settings); | 192 config.encoder_specific_settings); |
193 if (!config.streams.empty()) { | 193 if (!config.streams.empty()) { |
194 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( | 194 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( |
195 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 195 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
196 } | 196 } |
197 } else { | 197 } else { |
198 ADD_FAILURE() << "Unsupported encoder payload: " | 198 ADD_FAILURE() << "Unsupported encoder payload: " |
199 << config_.encoder_settings.payload_name; | 199 << config_.encoder_settings.payload_name; |
200 } | 200 } |
201 } | 201 } |
202 encoder_config_ = std::move(config); | |
203 codec_settings_set_ = config.encoder_specific_settings != NULL; | 202 codec_settings_set_ = config.encoder_specific_settings != NULL; |
204 ++num_encoder_reconfigurations_; | 203 ++num_encoder_reconfigurations_; |
205 } | 204 } |
206 | 205 |
207 webrtc::VideoCaptureInput* FakeVideoSendStream::Input() { | 206 webrtc::VideoCaptureInput* FakeVideoSendStream::Input() { |
208 return this; | 207 return this; |
209 } | 208 } |
210 | 209 |
211 void FakeVideoSendStream::Start() { | 210 void FakeVideoSendStream::Start() { |
212 sending_ = true; | 211 sending_ = true; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 static_cast<FakeAudioReceiveStream*>(receive_stream)); | 352 static_cast<FakeAudioReceiveStream*>(receive_stream)); |
354 if (it == audio_receive_streams_.end()) { | 353 if (it == audio_receive_streams_.end()) { |
355 ADD_FAILURE() << "DestroyAudioReceiveStream called with unknown parameter."; | 354 ADD_FAILURE() << "DestroyAudioReceiveStream called with unknown parameter."; |
356 } else { | 355 } else { |
357 delete *it; | 356 delete *it; |
358 audio_receive_streams_.erase(it); | 357 audio_receive_streams_.erase(it); |
359 } | 358 } |
360 } | 359 } |
361 | 360 |
362 webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( | 361 webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( |
363 webrtc::VideoSendStream::Config config, | 362 const webrtc::VideoSendStream::Config& config, |
364 webrtc::VideoEncoderConfig encoder_config) { | 363 const webrtc::VideoEncoderConfig& encoder_config) { |
365 FakeVideoSendStream* fake_stream = | 364 FakeVideoSendStream* fake_stream = |
366 new FakeVideoSendStream(std::move(config), std::move(encoder_config)); | 365 new FakeVideoSendStream(config, encoder_config); |
367 video_send_streams_.push_back(fake_stream); | 366 video_send_streams_.push_back(fake_stream); |
368 ++num_created_send_streams_; | 367 ++num_created_send_streams_; |
369 return fake_stream; | 368 return fake_stream; |
370 } | 369 } |
371 | 370 |
372 void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { | 371 void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
373 auto it = std::find(video_send_streams_.begin(), | 372 auto it = std::find(video_send_streams_.begin(), |
374 video_send_streams_.end(), | 373 video_send_streams_.end(), |
375 static_cast<FakeVideoSendStream*>(send_stream)); | 374 static_cast<FakeVideoSendStream*>(send_stream)); |
376 if (it == video_send_streams_.end()) { | 375 if (it == video_send_streams_.end()) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 479 } |
481 | 480 |
482 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 481 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
483 int64_t max_size_bytes) { | 482 int64_t max_size_bytes) { |
484 return false; | 483 return false; |
485 } | 484 } |
486 | 485 |
487 void FakeCall::StopEventLog() {} | 486 void FakeCall::StopEventLog() {} |
488 | 487 |
489 } // namespace cricket | 488 } // namespace cricket |
OLD | NEW |