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

Side by Side Diff: webrtc/media/base/adaptedvideotracksource.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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 #include "webrtc/media/base/adaptedvideotracksource.h" 11 #include "webrtc/media/base/adaptedvideotracksource.h"
12 12
13 #include "webrtc/api/video/i420_buffer.h"
14
13 namespace rtc { 15 namespace rtc {
14 16
15 AdaptedVideoTrackSource::AdaptedVideoTrackSource() { 17 AdaptedVideoTrackSource::AdaptedVideoTrackSource() {
16 thread_checker_.DetachFromThread(); 18 thread_checker_.DetachFromThread();
17 } 19 }
18 20
19 AdaptedVideoTrackSource::AdaptedVideoTrackSource(int required_alignment) 21 AdaptedVideoTrackSource::AdaptedVideoTrackSource(int required_alignment)
20 : video_adapter_(required_alignment) { 22 : video_adapter_(required_alignment) {
21 thread_checker_.DetachFromThread(); 23 thread_checker_.DetachFromThread();
22 } 24 }
(...skipping 18 matching lines...) Expand all
41 broadcaster_.OnFrame(), in which case we generate a frame with 43 broadcaster_.OnFrame(), in which case we generate a frame with
42 pending rotation despite some sink with wants.rotation_applied == 44 pending rotation despite some sink with wants.rotation_applied ==
43 true was just added. The VideoBroadcaster enforces 45 true was just added. The VideoBroadcaster enforces
44 synchronization for us in this case, by not passing the frame on 46 synchronization for us in this case, by not passing the frame on
45 to sinks which don't want it. */ 47 to sinks which don't want it. */
46 if (apply_rotation() && 48 if (apply_rotation() &&
47 frame.rotation() != webrtc::kVideoRotation_0 && 49 frame.rotation() != webrtc::kVideoRotation_0 &&
48 !buffer->native_handle()) { 50 !buffer->native_handle()) {
49 /* Apply pending rotation. */ 51 /* Apply pending rotation. */
50 broadcaster_.OnFrame(webrtc::VideoFrame( 52 broadcaster_.OnFrame(webrtc::VideoFrame(
51 webrtc::I420Buffer::Rotate(buffer, frame.rotation()), 53 webrtc::I420Buffer::Rotate(*buffer, frame.rotation()),
52 webrtc::kVideoRotation_0, frame.timestamp_us())); 54 webrtc::kVideoRotation_0, frame.timestamp_us()));
53 } else { 55 } else {
54 broadcaster_.OnFrame(frame); 56 broadcaster_.OnFrame(frame);
55 } 57 }
56 } 58 }
57 59
58 void AdaptedVideoTrackSource::AddOrUpdateSink( 60 void AdaptedVideoTrackSource::AddOrUpdateSink(
59 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, 61 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
60 const rtc::VideoSinkWants& wants) { 62 const rtc::VideoSinkWants& wants) {
61 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 63 RTC_DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // VideoAdapter dropped the frame. 109 // VideoAdapter dropped the frame.
108 return false; 110 return false;
109 } 111 }
110 112
111 *crop_x = (width - *crop_width) / 2; 113 *crop_x = (width - *crop_width) / 2;
112 *crop_y = (height - *crop_height) / 2; 114 *crop_y = (height - *crop_height) / 2;
113 return true; 115 return true;
114 } 116 }
115 117
116 } // namespace rtc 118 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/examples/peerconnection/client/main_wnd.cc ('k') | webrtc/media/base/fakevideocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698