OLD | NEW |
---|---|
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 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 void CarbonVideoRenderer::OnFrame(const VideoFrame& video_frame) { | 107 void CarbonVideoRenderer::OnFrame(const VideoFrame& video_frame) { |
108 { | 108 { |
109 const VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); | 109 const VideoFrame* frame = video_frame->GetCopyWithRotationApplied(); |
110 | 110 |
111 if (!SetSize(frame->width(), frame->height())) { | 111 if (!SetSize(frame->width(), frame->height())) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 // Grab the image lock so we are not trashing up the image being drawn. | 115 // Grab the image lock so we are not trashing up the image being drawn. |
116 rtc::CritScope cs(&image_crit_); | 116 rtc::CritScope cs(&image_crit_); |
117 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, | 117 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
118 image_.get(), | 118 video_frame->video_frame_buffer()); |
119 static_cast<size_t>(frame->width()) * | 119 libyuv::ConvertFromI420(buffer->DataY(), buffer->StrideY(), |
120 frame->height() * 4, | 120 buffer->DataU(), buffer->StrideU(), |
121 frame->width() * 4); | 121 buffer->DataV(), buffer->StrideV(), |
122 image_.get(), frame->width() * 4, | |
123 buffer->width(), buffer->height(), | |
124 cricket::FOURCC_ABGR); | |
perkj_webrtc
2016/08/30 07:13:39
should use a libyuv type, not cricket.
| |
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 Loading... | |
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 |
OLD | NEW |