OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/gpu/media/gpu_jpeg_decode_accelerator.h" | 5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 media::VideoFrame::WrapExternalSharedMemory( | 239 media::VideoFrame::WrapExternalSharedMemory( |
240 media::PIXEL_FORMAT_I420, // format | 240 media::PIXEL_FORMAT_I420, // format |
241 params.coded_size, // coded_size | 241 params.coded_size, // coded_size |
242 gfx::Rect(params.coded_size), // visible_rect | 242 gfx::Rect(params.coded_size), // visible_rect |
243 params.coded_size, // natural_size | 243 params.coded_size, // natural_size |
244 shm_memory, // data | 244 shm_memory, // data |
245 params.output_buffer_size, // data_size | 245 params.output_buffer_size, // data_size |
246 params.output_video_frame_handle, // handle | 246 params.output_video_frame_handle, // handle |
247 0, // data_offset | 247 0, // data_offset |
248 base::TimeDelta()); // timestamp | 248 base::TimeDelta()); // timestamp |
249 frame->AddDestructionObserver( | |
250 base::Bind(DecodeFinished, base::Passed(&output_shm))); | |
251 | |
252 if (!frame.get()) { | 249 if (!frame.get()) { |
253 LOG(ERROR) << "Could not create VideoFrame for input buffer id " | 250 LOG(ERROR) << "Could not create VideoFrame for input buffer id " |
254 << params.input_buffer_id; | 251 << params.input_buffer_id; |
255 NotifyDecodeStatusOnIOThread( | 252 NotifyDecodeStatusOnIOThread( |
256 *route_id, params.input_buffer_id, | 253 *route_id, params.input_buffer_id, |
257 media::JpegDecodeAccelerator::PLATFORM_FAILURE); | 254 media::JpegDecodeAccelerator::PLATFORM_FAILURE); |
258 base::SharedMemory::CloseHandle(params.input_buffer_handle); | 255 base::SharedMemory::CloseHandle(params.input_buffer_handle); |
259 return; | 256 return; |
260 } | 257 } |
| 258 frame->AddDestructionObserver( |
| 259 base::Bind(DecodeFinished, base::Passed(&output_shm))); |
261 | 260 |
262 DCHECK_GT(client_map_.count(*route_id), 0u); | 261 DCHECK_GT(client_map_.count(*route_id), 0u); |
263 Client* client = client_map_[*route_id]; | 262 Client* client = client_map_[*route_id]; |
264 client->Decode(input_buffer, frame); | 263 client->Decode(input_buffer, frame); |
265 } | 264 } |
266 | 265 |
267 protected: | 266 protected: |
268 ~MessageFilter() override { | 267 ~MessageFilter() override { |
269 if (client_map_.empty()) | 268 if (client_map_.empty()) |
270 return; | 269 return; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 for (const auto& create_jda_function : create_jda_fps) { | 430 for (const auto& create_jda_function : create_jda_fps) { |
432 scoped_ptr<media::JpegDecodeAccelerator> accelerator = | 431 scoped_ptr<media::JpegDecodeAccelerator> accelerator = |
433 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); | 432 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); |
434 if (accelerator && accelerator->IsSupported()) | 433 if (accelerator && accelerator->IsSupported()) |
435 return true; | 434 return true; |
436 } | 435 } |
437 return false; | 436 return false; |
438 } | 437 } |
439 | 438 |
440 } // namespace content | 439 } // namespace content |
OLD | NEW |