Chromium Code Reviews| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 format_, // video_format_description | 326 format_, // video_format_description |
| 326 decoder_config, // video_decoder_specification | 327 decoder_config, // video_decoder_specification |
| 327 image_config, // destination_image_buffer_attributes | 328 image_config, // destination_image_buffer_attributes |
| 328 &callback_, // output_callback | 329 &callback_, // output_callback |
| 329 session_.InitializeInto()); | 330 session_.InitializeInto()); |
| 330 if (status) { | 331 if (status) { |
| 331 NOTIFY_STATUS("VTDecompressionSessionCreate()", status); | 332 NOTIFY_STATUS("VTDecompressionSessionCreate()", status); |
| 332 return false; | 333 return false; |
| 333 } | 334 } |
| 334 | 335 |
| 336 // Report whether hardware decode is being used. | |
| 337 base::ScopedCFTypeRef<CFBooleanRef> using_hardware; | |
| 338 if (VTSessionCopyProperty( | |
|
DaleCurtis
2014/12/02 18:20:22
Does clang-format bless this alignment? It looks o
sandersd (OOO until July 31)
2014/12/02 18:28:28
Done.
| |
| 339 session_, | |
| 340 // kVTDecompressionPropertyKey_UsingHardwareAcceleratedVideoDecoder | |
| 341 CFSTR("UsingHardwareAcceleratedVideoDecoder"), | |
| 342 kCFAllocatorDefault, | |
| 343 using_hardware.InitializeInto()) == 0) { | |
| 344 UMA_HISTOGRAM_BOOLEAN("Media.VTVDA.UsingHardware", | |
|
DaleCurtis
2014/12/02 18:20:22
Don't you need to log this for some of the other f
sandersd (OOO until July 31)
2014/12/02 18:28:29
This is the only path with internal software fallb
DaleCurtis
2014/12/02 18:29:59
Ahhhh, as posciak@ noted, you definitely need a be
| |
| 345 CFBooleanGetValue(using_hardware)); | |
| 346 } | |
| 347 | |
| 335 return true; | 348 return true; |
| 336 } | 349 } |
| 337 | 350 |
| 338 void VTVideoDecodeAccelerator::DecodeTask( | 351 void VTVideoDecodeAccelerator::DecodeTask( |
| 339 const media::BitstreamBuffer& bitstream, | 352 const media::BitstreamBuffer& bitstream, |
| 340 Frame* frame) { | 353 Frame* frame) { |
| 341 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); | 354 DCHECK(decoder_thread_.message_loop_proxy()->BelongsToCurrentThread()); |
| 342 | 355 |
| 343 // Map the bitstream buffer. | 356 // Map the bitstream buffer. |
| 344 base::SharedMemory memory(bitstream.handle(), true); | 357 base::SharedMemory memory(bitstream.handle(), true); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 assigned_bitstream_ids_.clear(); | 898 assigned_bitstream_ids_.clear(); |
| 886 state_ = STATE_DESTROYING; | 899 state_ = STATE_DESTROYING; |
| 887 QueueFlush(TASK_DESTROY); | 900 QueueFlush(TASK_DESTROY); |
| 888 } | 901 } |
| 889 | 902 |
| 890 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { | 903 bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { |
| 891 return false; | 904 return false; |
| 892 } | 905 } |
| 893 | 906 |
| 894 } // namespace content | 907 } // namespace content |
| OLD | NEW |