add frame rate management (#558)

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
Denis Barbaron
2022-08-03 13:48:51 +02:00
committed by GitHub
parent da9284b288
commit d9e59446f3
3 changed files with 40 additions and 6 deletions

View File

@@ -1,3 +1,7 @@
/**
* Copyright © 2022 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
**/
var util = require('util')
var Promise = require('bluebird')
@@ -26,6 +30,7 @@ module.exports = syrup.serial()
.define(function(options, adb, minicap, display, screenOptions) {
var log = logger.createLogger('device:plugins:screen:stream')
log.info('ScreenGrabber option set to %s', options.screenGrabber)
log.info('ScreenFrameRate option set to %d', options.screenFrameRate)
function FrameProducer(config, grabber) {
EventEmitter.call(this)
@@ -230,12 +235,23 @@ module.exports = syrup.serial()
FrameProducer.prototype._startService = function() {
log.info('Launching screen service %s', this.grabber)
return minicap.run(this.grabber, util.format(
'-S -Q %d -P %s'
, options.screenJpegQuality
, this.frameConfig.toString()
))
.timeout(10000)
if (options.screenFrameRate <= 0.0) {
return minicap.run(this.grabber, util.format(
'-S -Q %d -P %s'
, options.screenJpegQuality
, this.frameConfig.toString()
))
.timeout(10000)
}
else {
return minicap.run(this.grabber, util.format(
'-S -r %d -Q %d -P %s'
, options.screenFrameRate
, options.screenJpegQuality
, this.frameConfig.toString()
))
.timeout(10000)
}
}
FrameProducer.prototype._readOutput = function(out) {