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

Side by Side Diff: webrtc/test/win/d3d_renderer.cc

Issue 1814763002: Cleanup of webrtc::VideoRenderer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use a more specific DEPS rule. 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include "webrtc/test/win/d3d_renderer.h" 10 #include "webrtc/test/win/d3d_renderer.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 }; 184 };
185 185
186 void* buf_data; 186 void* buf_data;
187 if (vertex_buffer_->Lock(0, 0, &buf_data, 0) != D3D_OK) 187 if (vertex_buffer_->Lock(0, 0, &buf_data, 0) != D3D_OK)
188 return; 188 return;
189 189
190 memcpy(buf_data, &rect, sizeof(rect)); 190 memcpy(buf_data, &rect, sizeof(rect));
191 vertex_buffer_->Unlock(); 191 vertex_buffer_->Unlock();
192 } 192 }
193 193
194 void D3dRenderer::RenderFrame(const webrtc::VideoFrame& frame, 194 void D3dRenderer::OnFrame(const webrtc::VideoFrame& frame) {
195 int /*render_delay_ms*/) {
196 if (static_cast<size_t>(frame.width()) != width_ || 195 if (static_cast<size_t>(frame.width()) != width_ ||
197 static_cast<size_t>(frame.height()) != height_) { 196 static_cast<size_t>(frame.height()) != height_) {
198 Resize(static_cast<size_t>(frame.width()), 197 Resize(static_cast<size_t>(frame.width()),
199 static_cast<size_t>(frame.height())); 198 static_cast<size_t>(frame.height()));
200 } 199 }
201 200
202 D3DLOCKED_RECT lock_rect; 201 D3DLOCKED_RECT lock_rect;
203 if (texture_->LockRect(0, &lock_rect, NULL, 0) != D3D_OK) 202 if (texture_->LockRect(0, &lock_rect, NULL, 0) != D3D_OK)
204 return; 203 return;
205 204
206 ConvertFromI420(frame, kARGB, 0, static_cast<uint8_t*>(lock_rect.pBits)); 205 ConvertFromI420(frame, kARGB, 0, static_cast<uint8_t*>(lock_rect.pBits));
207 texture_->UnlockRect(0); 206 texture_->UnlockRect(0);
208 207
209 d3d_device_->BeginScene(); 208 d3d_device_->BeginScene();
210 d3d_device_->SetFVF(D3DFVF_CUSTOMVERTEX); 209 d3d_device_->SetFVF(D3DFVF_CUSTOMVERTEX);
211 d3d_device_->SetStreamSource(0, vertex_buffer_, 0, sizeof(D3dCustomVertex)); 210 d3d_device_->SetStreamSource(0, vertex_buffer_, 0, sizeof(D3dCustomVertex));
212 d3d_device_->SetTexture(0, texture_); 211 d3d_device_->SetTexture(0, texture_);
213 d3d_device_->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); 212 d3d_device_->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
214 d3d_device_->EndScene(); 213 d3d_device_->EndScene();
215 214
216 d3d_device_->Present(NULL, NULL, NULL, NULL); 215 d3d_device_->Present(NULL, NULL, NULL, NULL);
217 } 216 }
218 } // namespace test 217 } // namespace test
219 } // namespace webrtc 218 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698