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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 116 |
117 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 117 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
118 return config_; | 118 return config_; |
119 } | 119 } |
120 | 120 |
121 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() | 121 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() |
122 const { | 122 const { |
123 return encoder_config_; | 123 return encoder_config_; |
124 } | 124 } |
125 | 125 |
126 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { | 126 const std::vector<webrtc::VideoStream>& FakeVideoSendStream::GetVideoStreams() |
127 return encoder_config_.streams; | 127 const { |
128 return video_streams_; | |
128 } | 129 } |
129 | 130 |
130 bool FakeVideoSendStream::IsSending() const { | 131 bool FakeVideoSendStream::IsSending() const { |
131 return sending_; | 132 return sending_; |
132 } | 133 } |
133 | 134 |
134 bool FakeVideoSendStream::GetVp8Settings( | 135 bool FakeVideoSendStream::GetVp8Settings( |
135 webrtc::VideoCodecVP8* settings) const { | 136 webrtc::VideoCodecVP8* settings) const { |
136 if (!codec_settings_set_) { | 137 if (!codec_settings_set_) { |
137 return false; | 138 return false; |
(...skipping 25 matching lines...) Expand all Loading... | |
163 return last_frame_.height(); | 164 return last_frame_.height(); |
164 } | 165 } |
165 | 166 |
166 int64_t FakeVideoSendStream::GetLastTimestamp() const { | 167 int64_t FakeVideoSendStream::GetLastTimestamp() const { |
167 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); | 168 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); |
168 return last_frame_.render_time_ms(); | 169 return last_frame_.render_time_ms(); |
169 } | 170 } |
170 | 171 |
171 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { | 172 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { |
172 ++num_swapped_frames_; | 173 ++num_swapped_frames_; |
174 if (frame.width() != last_frame_.width() || | |
175 frame.height() != last_frame_.height() || | |
176 frame.rotation() != last_frame_.rotation()) { | |
177 video_streams_ = | |
178 encoder_config_.encoder_stream_factory->CreateEncoderStreams( | |
179 frame.width(), frame.height(), encoder_config_); | |
180 } | |
173 last_frame_.ShallowCopy(frame); | 181 last_frame_.ShallowCopy(frame); |
174 } | 182 } |
175 | 183 |
176 void FakeVideoSendStream::SetStats( | 184 void FakeVideoSendStream::SetStats( |
177 const webrtc::VideoSendStream::Stats& stats) { | 185 const webrtc::VideoSendStream::Stats& stats) { |
178 stats_ = stats; | 186 stats_ = stats; |
179 } | 187 } |
180 | 188 |
181 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 189 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
182 return stats_; | 190 return stats_; |
183 } | 191 } |
184 | 192 |
185 void FakeVideoSendStream::ReconfigureVideoEncoder( | 193 void FakeVideoSendStream::ReconfigureVideoEncoder( |
186 webrtc::VideoEncoderConfig config) { | 194 webrtc::VideoEncoderConfig config) { |
195 video_streams_ = config.encoder_stream_factory->CreateEncoderStreams( | |
196 last_frame_.width(), last_frame_.height(), config); | |
197 encoder_config_ = std::move(config); | |
198 codec_settings_set_ = config.encoder_specific_settings != NULL; | |
sprang_webrtc
2016/09/22 13:06:16
nit: nullptr
perkj_webrtc
2016/09/26 12:09:42
Done.
| |
199 ++num_encoder_reconfigurations_; | |
187 if (config.encoder_specific_settings != NULL) { | 200 if (config.encoder_specific_settings != NULL) { |
188 if (config_.encoder_settings.payload_name == "VP8") { | 201 if (config_.encoder_settings.payload_name == "VP8") { |
189 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( | 202 vpx_settings_.vp8 = *reinterpret_cast<const webrtc::VideoCodecVP8*>( |
190 config.encoder_specific_settings); | 203 config.encoder_specific_settings); |
191 if (!config.streams.empty()) { | 204 if (!video_streams_.empty()) { |
192 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 205 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
193 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 206 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
194 } | 207 } |
195 } else if (config_.encoder_settings.payload_name == "VP9") { | 208 } else if (config_.encoder_settings.payload_name == "VP9") { |
196 vpx_settings_.vp9 = *reinterpret_cast<const webrtc::VideoCodecVP9*>( | 209 vpx_settings_.vp9 = *reinterpret_cast<const webrtc::VideoCodecVP9*>( |
197 config.encoder_specific_settings); | 210 config.encoder_specific_settings); |
198 if (!config.streams.empty()) { | 211 if (!video_streams_.empty()) { |
199 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( | 212 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( |
200 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 213 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
201 } | 214 } |
202 } else { | 215 } else { |
203 ADD_FAILURE() << "Unsupported encoder payload: " | 216 ADD_FAILURE() << "Unsupported encoder payload: " |
204 << config_.encoder_settings.payload_name; | 217 << config_.encoder_settings.payload_name; |
205 } | 218 } |
206 } | 219 } |
207 encoder_config_ = std::move(config); | |
208 codec_settings_set_ = config.encoder_specific_settings != NULL; | |
209 ++num_encoder_reconfigurations_; | |
210 } | 220 } |
211 | 221 |
212 void FakeVideoSendStream::Start() { | 222 void FakeVideoSendStream::Start() { |
213 sending_ = true; | 223 sending_ = true; |
214 } | 224 } |
215 | 225 |
216 void FakeVideoSendStream::Stop() { | 226 void FakeVideoSendStream::Stop() { |
217 sending_ = false; | 227 sending_ = false; |
218 } | 228 } |
219 | 229 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 } | 501 } |
492 | 502 |
493 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 503 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
494 int64_t max_size_bytes) { | 504 int64_t max_size_bytes) { |
495 return false; | 505 return false; |
496 } | 506 } |
497 | 507 |
498 void FakeCall::StopEventLog() {} | 508 void FakeCall::StopEventLog() {} |
499 | 509 |
500 } // namespace cricket | 510 } // namespace cricket |
OLD | NEW |