OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include <CoreVideo/CoreVideo.h> | 7 #include <CoreVideo/CoreVideo.h> |
8 #include <OpenGL/CGLIOSurface.h> | 8 #include <OpenGL/CGLIOSurface.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/mac/mac_logging.h" | 14 #include "base/mac/mac_logging.h" |
| 15 #include "base/metrics/histogram_macros.h" |
15 #include "base/sys_byteorder.h" | 16 #include "base/sys_byteorder.h" |
16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
17 #include "content/common/gpu/media/vt_video_decode_accelerator.h" | 18 #include "content/common/gpu/media/vt_video_decode_accelerator.h" |
18 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
19 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
20 #include "ui/gl/scoped_binders.h" | 21 #include "ui/gl/scoped_binders.h" |
21 | 22 |
22 using content_common_gpu_media::kModuleVt; | 23 using content_common_gpu_media::kModuleVt; |
23 using content_common_gpu_media::InitializeStubs; | 24 using content_common_gpu_media::InitializeStubs; |
24 using content_common_gpu_media::IsVtInitialized; | 25 using content_common_gpu_media::IsVtInitialized; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 format_, // video_format_description | 328 format_, // video_format_description |
328 decoder_config, // video_decoder_specification | 329 decoder_config, // video_decoder_specification |
329 image_config, // destination_image_buffer_attributes | 330 image_config, // destination_image_buffer_attributes |
330 &callback_, // output_callback | 331 &callback_, // output_callback |
331 session_.InitializeInto()); | 332 session_.InitializeInto()); |
332 if (status) { | 333 if (status) { |
333 NOTIFY_STATUS("VTDecompressionSessionCreate()", status); | 334 NOTIFY_STATUS("VTDecompressionSessionCreate()", status); |
334 return false; | 335 return false; |
335 } | 336 } |
336 | 337 |
| 338 // Report whether hardware decode is being used. |
| 339 base::ScopedCFTypeRef<CFBooleanRef> using_hardware; |
| 340 if (VTSessionCopyProperty( |
| 341 session_, |
| 342 // kVTDecompressionPropertyKey_UsingHardwareAcceleratedVideoDecoder |
| 343 CFSTR("UsingHardwareAcceleratedVideoDecoder"), |
| 344 kCFAllocatorDefault, |
| 345 using_hardware.InitializeInto()) == 0) { |
| 346 UMA_HISTOGRAM_BOOLEAN("Media.VTVDA.HardwareAccelerated", |
| 347 CFBooleanGetValue(using_hardware)); |
| 348 } |
| 349 |
337 return true; | 350 return true; |
338 } | 351 } |
339 | 352 |
340 void VTVideoDecodeAccelerator::DecodeTask( | 353 void VTVideoDecodeAccelerator::DecodeTask( |
341 const media::BitstreamBuffer& bitstream, | 354 const media::BitstreamBuffer& bitstream, |
342 Frame* frame) { | 355 Frame* frame) { |
343 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); | 356 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); |
344 | 357 |
345 // Map the bitstream buffer. | 358 // Map the bitstream buffer. |
346 base::SharedMemory memory(bitstream.handle(), true); | 359 base::SharedMemory memory(bitstream.handle(), true); |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 assigned_bitstream_ids_.clear(); | 900 assigned_bitstream_ids_.clear(); |
888 state_ = STATE_DESTROYING; | 901 state_ = STATE_DESTROYING; |
889 QueueFlush(TASK_DESTROY); | 902 QueueFlush(TASK_DESTROY); |
890 } | 903 } |
891 | 904 |
892 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { | 905 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { |
893 return false; | 906 return false; |
894 } | 907 } |
895 | 908 |
896 } // namespace content | 909 } // namespace content |
OLD | NEW |