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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 image_.reset(new uint8_t[width * height * 4]); | 101 image_.reset(new uint8_t[width * height * 4]); |
102 memset(image_.get(), 255, width * height * 4); | 102 memset(image_.get(), 255, width * height * 4); |
103 } | 103 } |
104 return true; | 104 return true; |
105 } | 105 } |
106 | 106 |
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->GetWidth(), frame->GetHeight(), 0)) { | 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 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, |
118 image_.get(), | 118 image_.get(), |
119 frame->GetWidth() * frame->GetHeight() * 4, | 119 static_cast<size_t>(frame->width()) * |
120 frame->GetWidth() * 4); | 120 frame->height() * 4, |
| 121 frame->width() * 4); |
121 } | 122 } |
122 | 123 |
123 // Trigger a repaint event for the whole window. | 124 // Trigger a repaint event for the whole window. |
124 Rect bounds; | 125 Rect bounds; |
125 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); | 126 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); |
126 return true; | 127 return true; |
127 } | 128 } |
128 | 129 |
129 bool CarbonVideoRenderer::Initialize() { | 130 bool CarbonVideoRenderer::Initialize() { |
130 OSStatus err; | 131 OSStatus err; |
(...skipping 29 matching lines...) Expand all Loading... |
160 if (err != noErr) { | 161 if (err != noErr) { |
161 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; | 162 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; |
162 return false; | 163 return false; |
163 } | 164 } |
164 SelectWindow(window_ref_); | 165 SelectWindow(window_ref_); |
165 ShowWindow(window_ref_); | 166 ShowWindow(window_ref_); |
166 return true; | 167 return true; |
167 } | 168 } |
168 | 169 |
169 } // namespace cricket | 170 } // namespace cricket |
OLD | NEW |