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

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

Issue 2287233002: Delete cricket::VideoFrame::ConvertToRgbBuffer. (Closed)
Patch Set: Replace calls to ConvertFromI420 with more specific libyuv conversion. 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 CarbonVideoRenderer 11 // Implementation of CarbonVideoRenderer
12 12
13 #include "webrtc/media/devices/carbonvideorenderer.h" 13 #include "webrtc/media/devices/carbonvideorenderer.h"
14 14
15 #include "libyuv/convert_from.h"
15 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
16 #include "webrtc/media/base/videocommon.h" 17 #include "webrtc/media/base/videocommon.h"
17 #include "webrtc/media/base/videoframe.h" 18 #include "webrtc/media/base/videoframe.h"
18 19
19 namespace cricket { 20 namespace cricket {
20 21
21 CarbonVideoRenderer::CarbonVideoRenderer(int x, int y) 22 CarbonVideoRenderer::CarbonVideoRenderer(int x, int y)
22 : image_width_(0), 23 : image_width_(0),
23 image_height_(0), 24 image_height_(0),
24 x_(x), 25 x_(x),
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void CarbonVideoRenderer::OnFrame(const VideoFrame& video_frame) { 108 void CarbonVideoRenderer::OnFrame(const VideoFrame& video_frame) {
108 { 109 {
109 const VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); 110 const VideoFrame* frame = video_frame->GetCopyWithRotationApplied();
110 111
111 if (!SetSize(frame->width(), frame->height())) { 112 if (!SetSize(frame->width(), frame->height())) {
112 return false; 113 return false;
113 } 114 }
114 115
115 // Grab the image lock so we are not trashing up the image being drawn. 116 // Grab the image lock so we are not trashing up the image being drawn.
116 rtc::CritScope cs(&image_crit_); 117 rtc::CritScope cs(&image_crit_);
117 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, 118 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer(
118 image_.get(), 119 video_frame->video_frame_buffer());
119 static_cast<size_t>(frame->width()) * 120 libyuv::I420ToABGR(buffer->DataY(), buffer->StrideY(),
120 frame->height() * 4, 121 buffer->DataU(), buffer->StrideU(),
121 frame->width() * 4); 122 buffer->DataV(), buffer->StrideV(),
123 image_.get(), frame->width() * 4,
124 buffer->width(), buffer->height());
122 } 125 }
123 126
124 // Trigger a repaint event for the whole window. 127 // Trigger a repaint event for the whole window.
125 Rect bounds; 128 Rect bounds;
126 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); 129 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds));
127 return true; 130 return true;
128 } 131 }
129 132
130 bool CarbonVideoRenderer::Initialize() { 133 bool CarbonVideoRenderer::Initialize() {
131 OSStatus err; 134 OSStatus err;
(...skipping 29 matching lines...) Expand all
161 if (err != noErr) { 164 if (err != noErr) {
162 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; 165 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err;
163 return false; 166 return false;
164 } 167 }
165 SelectWindow(window_ref_); 168 SelectWindow(window_ref_);
166 ShowWindow(window_ref_); 169 ShowWindow(window_ref_);
167 return true; 170 return true;
168 } 171 }
169 172
170 } // namespace cricket 173 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698