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

Side by Side Diff: webrtc/media/base/videocapturer.cc

Issue 2906053002: Update I420Buffer to new VideoFrameBuffer interface (Closed)
Patch Set: Make const versions of Get functions Created 3 years, 6 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) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void VideoCapturer::OnFrame(const webrtc::VideoFrame& frame, 198 void VideoCapturer::OnFrame(const webrtc::VideoFrame& frame,
199 int orig_width, 199 int orig_width,
200 int orig_height) { 200 int orig_height) {
201 // For a child class which implements rotation itself, we should 201 // For a child class which implements rotation itself, we should
202 // always have apply_rotation_ == false or frame.rotation() == 0. 202 // always have apply_rotation_ == false or frame.rotation() == 0.
203 // Except possibly during races where apply_rotation_ is changed 203 // Except possibly during races where apply_rotation_ is changed
204 // mid-stream. 204 // mid-stream.
205 if (apply_rotation_ && frame.rotation() != webrtc::kVideoRotation_0) { 205 if (apply_rotation_ && frame.rotation() != webrtc::kVideoRotation_0) {
206 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( 206 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
207 frame.video_frame_buffer()); 207 frame.video_frame_buffer());
208 if (buffer->native_handle()) { 208 if (buffer->type() != webrtc::VideoFrameBuffer::Type::kI420) {
209 // Sources producing native frames must handle apply_rotation 209 // Sources producing non-I420 frames must handle apply_rotation
210 // themselves. But even if they do, we may occasionally end up 210 // themselves. But even if they do, we may occasionally end up
211 // in this case, for frames in flight at the time 211 // in this case, for frames in flight at the time
212 // applied_rotation is set to true. In that case, we just drop 212 // applied_rotation is set to true. In that case, we just drop
213 // the frame. 213 // the frame.
214 LOG(LS_WARNING) << "Native frame requiring rotation. Discarding."; 214 LOG(LS_WARNING) << "Non-I420 frame requiring rotation. Discarding.";
215 return; 215 return;
216 } 216 }
217 broadcaster_.OnFrame(webrtc::VideoFrame( 217 broadcaster_.OnFrame(webrtc::VideoFrame(
218 webrtc::I420Buffer::Rotate(*buffer, frame.rotation()), 218 webrtc::I420Buffer::Rotate(*buffer->GetI420(), frame.rotation()),
219 webrtc::kVideoRotation_0, frame.timestamp_us())); 219 webrtc::kVideoRotation_0, frame.timestamp_us()));
220 } else { 220 } else {
221 broadcaster_.OnFrame(frame); 221 broadcaster_.OnFrame(frame);
222 } 222 }
223 UpdateInputSize(orig_width, orig_height); 223 UpdateInputSize(orig_width, orig_height);
224 } 224 }
225 225
226 void VideoCapturer::SetCaptureState(CaptureState state) { 226 void VideoCapturer::SetCaptureState(CaptureState state) {
227 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 227 RTC_DCHECK(thread_checker_.CalledOnValidThread());
228 if (state == capture_state_) { 228 if (state == capture_state_) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 void VideoCapturer::UpdateInputSize(int width, int height) { 364 void VideoCapturer::UpdateInputSize(int width, int height) {
365 // Update stats protected from fetches from different thread. 365 // Update stats protected from fetches from different thread.
366 rtc::CritScope cs(&frame_stats_crit_); 366 rtc::CritScope cs(&frame_stats_crit_);
367 367
368 input_size_valid_ = true; 368 input_size_valid_ = true;
369 input_width_ = width; 369 input_width_ = width;
370 input_height_ = height; 370 input_height_ = height;
371 } 371 }
372 372
373 } // namespace cricket 373 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/adaptedvideotracksource.cc ('k') | webrtc/modules/video_coding/codecs/test/videoprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698