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

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

Issue 1819103003: Delete cricket::VideoRenderer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 9 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/gdivideorenderer.h ('k') | webrtc/media/devices/gtkvideorenderer.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) 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
(...skipping 12 matching lines...) Expand all
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);
31 virtual ~VideoWindow(); 31 virtual ~VideoWindow();
32 32
33 // Called when a new frame is available. Upon this call, we send
34 // kRenderFrameMsg to the window thread. Context: non-worker thread. It may be
35 // better to pass RGB bytes to VideoWindow. However, we pass VideoFrame to put
36 // all the thread synchronization within VideoWindow.
37 void OnFrame(const VideoFrame& frame);
38
39 protected:
40 // Override virtual method of rtc::Win32Window. Context: worker Thread.
41 bool OnMessage(UINT uMsg,
42 WPARAM wParam,
43 LPARAM lParam,
44 LRESULT& result) override;
45
46 private:
47 enum { kSetSizeMsg = WM_USER, kRenderFrameMsg};
48
33 // Called when the video size changes. If it is called the first time, we 49 // Called when the video size changes. If it is called the first time, we
34 // create and start the thread. Otherwise, we send kSetSizeMsg to the thread. 50 // create and start the thread. Otherwise, we send kSetSizeMsg to the thread.
35 // Context: non-worker thread. 51 // Context: non-worker thread.
36 bool SetSize(int width, int height); 52 bool SetSize(int width, int height);
37 53
38 // Called when a new frame is available. Upon this call, we send
39 // kRenderFrameMsg to the window thread. Context: non-worker thread. It may be
40 // better to pass RGB bytes to VideoWindow. However, we pass VideoFrame to put
41 // all the thread synchronization within VideoWindow.
42 bool RenderFrame(const VideoFrame* frame);
43
44 protected:
45 // Override virtual method of rtc::Win32Window. Context: worker Thread.
46 virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam,
47 LRESULT& result);
48
49 private:
50 enum { kSetSizeMsg = WM_USER, kRenderFrameMsg};
51
52 class WindowThread : public rtc::Thread { 54 class WindowThread : public rtc::Thread {
53 public: 55 public:
54 explicit WindowThread(VideoWindow* window) : window_(window) {} 56 explicit WindowThread(VideoWindow* window) : window_(window) {}
55 57
56 virtual ~WindowThread() { 58 virtual ~WindowThread() {
57 Stop(); 59 Stop();
58 } 60 }
59 61
60 // Override virtual method of rtc::Thread. Context: worker Thread. 62 // Override virtual method of rtc::Thread. Context: worker Thread.
61 virtual void Run() { 63 virtual void Run() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Create and start the window thread. 123 // Create and start the window thread.
122 window_thread_.reset(new WindowThread(this)); 124 window_thread_.reset(new WindowThread(this));
123 return window_thread_->Start(); 125 return window_thread_->Start();
124 } else if (width != bmi_.bmiHeader.biWidth || 126 } else if (width != bmi_.bmiHeader.biWidth ||
125 height != -bmi_.bmiHeader.biHeight) { 127 height != -bmi_.bmiHeader.biHeight) {
126 SendMessage(handle(), kSetSizeMsg, 0, MAKELPARAM(width, height)); 128 SendMessage(handle(), kSetSizeMsg, 0, MAKELPARAM(width, height));
127 } 129 }
128 return true; 130 return true;
129 } 131 }
130 132
131 bool GdiVideoRenderer::VideoWindow::RenderFrame(const VideoFrame* video_frame) { 133 void GdiVideoRenderer::VideoWindow::OnFrame(const VideoFrame& video_frame) {
132 if (!handle()) { 134 if (!handle()) {
133 return false; 135 return;
134 } 136 }
135 137
136 const VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); 138 const VideoFrame* frame = video_frame.GetCopyWithRotationApplied();
137 139
138 if (!SetSize(static_cast<int>(frame->GetWidth()), 140 if (SetSize(static_cast<int>(frame->GetWidth()),
139 static_cast<int>(frame->GetHeight()))) { 141 static_cast<int>(frame->GetHeight()))) {
140 return false; 142 SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(frame), 0);
141 } 143 }
142
143 SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(frame), 0);
144 return true;
145 } 144 }
146 145
147 bool GdiVideoRenderer::VideoWindow::OnMessage(UINT uMsg, WPARAM wParam, 146 bool GdiVideoRenderer::VideoWindow::OnMessage(UINT uMsg, WPARAM wParam,
148 LPARAM lParam, LRESULT& result) { 147 LPARAM lParam, LRESULT& result) {
149 switch (uMsg) { 148 switch (uMsg) {
150 case WM_PAINT: 149 case WM_PAINT:
151 OnPaint(); 150 OnPaint();
152 return true; 151 return true;
153 152
154 case WM_DESTROY: 153 case WM_DESTROY:
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 235
237 ///////////////////////////////////////////////////////////////////////////// 236 /////////////////////////////////////////////////////////////////////////////
238 // Implementation of class GdiVideoRenderer 237 // Implementation of class GdiVideoRenderer
239 ///////////////////////////////////////////////////////////////////////////// 238 /////////////////////////////////////////////////////////////////////////////
240 GdiVideoRenderer::GdiVideoRenderer(int x, int y) 239 GdiVideoRenderer::GdiVideoRenderer(int x, int y)
241 : initial_x_(x), 240 : initial_x_(x),
242 initial_y_(y) { 241 initial_y_(y) {
243 } 242 }
244 GdiVideoRenderer::~GdiVideoRenderer() {} 243 GdiVideoRenderer::~GdiVideoRenderer() {}
245 244
246 bool GdiVideoRenderer::SetSize(int width, int height, int reserved) { 245 void GdiVideoRenderer::OnFrame(const VideoFrame& frame) {
247 if (!window_.get()) { // Create the window for the first frame 246 if (!window_.get()) { // Create the window for the first frame
248 window_.reset(new VideoWindow(initial_x_, initial_y_, width, height)); 247 window_.reset(new VideoWindow(initial_x_, initial_y_,
248 static_cast<int>(frame.GetWidth()),
249 static_cast<int>(frame.GetHeight())));
249 } 250 }
250 return window_->SetSize(width, height); 251 window_->OnFrame(frame);
251 }
252
253 bool GdiVideoRenderer::RenderFrame(const VideoFrame* frame) {
254 if (!frame || !window_.get()) {
255 return false;
256 }
257 return window_->RenderFrame(frame);
258 } 252 }
259 253
260 } // namespace cricket 254 } // namespace cricket
261 #endif // WIN32 255 #endif // WIN32
OLDNEW
« no previous file with comments | « webrtc/media/devices/gdivideorenderer.h ('k') | webrtc/media/devices/gtkvideorenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698