summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/common/gpu/media/vt.sig1
-rw-r--r--content/common/gpu/media/vt_stubs_header.fragment1
-rw-r--r--content/common/gpu/media/vt_video_decode_accelerator.cc13
-rw-r--r--tools/metrics/histograms/histograms.xml14
4 files changed, 29 insertions, 0 deletions
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<CFBooleanRef> 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;
}
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 7099700..5c77311 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -12765,6 +12765,15 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<summary>Visible width of HTML5 video.</summary>
</histogram>
+<histogram name="Media.VTVDA.HardwareAccelerated"
+ enum="BooleanHardwareAccelerated">
+ <owner>sandersd@chromium.org</owner>
+ <summary>
+ Whether a VTDecompressionSession is internally using hardware accelerated
+ decoding.
+ </summary>
+</histogram>
+
<histogram name="Media.YouTube.DelayedAndDroppedFramesPer5Sec"
units="frames/5s">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
@@ -41845,6 +41854,11 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="1" label="Handshake confirmed"/>
</enum>
+<enum name="BooleanHardwareAccelerated" type="int">
+ <int value="0" label="Not hardware accelerated"/>
+ <int value="1" label="Hardware accelerated"/>
+</enum>
+
<enum name="BooleanHasCrc" type="int">
<int value="0" label="No CRC"/>
<int value="1" label="Has CRC"/>