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