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

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

Issue 2517173004: Move VideoFrame and related declarations to webrtc/api/video. (Closed)
Patch Set: Make rotation check clearer. Created 3 years, 11 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
« no previous file with comments | « webrtc/media/base/videocapturer.h ('k') | webrtc/media/base/videoframe.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 // Implementation file of class VideoCapturer. 11 // Implementation file of class VideoCapturer.
12 12
13 #include "webrtc/media/base/videocapturer.h" 13 #include "webrtc/media/base/videocapturer.h"
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "webrtc/api/video/i420_buffer.h"
18 #include "webrtc/api/video/video_frame.h"
17 #include "webrtc/base/common.h" 19 #include "webrtc/base/common.h"
18 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
19 #include "webrtc/video_frame.h"
20 21
21 namespace cricket { 22 namespace cricket {
22 23
23 namespace { 24 namespace {
24 25
25 static const int64_t kMaxDistance = ~(static_cast<int64_t>(1) << 63); 26 static const int64_t kMaxDistance = ~(static_cast<int64_t>(1) << 63);
26 #ifdef WEBRTC_LINUX 27 #ifdef WEBRTC_LINUX
27 static const int kYU12Penalty = 16; // Needs to be higher than MJPG index. 28 static const int kYU12Penalty = 16; // Needs to be higher than MJPG index.
28 #endif 29 #endif
29 30
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (buffer->native_handle()) { 208 if (buffer->native_handle()) {
208 // Sources producing native frames must handle apply_rotation 209 // Sources producing native frames must handle apply_rotation
209 // themselves. But even if they do, we may occasionally end up 210 // themselves. But even if they do, we may occasionally end up
210 // in this case, for frames in flight at the time 211 // in this case, for frames in flight at the time
211 // 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
212 // the frame. 213 // the frame.
213 LOG(LS_WARNING) << "Native frame requiring rotation. Discarding."; 214 LOG(LS_WARNING) << "Native frame requiring rotation. Discarding.";
214 return; 215 return;
215 } 216 }
216 broadcaster_.OnFrame(webrtc::VideoFrame( 217 broadcaster_.OnFrame(webrtc::VideoFrame(
217 webrtc::I420Buffer::Rotate(buffer, frame.rotation()), 218 webrtc::I420Buffer::Rotate(*buffer, frame.rotation()),
218 webrtc::kVideoRotation_0, frame.timestamp_us())); 219 webrtc::kVideoRotation_0, frame.timestamp_us()));
219 } else { 220 } else {
220 broadcaster_.OnFrame(frame); 221 broadcaster_.OnFrame(frame);
221 } 222 }
222 UpdateInputSize(orig_width, orig_height); 223 UpdateInputSize(orig_width, orig_height);
223 } 224 }
224 225
225 void VideoCapturer::SetCaptureState(CaptureState state) { 226 void VideoCapturer::SetCaptureState(CaptureState state) {
226 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 227 RTC_DCHECK(thread_checker_.CalledOnValidThread());
227 if (state == capture_state_) { 228 if (state == capture_state_) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 void VideoCapturer::UpdateInputSize(int width, int height) { 364 void VideoCapturer::UpdateInputSize(int width, int height) {
364 // Update stats protected from fetches from different thread. 365 // Update stats protected from fetches from different thread.
365 rtc::CritScope cs(&frame_stats_crit_); 366 rtc::CritScope cs(&frame_stats_crit_);
366 367
367 input_size_valid_ = true; 368 input_size_valid_ = true;
368 input_width_ = width; 369 input_width_ = width;
369 input_height_ = height; 370 input_height_ = height;
370 } 371 }
371 372
372 } // namespace cricket 373 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/videocapturer.h ('k') | webrtc/media/base/videoframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698