Chromium Code Reviews| Index: tools/telemetry/telemetry/core/platform/android_platform_backend.py |
| diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend.py b/tools/telemetry/telemetry/core/platform/android_platform_backend.py |
| index 9cd6f677bb4dbdcee2c1a41fe9612ccae855ec0a..33404777f04e672d947bde42ad8cf31a0ae94e49 100644 |
| --- a/tools/telemetry/telemetry/core/platform/android_platform_backend.py |
| +++ b/tools/telemetry/telemetry/core/platform/android_platform_backend.py |
| @@ -3,6 +3,9 @@ |
| # found in the LICENSE file. |
| import logging |
| +import os |
| +import subprocess |
| +import tempfile |
| from telemetry.core import exceptions |
| from telemetry.core import platform |
| @@ -39,6 +42,8 @@ class AndroidPlatformBackend( |
| self._host_platform_backend = platform.CreatePlatformBackendForCurrentOS() |
| self._can_access_protected_file_contents = \ |
| self._adb.CanAccessProtectedFileContents() |
| + self._video_recorder = None |
| + self._video_output = None |
| if self._no_performance_mode: |
| logging.warning('CPU governor will not be set!') |
| @@ -135,6 +140,9 @@ class AndroidPlatformBackend( |
| def GetOSName(self): |
| return 'android' |
| + def GetOSVersionName(self): |
| + return self._adb.GetBuildId()[0] |
| + |
| def CanFlushIndividualFilesFromSystemCache(self): |
| return False |
| @@ -170,6 +178,29 @@ class AndroidPlatformBackend( |
| raise NotImplementedError( |
| 'Please teach Telemetry how to install ' + application) |
| + def CanCaptureBrowserVideo(self): |
| + return self.GetOSVersionName() >= 'K' |
| + |
| + def StartBrowserVideoCapture(self, tab, max_bitrate_mbps): |
| + assert not self._video_recorder, 'Already started video capture' |
| + assert max_bitrate_mbps >= 0.1 and max_bitrate_mbps <= 100 |
| + self._video_output = tempfile.mkstemp()[1] |
| + self._video_recorder = subprocess.Popen( |
| + [os.path.join(util.GetChromiumSrcDir(), 'build', 'android', |
| + 'screenshot.py'), |
| + '--video', '--bitrate', str(max_bitrate_mbps), '--file', |
| + self._video_output], stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
| + |
| + def StopBrowserVideoCapture(self): |
| + assert self._video_recorder, 'Must start video capture first' |
| + self._video_recorder.communicate(input='\n') |
| + self._video_recorder.wait() |
| + self._video_recorder = None |
| + |
| + # TODO(tonyg/szym): Decode the mp4 output and return the list of bitmaps. |
| + raise NotImplementedError("mp4 video saved to %s, but Telemetry doesn't " |
|
bulach
2013/11/28 11:05:23
drive-by: no idea if this is what you need, but:
a
szym
2013/11/29 11:05:12
Like you said, it could easily reach 1-2GB.
It wo
tonyg
2013/11/29 20:42:07
We accidentally checked in a PIL dep on the bots r
bulach
2013/12/02 18:11:59
I'm not volunteering myself but just throwing some
|
| + "know how to decode it." % self._video_output) |
| + |
| def _GetFileContents(self, fname): |
| if not self._can_access_protected_file_contents: |
| logging.warning('%s cannot be retrieved on non-rooted device.' % fname) |