Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.cc

Issue 1153163003: Add flag to enable MJPEG acceleration for video capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mjpeg-4-use
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 9 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 14 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
14 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h" 15 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/common/content_switches.h"
16 #include "media/base/video_frame.h" 18 #include "media/base/video_frame.h"
17 19
18 namespace content { 20 namespace content {
19 21
20 // static 22 // static
21 bool VideoCaptureGpuJpegDecoder::Supported() { 23 bool VideoCaptureGpuJpegDecoder::Supported() {
22 // A lightweight check for caller to avoid IPC latency for known unsupported 24 // A lightweight check for caller to avoid IPC latency for known unsupported
23 // platform. Initialize() can do the real platform supporting check but it 25 // platform. Initialize() can do the real platform supporting check but it
24 // requires an IPC even for platforms that do not support HW decoder. 26 // requires an IPC even for platforms that do not support HW decoder.
25 // TODO(kcwu): move this information to GpuInfo. https://crbug.com/503568 27 // TODO(kcwu): move this information to GpuInfo. https://crbug.com/503568
28 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
29 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
30 switches::kEnableAcceleratedMjpegDecode)) {
31 return true;
32 }
33 #endif
26 return false; 34 return false;
27 } 35 }
28 36
29 VideoCaptureGpuJpegDecoder::VideoCaptureGpuJpegDecoder( 37 VideoCaptureGpuJpegDecoder::VideoCaptureGpuJpegDecoder(
30 const DecodeDoneCB& decode_done_cb, 38 const DecodeDoneCB& decode_done_cb,
31 const ErrorCB& error_cb) 39 const ErrorCB& error_cb)
32 : decode_done_cb_(decode_done_cb), 40 : decode_done_cb_(decode_done_cb),
33 error_cb_(error_cb), 41 error_cb_(error_cb),
34 next_bitstream_buffer_id_(0), 42 next_bitstream_buffer_id_(0),
35 in_buffer_id_(media::JpegDecodeAccelerator::kInvalidBitstreamBufferId) { 43 in_buffer_id_(media::JpegDecodeAccelerator::kInvalidBitstreamBufferId) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 decode_done_closure_ = base::Bind( 224 decode_done_closure_ = base::Bind(
217 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp); 225 decode_done_cb_, base::Passed(&out_buffer), out_frame, timestamp);
218 } 226 }
219 decoder_->Decode(in_buffer, out_frame); 227 decoder_->Decode(in_buffer, out_frame);
220 #else 228 #else
221 NOTREACHED(); 229 NOTREACHED();
222 #endif 230 #endif
223 } 231 }
224 232
225 } // namespace content 233 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/chrome_restart_request.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698