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