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 const webrtc::VideoSendStream::Config& config, | 101 webrtc::VideoSendStream::Config config, |
102 const webrtc::VideoEncoderConfig& encoder_config) | 102 webrtc::VideoEncoderConfig encoder_config) |
103 : sending_(false), | 103 : sending_(false), |
104 config_(config), | 104 config_(std::move(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(encoder_config); | 108 ReconfigureVideoEncoder(std::move(encoder_config)); |
109 } | 109 } |
110 | 110 |
111 webrtc::VideoSendStream::Config FakeVideoSendStream::GetConfig() const { | 111 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
112 return config_; | 112 return config_; |
113 } | 113 } |
114 | 114 |
115 webrtc::VideoEncoderConfig FakeVideoSendStream::GetEncoderConfig() const { | 115 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() |
| 116 const { |
116 return encoder_config_; | 117 return encoder_config_; |
117 } | 118 } |
118 | 119 |
119 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { | 120 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
120 return encoder_config_.streams; | 121 return encoder_config_.streams; |
121 } | 122 } |
122 | 123 |
123 bool FakeVideoSendStream::IsSending() const { | 124 bool FakeVideoSendStream::IsSending() const { |
124 return sending_; | 125 return sending_; |
125 } | 126 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void FakeVideoSendStream::SetStats( | 171 void FakeVideoSendStream::SetStats( |
171 const webrtc::VideoSendStream::Stats& stats) { | 172 const webrtc::VideoSendStream::Stats& stats) { |
172 stats_ = stats; | 173 stats_ = stats; |
173 } | 174 } |
174 | 175 |
175 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 176 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
176 return stats_; | 177 return stats_; |
177 } | 178 } |
178 | 179 |
179 void FakeVideoSendStream::ReconfigureVideoEncoder( | 180 void FakeVideoSendStream::ReconfigureVideoEncoder( |
180 const webrtc::VideoEncoderConfig& config) { | 181 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); |
202 codec_settings_set_ = config.encoder_specific_settings != NULL; | 203 codec_settings_set_ = config.encoder_specific_settings != NULL; |
203 ++num_encoder_reconfigurations_; | 204 ++num_encoder_reconfigurations_; |
204 } | 205 } |
205 | 206 |
206 webrtc::VideoCaptureInput* FakeVideoSendStream::Input() { | 207 webrtc::VideoCaptureInput* FakeVideoSendStream::Input() { |
207 return this; | 208 return this; |
208 } | 209 } |
209 | 210 |
210 void FakeVideoSendStream::Start() { | 211 void FakeVideoSendStream::Start() { |
211 sending_ = true; | 212 sending_ = true; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 static_cast<FakeAudioReceiveStream*>(receive_stream)); | 353 static_cast<FakeAudioReceiveStream*>(receive_stream)); |
353 if (it == audio_receive_streams_.end()) { | 354 if (it == audio_receive_streams_.end()) { |
354 ADD_FAILURE() << "DestroyAudioReceiveStream called with unknown parameter."; | 355 ADD_FAILURE() << "DestroyAudioReceiveStream called with unknown parameter."; |
355 } else { | 356 } else { |
356 delete *it; | 357 delete *it; |
357 audio_receive_streams_.erase(it); | 358 audio_receive_streams_.erase(it); |
358 } | 359 } |
359 } | 360 } |
360 | 361 |
361 webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( | 362 webrtc::VideoSendStream* FakeCall::CreateVideoSendStream( |
362 const webrtc::VideoSendStream::Config& config, | 363 webrtc::VideoSendStream::Config config, |
363 const webrtc::VideoEncoderConfig& encoder_config) { | 364 webrtc::VideoEncoderConfig encoder_config) { |
364 FakeVideoSendStream* fake_stream = | 365 FakeVideoSendStream* fake_stream = |
365 new FakeVideoSendStream(config, encoder_config); | 366 new FakeVideoSendStream(std::move(config), std::move(encoder_config)); |
366 video_send_streams_.push_back(fake_stream); | 367 video_send_streams_.push_back(fake_stream); |
367 ++num_created_send_streams_; | 368 ++num_created_send_streams_; |
368 return fake_stream; | 369 return fake_stream; |
369 } | 370 } |
370 | 371 |
371 void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { | 372 void FakeCall::DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) { |
372 auto it = std::find(video_send_streams_.begin(), | 373 auto it = std::find(video_send_streams_.begin(), |
373 video_send_streams_.end(), | 374 video_send_streams_.end(), |
374 static_cast<FakeVideoSendStream*>(send_stream)); | 375 static_cast<FakeVideoSendStream*>(send_stream)); |
375 if (it == video_send_streams_.end()) { | 376 if (it == video_send_streams_.end()) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 480 } |
480 | 481 |
481 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 482 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
482 int64_t max_size_bytes) { | 483 int64_t max_size_bytes) { |
483 return false; | 484 return false; |
484 } | 485 } |
485 | 486 |
486 void FakeCall::StopEventLog() {} | 487 void FakeCall::StopEventLog() {} |
487 | 488 |
488 } // namespace cricket | 489 } // namespace cricket |
OLD | NEW |