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

Side by Side Diff: webrtc/examples/androidapp/start_loopback_stubbed_camera_saved_video_out.py

Issue 2415563002: Testing of VideoFileRenderer with byte frames (Closed)
Patch Set: Changed path for output video file for VideoFileRendererTest Created 4 years, 2 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The WebRTC Project Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license
3 # that can be found in the LICENSE file in the root of the source
4 # tree. An additional intellectual property rights grant can be found
5 # in the file PATENTS. All contributing project authors may
6 # be found in the AUTHORS file in the root of the source tree.
7
8 from optparse import OptionParser
9 import random
10 import string
11 import subprocess
12 import sys
13 import time
14
15 from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
16
17 def main():
18 parser = OptionParser()
19
20 parser.add_option('--devname', dest='devname', help='The device id')
21
22 parser.add_option(
23 '--videooutsave',
24 dest='videooutsave',
25 help='The path where to save the video out file on local computer')
26
27 parser.add_option(
28 '--videoout',
29 dest='videoout',
30 help='The path where to put the video out file')
31
32 parser.add_option(
33 '--videoout_width',
34 dest='videoout_width',
35 type='int',
36 help='The width for the video out file')
37
38 parser.add_option(
39 '--videoout_height',
40 dest='videoout_height',
41 type='int',
42 help='The height for the video out file')
43
44 parser.add_option(
45 '--videoin',
46 dest='videoin',
47 help='The path where to read input file instead of camera')
48
49 parser.add_option(
50 '--call_length',
51 dest='call_length',
52 type='int',
53 help='The length of the call')
54
55 (options, args) = parser.parse_args()
56
57 print (options, args)
58
59 devname = options.devname
60
61 videoin = options.videoin
62
63 videoout = options.videoout
64 videoout_width = options.videoout_width
65 videoout_height = options.videoout_height
66
67 videooutsave = options.videooutsave
68
69 call_length = options.call_length or 10
70
71 room = ''.join(random.choice(string.ascii_letters + string.digits)
72 for _ in range(8))
73
74 # Delete output video file.
75 if videoout:
76 subprocess.Popen(['adb', '-s', devname, 'shell', 'rm',
77 videoout])
78
79 device = MonkeyRunner.waitForConnection(2, devname)
80
81 extras = {
82 'org.appspot.apprtc.USE_VALUES_FROM_INTENT': True,
83 'org.appspot.apprtc.AUDIOCODEC': 'OPUS',
84 'org.appspot.apprtc.LOOPBACK': True,
85 'org.appspot.apprtc.VIDEOCODEC': 'VP8',
86 'org.appspot.apprtc.CAPTURETOTEXTURE': False,
87 'org.appspot.apprtc.CAMERA2': False,
88 'org.appspot.apprtc.ROOMID': room}
89
90 if videoin:
91 extras.update({'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA': videoin})
92
93 if videoout:
94 extras.update({
95 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE': videoout,
96 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH': videoout_width,
97 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT': videoout_height})
98
99 print extras
100
101 device.startActivity(data='https://appr.tc',
102 action='android.intent.action.VIEW',
103 component='org.appspot.apprtc/.ConnectActivity', extras=extras)
104
105 print 'Running a call for %d seconds' % call_length
106 for _ in xrange(call_length):
107 sys.stdout.write('.')
108 sys.stdout.flush()
109 time.sleep(1)
110 print '\nEnding call.'
111
112 # Press back to end the call. Will end on both sides.
113 device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP)
114
115 if videooutsave:
116 time.sleep(2)
117
118 subprocess.Popen(['adb', '-s', devname, 'pull',
119 videoout, videooutsave])
120
121 if __name__ == '__main__':
122 main()
123
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698