mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Limit VNC size by default.
This commit is contained in:
parent
d5bfcb16d4
commit
9d20484dcb
5 changed files with 29 additions and 5 deletions
15
lib/cli.js
15
lib/cli.js
|
@ -68,6 +68,10 @@ program
|
|||
, 'adb connect URL pattern'
|
||||
, String
|
||||
, '${publicIp}:${publicPort}')
|
||||
.option('--vnc-initial-size <size>'
|
||||
, 'initial VNC size'
|
||||
, cliutil.size
|
||||
, [600, 800])
|
||||
.option('--mute-master'
|
||||
, 'whether to mute master volume when devices are being used')
|
||||
.option('--lock-rotation'
|
||||
|
@ -112,6 +116,7 @@ program
|
|||
, '--screen-ws-url-pattern', options.screenWsUrlPattern
|
||||
, '--connect-url-pattern', options.connectUrlPattern
|
||||
, '--heartbeat-interval', options.heartbeatInterval
|
||||
, '--vnc-initial-size', options.vncInitialSize.join('x')
|
||||
]
|
||||
.concat(options.muteMaster ? ['--mute-master'] : [])
|
||||
.concat(options.lockRotation ? ['--lock-rotation'] : []))
|
||||
|
@ -146,6 +151,10 @@ program
|
|||
.option('--vnc-port <port>'
|
||||
, 'port allocated to vnc'
|
||||
, Number)
|
||||
.option('--vnc-initial-size <size>'
|
||||
, 'initial VNC size'
|
||||
, cliutil.size
|
||||
, [600, 800])
|
||||
.option('--connect-url-pattern <pattern>'
|
||||
, 'adb connect URL pattern'
|
||||
, String
|
||||
|
@ -221,6 +230,7 @@ program
|
|||
, connectUrlPattern: options.connectUrlPattern
|
||||
, connectPort: options.connectPort
|
||||
, vncPort: options.vncPort
|
||||
, vncInitialSize: options.vncInitialSize
|
||||
, heartbeatInterval: options.heartbeatInterval
|
||||
, muteMaster: options.muteMaster
|
||||
, lockRotation: options.lockRotation
|
||||
|
@ -954,6 +964,10 @@ program
|
|||
.option('--user-profile-url <url>'
|
||||
, 'URL to external user profile page'
|
||||
, String)
|
||||
.option('--vnc-initial-size <size>'
|
||||
, 'initial VNC size'
|
||||
, cliutil.size
|
||||
, [600, 800])
|
||||
.option('--mute-master'
|
||||
, 'whether to mute master volume when devices are being used')
|
||||
.option('--lock-rotation'
|
||||
|
@ -1021,6 +1035,7 @@ program
|
|||
, util.format('http://localhost:%d/', options.poorxyPort)
|
||||
, '--adb-host', options.adbHost
|
||||
, '--adb-port', options.adbPort
|
||||
, '--vnc-initial-size', options.vncInitialSize.join('x')
|
||||
]
|
||||
.concat(options.allowRemote ? ['--allow-remote'] : [])
|
||||
.concat(options.muteMaster ? ['--mute-master'] : [])
|
||||
|
|
|
@ -25,7 +25,6 @@ module.exports = syrup.serial()
|
|||
.dependency(require('./options'))
|
||||
.define(function(options, adb, minicap, display, screenOptions) {
|
||||
var log = logger.createLogger('device:plugins:screen:stream')
|
||||
var plugin = Object.create(null)
|
||||
|
||||
function FrameProducer(config) {
|
||||
EventEmitter.call(this)
|
||||
|
@ -443,9 +442,9 @@ module.exports = syrup.serial()
|
|||
|
||||
return createServer()
|
||||
.then(function(wss) {
|
||||
var broadcastSet = plugin.broadcastSet = new BroadcastSet()
|
||||
var frameProducer = new FrameProducer(
|
||||
new FrameConfig(display.properties, display.properties))
|
||||
var broadcastSet = frameProducer.broadcastSet = new BroadcastSet()
|
||||
|
||||
broadcastSet.on('nonempty', function() {
|
||||
frameProducer.start()
|
||||
|
@ -589,6 +588,7 @@ module.exports = syrup.serial()
|
|||
lifecycle.observe(function() {
|
||||
frameProducer.stop()
|
||||
})
|
||||
|
||||
return frameProducer
|
||||
})
|
||||
.return(plugin)
|
||||
})
|
||||
|
|
|
@ -24,6 +24,8 @@ module.exports = syrup.serial()
|
|||
|
||||
var opts = {
|
||||
name: options.serial
|
||||
, width: options.vncInitialSize[0]
|
||||
, height: options.vncInitialSize[1]
|
||||
}
|
||||
|
||||
var vnc = new VncServer(net.createServer({
|
||||
|
@ -135,6 +137,8 @@ module.exports = syrup.serial()
|
|||
}
|
||||
|
||||
conn.on('authenticated', function() {
|
||||
screenStream.updateProjection(
|
||||
options.vncInitialSize[0], options.vncInitialSize[1])
|
||||
screenStream.broadcastSet.insert(id, {
|
||||
onStart: vncStartListener
|
||||
, onFrame: vncFrameListener
|
||||
|
|
|
@ -21,8 +21,8 @@ function VncConnection(conn, options) {
|
|||
|
||||
this._serverVersion = VncConnection.V3_008
|
||||
this._serverSupportedSecurity = [VncConnection.SECURITY_NONE]
|
||||
this._serverWidth = 1080
|
||||
this._serverHeight = 1920
|
||||
this._serverWidth = this.options.width
|
||||
this._serverHeight = this.options.height
|
||||
this._serverPixelFormat = new PixelFormat({
|
||||
bitsPerPixel: 24
|
||||
, depth: 24
|
||||
|
|
|
@ -2,6 +2,11 @@ module.exports.list = function(val) {
|
|||
return val.split(/\s*,\s*/g).filter(Boolean)
|
||||
}
|
||||
|
||||
module.exports.size = function(val) {
|
||||
var match = /^(\d+)x(\d+)$/.exec(val)
|
||||
return match ? [+match[1], +match[2]] : undefined
|
||||
}
|
||||
|
||||
module.exports.allUnknownArgs = function(args) {
|
||||
return [].slice.call(args, 0, -1).filter(Boolean)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue