From 3125ca55d73650bd37ce9d9daa3dfe5182a7cf3a Mon Sep 17 00:00:00 2001 From: sandersd Date: Wed, 3 Dec 2014 14:33:15 -0800 Subject: Add UMA to track software fallback in VTVideoDecodeAccelerator. VideoToolbox can fall back to software internally for two reasons: 1) The resolution is below the minimum (or other format incompatibility). Eventually we want Chromium to handle fallback in this case. 2) The sandbox was not initialized properly. This we want to know about and fix. This CL does not distinguish the two cases. BUG=133828 Review URL: https://codereview.chromium.org/773673002 Cr-Commit-Position: refs/heads/master@{#306692} --- content/common/gpu/media/vt.sig | 1 + content/common/gpu/media/vt_stubs_header.fragment | 1 + content/common/gpu/media/vt_video_decode_accelerator.cc | 13 +++++++++++++ 3 files changed, 15 insertions(+) (limited to 'content') diff --git a/content/common/gpu/media/vt.sig b/content/common/gpu/media/vt.sig index a9639a3..39c408e 100644 --- a/content/common/gpu/media/vt.sig +++ b/content/common/gpu/media/vt.sig @@ -14,3 +14,4 @@ Boolean VTDecompressionSessionCanAcceptFormatDescription(VTDecompressionSessionR OSStatus VTDecompressionSessionCreate(CFAllocatorRef allocator, CMVideoFormatDescriptionRef videoFormatDescription, CFDictionaryRef videoDecoderSpecification, CFDictionaryRef destinationImageBufferAttributes, const VTDecompressionOutputCallbackRecord *outputCallback, VTDecompressionSessionRef *decompressionSessionOut); OSStatus VTDecompressionSessionDecodeFrame(VTDecompressionSessionRef session, CMSampleBufferRef sampleBuffer, VTDecodeFrameFlags decodeFlags, void *sourceFrameRefCon, VTDecodeInfoFlags *infoFlagsOut); OSStatus VTDecompressionSessionWaitForAsynchronousFrames(VTDecompressionSessionRef session); +OSStatus VTSessionCopyProperty(VTSessionRef session, CFStringRef propertyKey, CFAllocatorRef allocator, void *propertyValueOut); diff --git a/content/common/gpu/media/vt_stubs_header.fragment b/content/common/gpu/media/vt_stubs_header.fragment index f8f7ded..eabcd26 100644 --- a/content/common/gpu/media/vt_stubs_header.fragment +++ b/content/common/gpu/media/vt_stubs_header.fragment @@ -66,6 +66,7 @@ enum { }; typedef UInt32 VTDecodeInfoFlags; typedef struct OpaqueVTDecompressionSession* VTDecompressionSessionRef; +typedef CFTypeRef VTSessionRef; typedef void (*VTDecompressionOutputCallback)( void *decompressionOutputRefCon, diff --git a/content/common/gpu/media/vt_video_decode_accelerator.cc b/content/common/gpu/media/vt_video_decode_accelerator.cc index d4ad116..b0a9d7e 100644 --- a/content/common/gpu/media/vt_video_decode_accelerator.cc +++ b/content/common/gpu/media/vt_video_decode_accelerator.cc @@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/mac/mac_logging.h" +#include "base/metrics/histogram_macros.h" #include "base/sys_byteorder.h" #include "base/thread_task_runner_handle.h" #include "content/common/gpu/media/vt_video_decode_accelerator.h" @@ -334,6 +335,18 @@ bool VTVideoDecodeAccelerator::ConfigureDecoder() { return false; } + // Report whether hardware decode is being used. + base::ScopedCFTypeRef using_hardware; + if (VTSessionCopyProperty( + session_, + // kVTDecompressionPropertyKey_UsingHardwareAcceleratedVideoDecoder + CFSTR("UsingHardwareAcceleratedVideoDecoder"), + kCFAllocatorDefault, + using_hardware.InitializeInto()) == 0) { + UMA_HISTOGRAM_BOOLEAN("Media.VTVDA.HardwareAccelerated", + CFBooleanGetValue(using_hardware)); + } + return true; } -- cgit v1.1