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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 image_width_ = width; | 99 image_width_ = width; |
100 image_height_ = height; | 100 image_height_ = height; |
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 cricket::WebRtcVideoFrame frame( |
| 110 webrtc::VideoFrameBuffer::Rotate(video_frame.video_frame_buffer(), |
| 111 video_frame.rotation()), |
| 112 webrtc::kVideoRotation_0, |
| 113 video_frame.timestamp_us()); |
110 | 114 |
111 if (!SetSize(frame->width(), frame->height())) { | 115 if (!SetSize(frame.width(), frame.height())) { |
112 return false; | 116 return false; |
113 } | 117 } |
114 | 118 |
115 // Grab the image lock so we are not trashing up the image being drawn. | 119 // Grab the image lock so we are not trashing up the image being drawn. |
116 rtc::CritScope cs(&image_crit_); | 120 rtc::CritScope cs(&image_crit_); |
117 frame->ConvertToRgbBuffer(cricket::FOURCC_ABGR, | 121 frame.ConvertToRgbBuffer(cricket::FOURCC_ABGR, |
118 image_.get(), | 122 image_.get(), |
119 static_cast<size_t>(frame->width()) * | 123 static_cast<size_t>(frame.width()) * |
120 frame->height() * 4, | 124 frame.height() * 4, |
121 frame->width() * 4); | 125 frame.width() * 4); |
122 } | 126 } |
123 | 127 |
124 // Trigger a repaint event for the whole window. | 128 // Trigger a repaint event for the whole window. |
125 Rect bounds; | 129 Rect bounds; |
126 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); | 130 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); |
127 return true; | 131 return true; |
128 } | 132 } |
129 | 133 |
130 bool CarbonVideoRenderer::Initialize() { | 134 bool CarbonVideoRenderer::Initialize() { |
131 OSStatus err; | 135 OSStatus err; |
(...skipping 29 matching lines...) Expand all Loading... |
161 if (err != noErr) { | 165 if (err != noErr) { |
162 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; | 166 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; |
163 return false; | 167 return false; |
164 } | 168 } |
165 SelectWindow(window_ref_); | 169 SelectWindow(window_ref_); |
166 ShowWindow(window_ref_); | 170 ShowWindow(window_ref_); |
167 return true; | 171 return true; |
168 } | 172 } |
169 | 173 |
170 } // namespace cricket | 174 } // namespace cricket |
OLD | NEW |