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/safe_numerics.h" | 8 #include "base/safe_numerics.h" |
9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 int32_t width = base::checked_numeric_cast<int32_t>(frame->GetWidth()); | 138 int32_t width = base::checked_numeric_cast<int32_t>(frame->GetWidth()); |
139 int32_t height = base::checked_numeric_cast<int32_t>(frame->GetHeight()); | 139 int32_t height = base::checked_numeric_cast<int32_t>(frame->GetHeight()); |
140 // Create an image data resource to hold the frame pixels. | 140 // Create an image data resource to hold the frame pixels. |
141 PP_ImageDataDesc image_desc; | 141 PP_ImageDataDesc image_desc; |
142 IPC::PlatformFileForTransit image_handle; | 142 IPC::PlatformFileForTransit image_handle; |
143 uint32_t byte_count; | 143 uint32_t byte_count; |
144 ppapi::ScopedPPResource resource( | 144 ppapi::ScopedPPResource resource( |
145 ppapi::ScopedPPResource::PassRef(), | 145 ppapi::ScopedPPResource::PassRef(), |
146 ppapi::proxy::PPB_ImageData_Proxy::CreateImageData( | 146 ppapi::proxy::PPB_ImageData_Proxy::CreateImageData( |
147 pp_instance(), | 147 pp_instance(), |
| 148 ppapi::PPB_ImageData_Shared::PLATFORM, |
148 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 149 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
149 PP_MakeSize(width, height), | 150 PP_MakeSize(width, height), |
150 false /* init_to_zero */, | 151 false /* init_to_zero */, |
151 false /* is_nacl_plugin */, | |
152 &image_desc, &image_handle, &byte_count)); | 152 &image_desc, &image_handle, &byte_count)); |
153 if (!resource.get()) { | 153 if (!resource.get()) { |
154 SendGetFrameErrorReply(PP_ERROR_FAILED); | 154 SendGetFrameErrorReply(PP_ERROR_FAILED); |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_ImageData_API> | 158 ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_ImageData_API> |
159 enter_resource(resource, false); | 159 enter_resource(resource, false); |
160 if (enter_resource.failed()) { | 160 if (enter_resource.failed()) { |
161 SendGetFrameErrorReply(PP_ERROR_FAILED); | 161 SendGetFrameErrorReply(PP_ERROR_FAILED); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 void PepperVideoSourceHost::Close() { | 245 void PepperVideoSourceHost::Close() { |
246 if (source_handler_.get() && !stream_url_.empty()) | 246 if (source_handler_.get() && !stream_url_.empty()) |
247 source_handler_->Close(stream_url_, frame_receiver_.get()); | 247 source_handler_->Close(stream_url_, frame_receiver_.get()); |
248 | 248 |
249 source_handler_.reset(NULL); | 249 source_handler_.reset(NULL); |
250 stream_url_.clear(); | 250 stream_url_.clear(); |
251 } | 251 } |
252 | 252 |
253 } // namespace content | 253 } // namespace content |
OLD | NEW |