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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 118 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
119 return config_; | 119 return config_; |
120 } | 120 } |
121 | 121 |
122 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() | 122 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() |
123 const { | 123 const { |
124 return encoder_config_; | 124 return encoder_config_; |
125 } | 125 } |
126 | 126 |
127 const std::vector<webrtc::VideoStream>& FakeVideoSendStream::GetVideoStreams() | 127 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
128 const { | 128 return encoder_config_.streams; |
129 return video_streams_; | |
130 } | 129 } |
131 | 130 |
132 bool FakeVideoSendStream::IsSending() const { | 131 bool FakeVideoSendStream::IsSending() const { |
133 return sending_; | 132 return sending_; |
134 } | 133 } |
135 | 134 |
136 bool FakeVideoSendStream::GetVp8Settings( | 135 bool FakeVideoSendStream::GetVp8Settings( |
137 webrtc::VideoCodecVP8* settings) const { | 136 webrtc::VideoCodecVP8* settings) const { |
138 if (!codec_settings_set_) { | 137 if (!codec_settings_set_) { |
139 return false; | 138 return false; |
(...skipping 25 matching lines...) Expand all Loading... |
165 return last_frame_.height(); | 164 return last_frame_.height(); |
166 } | 165 } |
167 | 166 |
168 int64_t FakeVideoSendStream::GetLastTimestamp() const { | 167 int64_t FakeVideoSendStream::GetLastTimestamp() const { |
169 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); | 168 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); |
170 return last_frame_.render_time_ms(); | 169 return last_frame_.render_time_ms(); |
171 } | 170 } |
172 | 171 |
173 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { | 172 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { |
174 ++num_swapped_frames_; | 173 ++num_swapped_frames_; |
175 if (frame.width() != last_frame_.width() || | |
176 frame.height() != last_frame_.height() || | |
177 frame.rotation() != last_frame_.rotation()) { | |
178 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( | |
179 frame.width(), frame.height(), encoder_config_); | |
180 } | |
181 last_frame_.ShallowCopy(frame); | 174 last_frame_.ShallowCopy(frame); |
182 } | 175 } |
183 | 176 |
184 void FakeVideoSendStream::SetStats( | 177 void FakeVideoSendStream::SetStats( |
185 const webrtc::VideoSendStream::Stats& stats) { | 178 const webrtc::VideoSendStream::Stats& stats) { |
186 stats_ = stats; | 179 stats_ = stats; |
187 } | 180 } |
188 | 181 |
189 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 182 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
190 return stats_; | 183 return stats_; |
191 } | 184 } |
192 | 185 |
193 void FakeVideoSendStream::EnableEncodedFrameRecording( | 186 void FakeVideoSendStream::EnableEncodedFrameRecording( |
194 const std::vector<rtc::PlatformFile>& files, | 187 const std::vector<rtc::PlatformFile>& files, |
195 size_t byte_limit) { | 188 size_t byte_limit) { |
196 for (rtc::PlatformFile file : files) | 189 for (rtc::PlatformFile file : files) |
197 rtc::ClosePlatformFile(file); | 190 rtc::ClosePlatformFile(file); |
198 } | 191 } |
199 | 192 |
200 void FakeVideoSendStream::ReconfigureVideoEncoder( | 193 void FakeVideoSendStream::ReconfigureVideoEncoder( |
201 webrtc::VideoEncoderConfig config) { | 194 webrtc::VideoEncoderConfig config) { |
202 video_streams_ = config.video_stream_factory->CreateEncoderStreams( | |
203 last_frame_.width(), last_frame_.height(), config); | |
204 if (config.encoder_specific_settings != NULL) { | 195 if (config.encoder_specific_settings != NULL) { |
205 if (config_.encoder_settings.payload_name == "VP8") { | 196 if (config_.encoder_settings.payload_name == "VP8") { |
206 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 197 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
207 if (!video_streams_.empty()) { | 198 if (!config.streams.empty()) { |
208 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 199 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
209 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 200 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
210 } | 201 } |
211 } else if (config_.encoder_settings.payload_name == "VP9") { | 202 } else if (config_.encoder_settings.payload_name == "VP9") { |
212 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); | 203 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); |
213 if (!video_streams_.empty()) { | 204 if (!config.streams.empty()) { |
214 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( | 205 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( |
215 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 206 config.streams.back().temporal_layer_thresholds_bps.size() + 1); |
216 } | 207 } |
217 } else { | 208 } else { |
218 ADD_FAILURE() << "Unsupported encoder payload: " | 209 ADD_FAILURE() << "Unsupported encoder payload: " |
219 << config_.encoder_settings.payload_name; | 210 << config_.encoder_settings.payload_name; |
220 } | 211 } |
221 } | 212 } |
222 codec_settings_set_ = config.encoder_specific_settings != NULL; | 213 codec_settings_set_ = config.encoder_specific_settings != NULL; |
223 encoder_config_ = std::move(config); | 214 encoder_config_ = std::move(config); |
224 ++num_encoder_reconfigurations_; | 215 ++num_encoder_reconfigurations_; |
225 } | 216 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 502 } |
512 | 503 |
513 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 504 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
514 int64_t max_size_bytes) { | 505 int64_t max_size_bytes) { |
515 return false; | 506 return false; |
516 } | 507 } |
517 | 508 |
518 void FakeCall::StopEventLog() {} | 509 void FakeCall::StopEventLog() {} |
519 | 510 |
520 } // namespace cricket | 511 } // namespace cricket |
OLD | NEW |