OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/pepper/pepper_video_source_host.h" | 5 #include "content/renderer/pepper/pepper_video_source_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "content/renderer/pepper/ppb_image_data_impl.h" | 10 #include "content/renderer/pepper/ppb_image_data_impl.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const int vert_crop = frame->visible_rect().y(); | 217 const int vert_crop = frame->visible_rect().y(); |
218 | 218 |
219 const uint8* src_y = frame->data(media::VideoFrame::kYPlane) + | 219 const uint8* src_y = frame->data(media::VideoFrame::kYPlane) + |
220 (src_width * vert_crop + horiz_crop); | 220 (src_width * vert_crop + horiz_crop); |
221 const int center = (src_width + 1) / 2; | 221 const int center = (src_width + 1) / 2; |
222 const uint8* src_u = frame->data(media::VideoFrame::kUPlane) + | 222 const uint8* src_u = frame->data(media::VideoFrame::kUPlane) + |
223 (center * vert_crop + horiz_crop) / 2; | 223 (center * vert_crop + horiz_crop) / 2; |
224 const uint8* src_v = frame->data(media::VideoFrame::kVPlane) + | 224 const uint8* src_v = frame->data(media::VideoFrame::kVPlane) + |
225 (center * vert_crop + horiz_crop) / 2; | 225 (center * vert_crop + horiz_crop) / 2; |
226 | 226 |
227 libyuv::I420ToBGRA(src_y, | 227 libyuv::I420ToARGB(src_y, |
228 frame->stride(media::VideoFrame::kYPlane), | 228 frame->stride(media::VideoFrame::kYPlane), |
229 src_u, | 229 src_u, |
230 frame->stride(media::VideoFrame::kUPlane), | 230 frame->stride(media::VideoFrame::kUPlane), |
231 src_v, | 231 src_v, |
232 frame->stride(media::VideoFrame::kVPlane), | 232 frame->stride(media::VideoFrame::kVPlane), |
233 bitmap_pixels, | 233 bitmap_pixels, |
234 bitmap->rowBytes(), | 234 bitmap->rowBytes(), |
235 dst_width, | 235 dst_width, |
236 dst_height); | 236 dst_height); |
237 | 237 |
(...skipping 27 matching lines...) Expand all Loading... |
265 if (source_handler_.get() && !stream_url_.empty()) | 265 if (source_handler_.get() && !stream_url_.empty()) |
266 source_handler_->Close(frame_receiver_.get()); | 266 source_handler_->Close(frame_receiver_.get()); |
267 | 267 |
268 source_handler_.reset(NULL); | 268 source_handler_.reset(NULL); |
269 stream_url_.clear(); | 269 stream_url_.clear(); |
270 | 270 |
271 shared_image_ = NULL; | 271 shared_image_ = NULL; |
272 } | 272 } |
273 | 273 |
274 } // namespace content | 274 } // namespace content |
OLD | NEW |