Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: webrtc/media/engine/fakewebrtccall.cc

Issue 2351633002: Let ViEEncoder handle resolution changes. (Closed)
Patch Set: Fix build on Win Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_ = encoder_config_.video_stream_factory->CreateEncoderStreams(
178 frame.width(), frame.height(), encoder_config_);
179 }
173 last_frame_.ShallowCopy(frame); 180 last_frame_.ShallowCopy(frame);
174 } 181 }
175 182
176 void FakeVideoSendStream::SetStats( 183 void FakeVideoSendStream::SetStats(
177 const webrtc::VideoSendStream::Stats& stats) { 184 const webrtc::VideoSendStream::Stats& stats) {
178 stats_ = stats; 185 stats_ = stats;
179 } 186 }
180 187
181 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { 188 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() {
182 return stats_; 189 return stats_;
183 } 190 }
184 191
185 void FakeVideoSendStream::ReconfigureVideoEncoder( 192 void FakeVideoSendStream::ReconfigureVideoEncoder(
186 webrtc::VideoEncoderConfig config) { 193 webrtc::VideoEncoderConfig config) {
194 video_streams_ = config.video_stream_factory->CreateEncoderStreams(
195 last_frame_.width(), last_frame_.height(), config);
187 if (config.encoder_specific_settings != NULL) { 196 if (config.encoder_specific_settings != NULL) {
188 if (config_.encoder_settings.payload_name == "VP8") { 197 if (config_.encoder_settings.payload_name == "VP8") {
189 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); 198 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8);
190 if (!config.streams.empty()) { 199 if (!video_streams_.empty()) {
191 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( 200 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>(
192 config.streams.back().temporal_layer_thresholds_bps.size() + 1); 201 video_streams_.back().temporal_layer_thresholds_bps.size() + 1);
193 } 202 }
194 } else if (config_.encoder_settings.payload_name == "VP9") { 203 } else if (config_.encoder_settings.payload_name == "VP9") {
195 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); 204 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9);
196 if (!config.streams.empty()) { 205 if (!video_streams_.empty()) {
197 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( 206 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>(
198 config.streams.back().temporal_layer_thresholds_bps.size() + 1); 207 video_streams_.back().temporal_layer_thresholds_bps.size() + 1);
199 } 208 }
200 } else { 209 } else {
201 ADD_FAILURE() << "Unsupported encoder payload: " 210 ADD_FAILURE() << "Unsupported encoder payload: "
202 << config_.encoder_settings.payload_name; 211 << config_.encoder_settings.payload_name;
203 } 212 }
204 } 213 }
205 codec_settings_set_ = config.encoder_specific_settings != NULL; 214 codec_settings_set_ = config.encoder_specific_settings != NULL;
206 encoder_config_ = std::move(config); 215 encoder_config_ = std::move(config);
207 ++num_encoder_reconfigurations_; 216 ++num_encoder_reconfigurations_;
208 } 217 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 498 }
490 499
491 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, 500 bool FakeCall::StartEventLog(rtc::PlatformFile log_file,
492 int64_t max_size_bytes) { 501 int64_t max_size_bytes) {
493 return false; 502 return false;
494 } 503 }
495 504
496 void FakeCall::StopEventLog() {} 505 void FakeCall::StopEventLog() {}
497 506
498 } // namespace cricket 507 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698