Index: tools/telemetry/telemetry/core/platform/__init__.py |
diff --git a/tools/telemetry/telemetry/core/platform/__init__.py b/tools/telemetry/telemetry/core/platform/__init__.py |
index ad5909ce77f453b1f10f63ad35ea04bcc5a6810e..338d4e5b41e91566d2ec62896ccdcd4534df6001 100644 |
--- a/tools/telemetry/telemetry/core/platform/__init__.py |
+++ b/tools/telemetry/telemetry/core/platform/__init__.py |
@@ -128,6 +128,37 @@ class Platform(object): |
"""Installs the given application.""" |
return self._platform_backend.InstallApplication(application) |
+ def CanCaptureVideo(self): |
+ """Returns a bool indicating whether the platform supports video capture.""" |
+ return self._platform_backend.CanCaptureVideo() |
+ |
+ def StartVideoCapture(self, min_bitrate_mbps): |
+ """Starts capturing video. |
+ |
+ Outer framing may be included (from the OS, browser window, and webcam). |
+ |
+ Args: |
+ min_bitrate_mbps: The minimum capture bitrate in MegaBits Per Second. |
+ The platform is free to deliver a higher bitrate if it can do so |
+ without increasing overhead. |
+ |
+ Raises: |
+ ValueError if the required |min_bitrate_mbps| can't be achieved. |
+ """ |
+ return self._platform_backend.StartVideoCapture(min_bitrate_mbps) |
+ |
+ def StopVideoCapture(self): |
+ """Stops capturing video. |
+ |
+ Yields: |
+ (time_ms, bitmap) tuples representing each video keyframe. Only the first |
+ frame in a run of sequential duplicate bitmaps is included. |
+ time_ms is milliseconds relative to the first frame. |
+ bitmap is a telemetry.core.backends.png_bitmap. |
+ """ |
+ for t in self._platform_backend.StopVideoCapture(): |
+ yield t |
+ |
def CreatePlatformBackendForCurrentOS(): |
if sys.platform.startswith('linux'): |