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

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

Issue 2541863002: Delete VideoFrame default constructor, and IsZeroSize method. (Closed)
Patch Set: Initialize pixel data in VideoBroadcasterTest.OnFrame test. Created 4 years 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 *settings = vpx_settings_.vp9; 155 *settings = vpx_settings_.vp9;
156 return true; 156 return true;
157 } 157 }
158 158
159 int FakeVideoSendStream::GetNumberOfSwappedFrames() const { 159 int FakeVideoSendStream::GetNumberOfSwappedFrames() const {
160 return num_swapped_frames_; 160 return num_swapped_frames_;
161 } 161 }
162 162
163 int FakeVideoSendStream::GetLastWidth() const { 163 int FakeVideoSendStream::GetLastWidth() const {
164 return last_frame_.width(); 164 return last_frame_->width();
165 } 165 }
166 166
167 int FakeVideoSendStream::GetLastHeight() const { 167 int FakeVideoSendStream::GetLastHeight() const {
168 return last_frame_.height(); 168 return last_frame_->height();
169 } 169 }
170 170
171 int64_t FakeVideoSendStream::GetLastTimestamp() const { 171 int64_t FakeVideoSendStream::GetLastTimestamp() const {
172 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); 172 RTC_DCHECK(last_frame_->ntp_time_ms() == 0);
173 return last_frame_.render_time_ms(); 173 return last_frame_->render_time_ms();
174 } 174 }
175 175
176 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { 176 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) {
177 ++num_swapped_frames_; 177 ++num_swapped_frames_;
178 if (frame.width() != last_frame_.width() || 178 if (!last_frame_ ||
179 frame.height() != last_frame_.height() || 179 frame.width() != last_frame_->width() ||
180 frame.rotation() != last_frame_.rotation()) { 180 frame.height() != last_frame_->height() ||
181 frame.rotation() != last_frame_->rotation()) {
181 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( 182 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams(
182 frame.width(), frame.height(), encoder_config_); 183 frame.width(), frame.height(), encoder_config_);
183 } 184 }
184 last_frame_ = frame; 185 last_frame_ = rtc::Optional<webrtc::VideoFrame>(frame);
185 } 186 }
186 187
187 void FakeVideoSendStream::SetStats( 188 void FakeVideoSendStream::SetStats(
188 const webrtc::VideoSendStream::Stats& stats) { 189 const webrtc::VideoSendStream::Stats& stats) {
189 stats_ = stats; 190 stats_ = stats;
190 } 191 }
191 192
192 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { 193 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() {
193 return stats_; 194 return stats_;
194 } 195 }
195 196
196 void FakeVideoSendStream::EnableEncodedFrameRecording( 197 void FakeVideoSendStream::EnableEncodedFrameRecording(
197 const std::vector<rtc::PlatformFile>& files, 198 const std::vector<rtc::PlatformFile>& files,
198 size_t byte_limit) { 199 size_t byte_limit) {
199 for (rtc::PlatformFile file : files) 200 for (rtc::PlatformFile file : files)
200 rtc::ClosePlatformFile(file); 201 rtc::ClosePlatformFile(file);
201 } 202 }
202 203
203 void FakeVideoSendStream::ReconfigureVideoEncoder( 204 void FakeVideoSendStream::ReconfigureVideoEncoder(
204 webrtc::VideoEncoderConfig config) { 205 webrtc::VideoEncoderConfig config) {
206 int width, height;
207 if (last_frame_) {
208 width = last_frame_->width();
209 height = last_frame_->height();
210 } else {
211 width = height = 0;
212 }
205 video_streams_ = config.video_stream_factory->CreateEncoderStreams( 213 video_streams_ = config.video_stream_factory->CreateEncoderStreams(
206 last_frame_.width(), last_frame_.height(), config); 214 width, height, config);
207 if (config.encoder_specific_settings != NULL) { 215 if (config.encoder_specific_settings != NULL) {
208 if (config_.encoder_settings.payload_name == "VP8") { 216 if (config_.encoder_settings.payload_name == "VP8") {
209 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); 217 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8);
210 if (!video_streams_.empty()) { 218 if (!video_streams_.empty()) {
211 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( 219 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>(
212 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); 220 video_streams_.back().temporal_layer_thresholds_bps.size() + 1);
213 } 221 }
214 } else if (config_.encoder_settings.payload_name == "VP9") { 222 } else if (config_.encoder_settings.payload_name == "VP9") {
215 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); 223 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9);
216 if (!video_streams_.empty()) { 224 if (!video_streams_.empty()) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 } 590 }
583 591
584 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 592 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
585 last_sent_packet_ = sent_packet; 593 last_sent_packet_ = sent_packet;
586 if (sent_packet.packet_id >= 0) { 594 if (sent_packet.packet_id >= 0) {
587 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 595 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
588 } 596 }
589 } 597 }
590 598
591 } // namespace cricket 599 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698