Chromium Code Reviews| 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 | 110 webrtc::VideoFrameBuffer::Rotate(video_frame.video_frame_buffer(), |
| 111 if (!SetSize(frame->width(), frame->height())) { | 111 video_frame.rotation()), |
|
magjed_webrtc
2016/08/26 12:04:15
Don't we need this SetSize call anymore? It looks
nisse-webrtc
2016/08/26 12:31:40
Good catch, that was not an intended change.
(And
| |
| 112 return false; | 112 webrtc::kVideoRotation_0, |
| 113 } | 113 video_frame.timestamp_us()); |
| 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 static_cast<size_t>(frame->width()) * | 119 static_cast<size_t>(frame.width()) * |
| 120 frame->height() * 4, | 120 frame.height() * 4, |
| 121 frame->width() * 4); | 121 frame.width() * 4); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Trigger a repaint event for the whole window. | 124 // Trigger a repaint event for the whole window. |
| 125 Rect bounds; | 125 Rect bounds; |
| 126 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); | 126 InvalWindowRect(window_ref_, GetWindowPortBounds(window_ref_, &bounds)); |
| 127 return true; | 127 return true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool CarbonVideoRenderer::Initialize() { | 130 bool CarbonVideoRenderer::Initialize() { |
| 131 OSStatus err; | 131 OSStatus err; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 161 if (err != noErr) { | 161 if (err != noErr) { |
| 162 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; | 162 LOG(LS_ERROR) << "Failed to install event handler, error code: " << err; |
| 163 return false; | 163 return false; |
| 164 } | 164 } |
| 165 SelectWindow(window_ref_); | 165 SelectWindow(window_ref_); |
| 166 ShowWindow(window_ref_); | 166 ShowWindow(window_ref_); |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace cricket | 170 } // namespace cricket |
| OLD | NEW |