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/browser/renderer_host/gpu_jpeg_decoder.h" | 5 #include "content/browser/renderer_host/gpu_jpeg_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
11 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 12 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
12 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" | 13 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/common/content_switches.h" | |
14 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
17 | 19 |
18 // static | 20 // static |
19 bool GpuJpegDecoder::Supported() { | 21 bool GpuJpegDecoder::Supported() { |
20 // A lightweight check for caller to avoid IPC latency for known unsupported | 22 // A lightweight check for caller to avoid IPC latency for known unsupported |
21 // platform. Initialize() can do the real platform supporting check but it | 23 // platform. Initialize() can do the real platform supporting check but it |
22 // requires an IPC even for platforms that do not support HW decoder. | 24 // requires an IPC even for platforms that do not support HW decoder. |
23 // TODO(kcwu): move this information to GpuInfo. | 25 // TODO(kcwu): move this information to GpuInfo. |
26 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
27 switches::kEnableAcceleratedMjpegDecode)) { | |
28 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
piman
2015/06/08 21:25:03
nit: do you want to move the #ifdef around the swi
kcwu
2015/06/09 09:05:13
Done.
| |
29 return true; | |
30 #endif | |
31 } | |
24 return false; | 32 return false; |
25 } | 33 } |
26 | 34 |
27 GpuJpegDecoder::GpuJpegDecoder(const DecodeDoneCB& decode_done_cb, | 35 GpuJpegDecoder::GpuJpegDecoder(const DecodeDoneCB& decode_done_cb, |
28 const ErrorCB& error_cb) | 36 const ErrorCB& error_cb) |
29 : gpu_channel_event_(false /* manual reset */, | 37 : gpu_channel_event_(false /* manual reset */, |
30 false /* initially_signaled */), | 38 false /* initially_signaled */), |
31 decode_done_cb_(decode_done_cb), | 39 decode_done_cb_(decode_done_cb), |
32 error_cb_(error_cb), | 40 error_cb_(error_cb), |
33 next_bitstream_buffer_id_(0), | 41 next_bitstream_buffer_id_(0), |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 | 196 |
189 { | 197 { |
190 base::AutoLock lock(lock_); | 198 base::AutoLock lock(lock_); |
191 decode_done_closure_ = base::Bind( | 199 decode_done_closure_ = base::Bind( |
192 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp); | 200 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp); |
193 } | 201 } |
194 decoder_->Decode(in_buffer_, out_frame); | 202 decoder_->Decode(in_buffer_, out_frame); |
195 } | 203 } |
196 | 204 |
197 } // namespace content | 205 } // namespace content |
OLD | NEW |