| 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/media/video_capture_gpu_jpeg_decoder.h" | 5 #include "content/browser/renderer_host/media/video_capture_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/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bool VideoCaptureGpuJpegDecoder::IsDecoding_Locked() { | 44 bool VideoCaptureGpuJpegDecoder::IsDecoding_Locked() { |
| 45 lock_.AssertAcquired(); | 45 lock_.AssertAcquired(); |
| 46 return !decode_done_closure_.is_null(); | 46 return !decode_done_closure_.is_null(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void VideoCaptureGpuJpegDecoder::Initialize() { | 49 void VideoCaptureGpuJpegDecoder::Initialize() { |
| 50 DCHECK(CalledOnValidThread()); | 50 DCHECK(CalledOnValidThread()); |
| 51 | 51 |
| 52 // Non-ChromeOS platforms do not support HW JPEG decode now. Do not establish | 52 // Non-ChromeOS platforms do not support HW JPEG decode now. Do not establish |
| 53 // gpu channel to introduce overhead. | 53 // gpu channel to introduce overhead. |
| 54 #if !defined(OS_CHROMEOS) | 54 // TODO(henryhsu): enable on ARM platform after V4L2 JDA is ready. |
| 55 #if !defined(OS_CHROMEOS) || !defined(ARCH_CPU_X86_FAMILY) |
| 55 init_status_ = INIT_FAILED; | 56 init_status_ = INIT_FAILED; |
| 56 return; | 57 return; |
| 57 #else | 58 #else |
| 58 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 59 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 59 switches::kEnableAcceleratedMjpegDecode)) { | 60 switches::kDisableAcceleratedMjpegDecode)) { |
| 60 init_status_ = INIT_FAILED; | 61 init_status_ = INIT_FAILED; |
| 61 return; | 62 return; |
| 62 } | 63 } |
| 63 | 64 |
| 64 const scoped_refptr<base::SingleThreadTaskRunner> current_task_runner( | 65 const scoped_refptr<base::SingleThreadTaskRunner> current_task_runner( |
| 65 base::ThreadTaskRunnerHandle::Get()); | 66 base::ThreadTaskRunnerHandle::Get()); |
| 66 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 67 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 67 base::Bind(&EstablishGpuChannelOnUIThread, | 68 base::Bind(&EstablishGpuChannelOnUIThread, |
| 68 current_task_runner, AsWeakPtr())); | 69 current_task_runner, AsWeakPtr())); |
| 69 #endif | 70 #endif |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 decode_done_closure_ = base::Bind( | 228 decode_done_closure_ = base::Bind( |
| 228 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp); | 229 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp); |
| 229 } | 230 } |
| 230 decoder_->Decode(in_buffer, out_frame); | 231 decoder_->Decode(in_buffer, out_frame); |
| 231 #else | 232 #else |
| 232 NOTREACHED(); | 233 NOTREACHED(); |
| 233 #endif | 234 #endif |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace content | 237 } // namespace content |
| OLD | NEW |