Index: tools/telemetry/telemetry/core/video.py |
diff --git a/tools/telemetry/telemetry/core/video.py b/tools/telemetry/telemetry/core/video.py |
index f470437513b1f99d3a5cb6d3f576651f7f453c7b..a1ef3598089c19b71ded639ab15f4bcffce52dcb 100644 |
--- a/tools/telemetry/telemetry/core/video.py |
+++ b/tools/telemetry/telemetry/core/video.py |
@@ -3,6 +3,7 @@ |
# found in the LICENSE file. |
import subprocess |
+import tempfile |
from telemetry.core import bitmap |
from telemetry.core import platform |
@@ -17,9 +18,9 @@ class BoundingBoxNotFoundException(Exception): |
class Video(object): |
"""Utilities for storing and interacting with the video capture.""" |
- def __init__(self, video_file_path): |
- # TODO(satyanarayana): Figure out when to delete this file. |
- self._video_file_path = video_file_path |
+ def __init__(self, video_file_obj): |
+ assert isinstance(video_file_obj, tempfile.NamedTemporaryFile) |
nednguyen
2014/07/08 23:24:20
You may also want to assert that video_file_obj.cl
Satyanarayana N H Manyam
2014/07/09 00:58:02
class name here (tempfile._TemporaryFileWrapper) i
Satyanarayana N H Manyam
2014/07/09 00:58:02
Done.
|
+ self._video_file_obj = video_file_obj |
self._tab_contents_bounding_box = None |
def UploadToCloudStorage(self, bucket, target_path): |
@@ -28,7 +29,7 @@ class Video(object): |
Args: |
target_path: Path indicating where to store the file in cloud storage. |
""" |
- cloud_storage.Insert(bucket, target_path, self._video_file_path) |
+ cloud_storage.Insert(bucket, target_path, self._video_file_obj.name) |
def GetVideoFrameIter(self): |
"""Returns the iteration for processing the video capture. |
@@ -42,7 +43,7 @@ class Video(object): |
time_ms is milliseconds since navigationStart. |
bitmap is a telemetry.core.Bitmap. |
""" |
- frame_generator = self._FramesFromMp4(self._video_file_path) |
+ frame_generator = self._FramesFromMp4(self._video_file_obj.name) |
# Flip through frames until we find the initial tab contents flash. |
content_box = None |