Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6222)

Unified Diff: build/android/pylib/screenshot.py

Issue 109553002: [Telemetry] Make StartVideoCapture start capturing synchronously. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skyostil comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/screenshot.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/screenshot.py
diff --git a/build/android/pylib/screenshot.py b/build/android/pylib/screenshot.py
index 65274aeffb160fa41379ab742e5f6df78b176ca9..e2734eb2bdd577151b93807d02e50c7ca2eed2f1 100644
--- a/build/android/pylib/screenshot.py
+++ b/build/android/pylib/screenshot.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import os
+import tempfile
import time
import android_commands
@@ -56,11 +57,13 @@ class VideoRecorder(object):
self._host_file = os.path.abspath(self._host_file)
self._recorder = None
self._recorder_pids = None
+ self._recorder_stdout = None
+ self._is_started = False
self._args = ['adb']
if self._adb.GetDevice():
self._args += ['-s', self._adb.GetDevice()]
- self._args += ['shell', 'screenrecord']
+ self._args += ['shell', 'screenrecord', '--verbose']
self._args += ['--bit-rate', str(megabits_per_second * 1000 * 1000)]
if size:
self._args += ['--size', '%dx%d' % size]
@@ -71,14 +74,26 @@ class VideoRecorder(object):
def Start(self):
"""Start recording video."""
_EnsureHostDirectory(self._host_file)
- self._recorder = cmd_helper.Popen(self._args)
+ self._recorder_stdout = tempfile.mkstemp()[1]
+ self._recorder = cmd_helper.Popen(
+ self._args, stdout=open(self._recorder_stdout, 'w'))
self._recorder_pids = self._adb.ExtractPid('screenrecord')
if not self._recorder_pids:
raise RuntimeError('Recording failed. Is your device running Android '
'KitKat or later?')
+ def IsStarted(self):
+ if not self._is_started:
+ for line in open(self._recorder_stdout):
+ self._is_started = line.startswith('Content area is ')
+ if self._is_started:
+ break
+ return self._is_started
+
def Stop(self):
"""Stop recording video."""
+ os.remove(self._recorder_stdout)
+ self._is_started = False
if not self._recorder or not self._recorder_pids:
return
self._adb.RunShellCommand('kill -SIGINT ' + ' '.join(self._recorder_pids))
« no previous file with comments | « no previous file | build/android/screenshot.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698