Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 bmi_.bmiHeader.biSizeImage = width * height * 4; | 219 bmi_.bmiHeader.biSizeImage = width * height * 4; |
| 220 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); | 220 image_.reset(new uint8_t[bmi_.bmiHeader.biSizeImage]); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void GdiVideoRenderer::VideoWindow::OnRenderFrame(const VideoFrame* frame) { | 224 void GdiVideoRenderer::VideoWindow::OnRenderFrame(const VideoFrame* frame) { |
| 225 if (!frame) { | 225 if (!frame) { |
| 226 return; | 226 return; |
| 227 } | 227 } |
| 228 // Convert frame to ARGB format, which is accepted by GDI | 228 // Convert frame to ARGB format, which is accepted by GDI |
| 229 frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB, image_.get(), | 229 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
| 230 bmi_.bmiHeader.biSizeImage, | 230 frame->video_frame_buffer()); |
| 231 bmi_.bmiHeader.biWidth * 4); | 231 libyuv::ConvertFromI420(buffer->DataY(), buffer->StrideY(), |
| 232 buffer->DataU(), buffer->StrideU(), | |
| 233 buffer->DataV(), buffer->StrideV(), | |
| 234 image_.get(), bmi_.bmiHeader.biWidth * 4, | |
| 235 buffer->width(), buffer->height(), | |
| 236 cricket::FOURCC_ARGB); | |
|
perkj_webrtc
2016/08/30 07:13:39
libuyv type- not cricket.
| |
| 232 InvalidateRect(handle(), 0, 0); | 237 InvalidateRect(handle(), 0, 0); |
| 233 } | 238 } |
| 234 | 239 |
| 235 ///////////////////////////////////////////////////////////////////////////// | 240 ///////////////////////////////////////////////////////////////////////////// |
| 236 // Implementation of class GdiVideoRenderer | 241 // Implementation of class GdiVideoRenderer |
| 237 ///////////////////////////////////////////////////////////////////////////// | 242 ///////////////////////////////////////////////////////////////////////////// |
| 238 GdiVideoRenderer::GdiVideoRenderer(int x, int y) | 243 GdiVideoRenderer::GdiVideoRenderer(int x, int y) |
| 239 : initial_x_(x), | 244 : initial_x_(x), |
| 240 initial_y_(y) { | 245 initial_y_(y) { |
| 241 } | 246 } |
| 242 GdiVideoRenderer::~GdiVideoRenderer() {} | 247 GdiVideoRenderer::~GdiVideoRenderer() {} |
| 243 | 248 |
| 244 void GdiVideoRenderer::OnFrame(const VideoFrame& frame) { | 249 void GdiVideoRenderer::OnFrame(const VideoFrame& frame) { |
| 245 if (!window_.get()) { // Create the window for the first frame | 250 if (!window_.get()) { // Create the window for the first frame |
| 246 window_.reset( | 251 window_.reset( |
| 247 new VideoWindow(initial_x_, initial_y_, frame.width(), frame.height())); | 252 new VideoWindow(initial_x_, initial_y_, frame.width(), frame.height())); |
| 248 } | 253 } |
| 249 window_->OnFrame(frame); | 254 window_->OnFrame(frame); |
| 250 } | 255 } |
| 251 | 256 |
| 252 } // namespace cricket | 257 } // namespace cricket |
| 253 #endif // WIN32 | 258 #endif // WIN32 |
| OLD | NEW |