OLD | NEW |
(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 from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice |
| 8 |
| 9 import string |
| 10 import time |
| 11 import random |
| 12 import sys |
| 13 import subprocess |
| 14 |
| 15 devname = sys.argv[2] |
| 16 |
| 17 videoout = sys.argv[3] |
| 18 |
| 19 room = ''.join(random.choice(string.ascii_letters + string.digits) |
| 20 for _ in range(8)) |
| 21 |
| 22 # Delete output video file |
| 23 subprocess.Popen(['adb', '-s', devname, 'shell', 'rm', |
| 24 '/storage/emulated/0/output.y4m']) |
| 25 #sys.exit() |
| 26 |
| 27 device = MonkeyRunner.waitForConnection(2, devname) |
| 28 |
| 29 extras = { |
| 30 'org.appspot.apprtc.AUDIOCODEC': 'OPUS', |
| 31 'org.appspot.apprtc.LOOPBACK': True, |
| 32 'org.appspot.apprtc.VIDEOCODEC': 'VP8', |
| 33 'org.appspot.apprtc.CAPTURETOTEXTURE': False, |
| 34 'org.appspot.apprtc.CAMERA2': False, |
| 35 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA': |
| 36 '/storage/emulated/0/nv21_1280x720.yuv', |
| 37 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_WIDTH': 1280, |
| 38 'org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT': 720, |
| 39 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE': |
| 40 '/storage/emulated/0/output.y4m', |
| 41 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH': 1280, |
| 42 'org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT': 720, |
| 43 'org.appspot.apprtc.ROOMID': room} |
| 44 |
| 45 # ACTION_VIEW is equivalent to android.intent.action.VIEW, |
| 46 # see https://developer.android.com/reference/android/content/Intent.html#ACTION
_VIEW |
| 47 device.startActivity(data='https://appr.tc', action='ACTION_VIEW', |
| 48 component='org.appspot.apprtc/.CallActivity', extras=extras) |
| 49 |
| 50 time.sleep(10) |
| 51 |
| 52 # Press back to end the call. Will end on both sides |
| 53 device.press('KEYCODE_BACK', MonkeyDevice.DOWN_AND_UP) |
| 54 |
| 55 subprocess.Popen(['adb', '-s', devname, 'pull', |
| 56 '/storage/emulated/0/output.y4m', videoout]) |
| 57 |
OLD | NEW |