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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 11 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
12 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" | 12 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // static | 18 // static |
19 bool GpuJpegDecoder::Supported() { | 19 bool GpuJpegDecoder::Supported() { |
20 // A lightweight check for caller to avoid IPC latency for known unsupported | 20 // A lightweight check for caller to avoid IPC latency for known unsupported |
21 // platform. Initialize() can do the real platform supporting check but it | 21 // platform. Initialize() can do the real platform supporting check but it |
22 // requires an IPC even for platforms that do not support HW decoder. | 22 // requires an IPC even for platforms that do not support HW decoder. |
23 // TODO(kcwu): move this information to GpuInfo. | 23 // TODO(kcwu): move this information to GpuInfo. |
24 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 24 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
25 return true; | 25 return true; |
26 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | |
wuchengli
2015/05/25 10:29:23
Can we do this?
#if defined(OS_CHROMEOS)
#if defin
henryhsu
2015/06/05 03:28:55
Because veyron and nyan series don't support JPEG
| |
27 return true; | |
26 #endif | 28 #endif |
27 return false; | 29 return false; |
28 } | 30 } |
29 | 31 |
30 GpuJpegDecoder::GpuJpegDecoder(const DecodeDoneCB& decode_done_cb, | 32 GpuJpegDecoder::GpuJpegDecoder(const DecodeDoneCB& decode_done_cb, |
31 const ErrorCB& error_cb) | 33 const ErrorCB& error_cb) |
32 : jpeg_thread_("GpuJpegDecoderThread"), | 34 : jpeg_thread_("GpuJpegDecoderThread"), |
33 create_event_(false, false), | 35 create_event_(false, false), |
34 decode_event_(false, false), | 36 decode_event_(false, false), |
35 decode_done_cb_(decode_done_cb), | 37 decode_done_cb_(decode_done_cb), |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 DCHECK(out_frame.get()); | 207 DCHECK(out_frame.get()); |
206 out_frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, | 208 out_frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, |
207 frame_format.frame_rate); | 209 frame_format.frame_rate); |
208 | 210 |
209 decode_done_closure_ = base::Bind(decode_done_cb_, base::Passed(&out_buffer), | 211 decode_done_closure_ = base::Bind(decode_done_cb_, base::Passed(&out_buffer), |
210 out_frame, timestamp); | 212 out_frame, timestamp); |
211 decoder_->Decode(in_buffer_, out_frame); | 213 decoder_->Decode(in_buffer_, out_frame); |
212 } | 214 } |
213 | 215 |
214 } // namespace content | 216 } // namespace content |
OLD | NEW |