| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scaled_frame_->stride(media::VideoFrame::kUPlane), | 240 scaled_frame_->stride(media::VideoFrame::kUPlane), |
| 241 scaled_frame_->data(media::VideoFrame::kVPlane), | 241 scaled_frame_->data(media::VideoFrame::kVPlane), |
| 242 scaled_frame_->stride(media::VideoFrame::kVPlane), | 242 scaled_frame_->stride(media::VideoFrame::kVPlane), |
| 243 dst_size.width(), | 243 dst_size.width(), |
| 244 dst_size.height(), | 244 dst_size.height(), |
| 245 libyuv::kFilterBilinear); | 245 libyuv::kFilterBilinear); |
| 246 frame = scaled_frame_; | 246 frame = scaled_frame_; |
| 247 } | 247 } |
| 248 last_frame_ = NULL; | 248 last_frame_ = NULL; |
| 249 | 249 |
| 250 // TODO(magjed): Chrome OS is not ready for switching from BGRA to ARGB. | 250 libyuv::I420ToARGB(frame->visible_data(media::VideoFrame::kYPlane), |
| 251 // Remove this once http://crbug/434007 is fixed. We have a corresponding | 251 frame->stride(media::VideoFrame::kYPlane), |
| 252 // problem when we receive frames from the effects plugin in PpFrameWriter. | 252 frame->visible_data(media::VideoFrame::kUPlane), |
| 253 #if defined(OS_CHROMEOS) | 253 frame->stride(media::VideoFrame::kUPlane), |
| 254 auto libyuv_i420_to_xxxx = &libyuv::I420ToBGRA; | 254 frame->visible_data(media::VideoFrame::kVPlane), |
| 255 #else | 255 frame->stride(media::VideoFrame::kVPlane), |
| 256 auto libyuv_i420_to_xxxx = &libyuv::I420ToARGB; | 256 bitmap_pixels, |
| 257 #endif | 257 bitmap->rowBytes(), |
| 258 libyuv_i420_to_xxxx(frame->visible_data(media::VideoFrame::kYPlane), | 258 dst_size.width(), |
| 259 frame->stride(media::VideoFrame::kYPlane), | 259 dst_size.height()); |
| 260 frame->visible_data(media::VideoFrame::kUPlane), | |
| 261 frame->stride(media::VideoFrame::kUPlane), | |
| 262 frame->visible_data(media::VideoFrame::kVPlane), | |
| 263 frame->stride(media::VideoFrame::kVPlane), | |
| 264 bitmap_pixels, | |
| 265 bitmap->rowBytes(), | |
| 266 dst_size.width(), | |
| 267 dst_size.height()); | |
| 268 | 260 |
| 269 ppapi::HostResource host_resource; | 261 ppapi::HostResource host_resource; |
| 270 host_resource.SetHostResource(pp_instance(), shared_image_->GetReference()); | 262 host_resource.SetHostResource(pp_instance(), shared_image_->GetReference()); |
| 271 | 263 |
| 272 // Convert a video timestamp to a PP_TimeTicks (a double, in seconds). | 264 // Convert a video timestamp to a PP_TimeTicks (a double, in seconds). |
| 273 const PP_TimeTicks timestamp = frame->timestamp().InSecondsF(); | 265 const PP_TimeTicks timestamp = frame->timestamp().InSecondsF(); |
| 274 | 266 |
| 275 ppapi::proxy::SerializedHandle serialized_handle; | 267 ppapi::proxy::SerializedHandle serialized_handle; |
| 276 serialized_handle.set_shmem(image_handle, byte_count); | 268 serialized_handle.set_shmem(image_handle, byte_count); |
| 277 reply_context_.params.AppendHandle(serialized_handle); | 269 reply_context_.params.AppendHandle(serialized_handle); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 296 if (source_handler_.get() && !stream_url_.empty()) | 288 if (source_handler_.get() && !stream_url_.empty()) |
| 297 source_handler_->Close(frame_receiver_.get()); | 289 source_handler_->Close(frame_receiver_.get()); |
| 298 | 290 |
| 299 source_handler_.reset(NULL); | 291 source_handler_.reset(NULL); |
| 300 stream_url_.clear(); | 292 stream_url_.clear(); |
| 301 | 293 |
| 302 shared_image_ = NULL; | 294 shared_image_ = NULL; |
| 303 } | 295 } |
| 304 | 296 |
| 305 } // namespace content | 297 } // namespace content |
| OLD | NEW |