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

Side by Side Diff: webrtc/media/devices/gdivideorenderer.cc

Issue 2285693002: New static I420Buffer::Rotate method, to replace GetCopyWithRotationApplied. (Closed)
Patch Set: Change back to static method, now in I420Buffer. Created 4 years, 3 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/devices/carbonvideorenderer.cc ('k') | webrtc/media/devices/gtkvideorenderer.cc » ('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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 of GdiVideoRenderer on Windows 11 // Implementation of GdiVideoRenderer on Windows
12 12
13 #ifdef WIN32 13 #ifdef WIN32
14 14
15 #include "webrtc/media/devices/gdivideorenderer.h" 15 #include "webrtc/media/devices/gdivideorenderer.h"
16 16
17 #include "webrtc/base/thread.h" 17 #include "webrtc/base/thread.h"
18 #include "webrtc/base/win32window.h" 18 #include "webrtc/base/win32window.h"
19 #include "webrtc/media/base/videocommon.h" 19 #include "webrtc/media/base/videocommon.h"
20 #include "webrtc/media/base/videoframe.h" 20 #include "webrtc/media/engine/webrtcvideoframe.h"
21 21
22 namespace cricket { 22 namespace cricket {
23 23
24 ///////////////////////////////////////////////////////////////////////////// 24 /////////////////////////////////////////////////////////////////////////////
25 // Definition of private class VideoWindow. We use a worker thread to manage 25 // Definition of private class VideoWindow. We use a worker thread to manage
26 // the window. 26 // the window.
27 ///////////////////////////////////////////////////////////////////////////// 27 /////////////////////////////////////////////////////////////////////////////
28 class GdiVideoRenderer::VideoWindow : public rtc::Win32Window { 28 class GdiVideoRenderer::VideoWindow : public rtc::Win32Window {
29 public: 29 public:
30 VideoWindow(int x, int y, int width, int height); 30 VideoWindow(int x, int y, int width, int height);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SendMessage(handle(), kSetSizeMsg, 0, MAKELPARAM(width, height)); 128 SendMessage(handle(), kSetSizeMsg, 0, MAKELPARAM(width, height));
129 } 129 }
130 return true; 130 return true;
131 } 131 }
132 132
133 void GdiVideoRenderer::VideoWindow::OnFrame(const VideoFrame& video_frame) { 133 void GdiVideoRenderer::VideoWindow::OnFrame(const VideoFrame& video_frame) {
134 if (!handle()) { 134 if (!handle()) {
135 return; 135 return;
136 } 136 }
137 137
138 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied(); 138 const cricket::WebRtcVideoFrame frame(
139 webrtc::I420Buffer::Rotate(video_frame.video_frame_buffer(),
140 video_frame.rotation()),
141 webrtc::kVideoRotation_0, video_frame.timestamp_us());
139 142
140 if (SetSize(frame->width(), frame->height())) { 143 if (SetSize(frame.width(), frame.height())) {
141 SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(frame), 0); 144 SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(&frame), 0);
142 } 145 }
143 } 146 }
144 147
145 bool GdiVideoRenderer::VideoWindow::OnMessage(UINT uMsg, WPARAM wParam, 148 bool GdiVideoRenderer::VideoWindow::OnMessage(UINT uMsg, WPARAM wParam,
146 LPARAM lParam, LRESULT& result) { 149 LPARAM lParam, LRESULT& result) {
147 switch (uMsg) { 150 switch (uMsg) {
148 case WM_PAINT: 151 case WM_PAINT:
149 OnPaint(); 152 OnPaint();
150 return true; 153 return true;
151 154
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 void GdiVideoRenderer::OnFrame(const VideoFrame& frame) { 247 void GdiVideoRenderer::OnFrame(const VideoFrame& frame) {
245 if (!window_.get()) { // Create the window for the first frame 248 if (!window_.get()) { // Create the window for the first frame
246 window_.reset( 249 window_.reset(
247 new VideoWindow(initial_x_, initial_y_, frame.width(), frame.height())); 250 new VideoWindow(initial_x_, initial_y_, frame.width(), frame.height()));
248 } 251 }
249 window_->OnFrame(frame); 252 window_->OnFrame(frame);
250 } 253 }
251 254
252 } // namespace cricket 255 } // namespace cricket
253 #endif // WIN32 256 #endif // WIN32
OLDNEW
« no previous file with comments | « webrtc/media/devices/carbonvideorenderer.cc ('k') | webrtc/media/devices/gtkvideorenderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698