some fixes for ustreamer

This commit is contained in:
Devaev Maxim 2018-09-28 05:06:23 +03:00
parent 8fd196bde8
commit 054f8e44db
8 changed files with 37 additions and 21 deletions

View File

@ -44,7 +44,7 @@ kvmd:
- "--tv-standard=pal" - "--tv-standard=pal"
- "--format=yuyv" - "--format=yuyv"
- "--encoder=cpu" - "--encoder=cpu"
- "--jpeg-quality={quality}" - "--quality={quality}"
- "--width=720" - "--width=720"
- "--height=576" - "--height=576"
- "--fake-width=800" - "--fake-width=800"

View File

@ -36,14 +36,14 @@ kvmd:
init_restart_after: 0.0 init_restart_after: 0.0
shutdown_delay: 10.0 shutdown_delay: 10.0
quality: 80 quality: 20
cmd: cmd:
- "/usr/bin/ustreamer" - "/usr/bin/ustreamer"
- "--device=/dev/kvmd-streamer" - "--device=/dev/kvmd-streamer"
- "--format=uyvy" - "--format=uyvy"
- "--encoder=omx" - "--encoder=omx"
- "--jpeg-quality={quality}" - "--quality={quality}"
- "--dv-timings" - "--dv-timings"
- "--host=localhost" - "--host=localhost"
- "--port=8082" - "--port=8082"

View File

@ -9,6 +9,7 @@ error_log /dev/null crit;
events { events {
worker_connections 1024; worker_connections 1024;
use epoll; use epoll;
multi_accept on;
} }
http { http {
@ -19,6 +20,8 @@ http {
charset utf-8; charset utf-8;
sendfile on; sendfile on;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 10; keepalive_timeout 10;
client_body_temp_path /tmp/nginx.client_body_temp; client_body_temp_path /tmp/nginx.client_body_temp;
@ -116,6 +119,7 @@ http {
rewrite /streamer/?(.*) /$1 break; rewrite /streamer/?(.*) /$1 break;
proxy_pass http://ustreamer; proxy_pass http://ustreamer;
include /etc/nginx/proxy-params.conf; include /etc/nginx/proxy-params.conf;
postpone_output 0;
proxy_buffering off; proxy_buffering off;
proxy_ignore_headers X-Accel-Buffering; proxy_ignore_headers X-Accel-Buffering;
} }

View File

@ -27,14 +27,19 @@ RUN useradd -r -d / packer \
&& cd - \ && cd - \
&& rm -rf /tmp/packer-color && rm -rf /tmp/packer-color
COPY testenv/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-ndk
COPY testenv/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
RUN pacman -Syy \ RUN pacman -Syy \
&& user-packer -S --noconfirm \
customizepkg \
&& user-packer -S --noconfirm \ && user-packer -S --noconfirm \
python \ python \
python-pip \ python-pip \
nginx-mainline \ nginx-mainline \
nginx-mainline-mod-lua \
ustreamer \ ustreamer \
socat \ socat \
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
&& pacman -Sc --noconfirm && pacman -Sc --noconfirm
COPY testenv/requirements.txt requirements.txt COPY testenv/requirements.txt requirements.txt

View File

@ -0,0 +1 @@
replace#global#_nginxver=.*#_nginxver=`pacman -Q nginx-mainline | grep -Po "\\d+\\.\\d+\\.\\d+"`

View File

@ -41,7 +41,7 @@ kvmd:
cmd: cmd:
- "/usr/bin/ustreamer" - "/usr/bin/ustreamer"
- "--device=/dev/kvmd-streamer" - "--device=/dev/kvmd-streamer"
- "--jpeg-quality={quality}" - "--quality={quality}"
- "--width=800" - "--width=800"
- "--height=600" - "--height=600"
- "--host=0.0.0.0" - "--host=0.0.0.0"

View File

@ -76,9 +76,7 @@
<hr> <hr>
<div data-dont-hide-menu class="ctl-dropdown-content-text"> <div data-dont-hide-menu class="ctl-dropdown-content-text">
Quality: Quality:
<select disabled id="stream-quality-select"> <select disabled id="stream-quality-select"></select>
<option>80%</option>
</select>
</div> </div>
<hr> <hr>
<div data-dont-hide-menu class="ctl-dropdown-content-text"> <div data-dont-hide-menu class="ctl-dropdown-content-text">

View File

@ -5,7 +5,7 @@ function Stream() {
var __prev_state = false; var __prev_state = false;
var __quality = 80; var __quality = 10;
var __normal_size = {width: 640, height: 480}; var __normal_size = {width: 640, height: 480};
var __size_factor = 1; var __size_factor = 1;
@ -14,6 +14,7 @@ function Stream() {
$("stream-led").title = "Stream inactive"; $("stream-led").title = "Stream inactive";
var quality = 10; var quality = 10;
$("stream-quality-select").innerHTML = "";
for (; quality <= 100; quality += 10) { for (; quality <= 100; quality += 10) {
$("stream-quality-select").innerHTML += "<option value=\"" + quality + "\">" + quality + "%</option>"; $("stream-quality-select").innerHTML += "<option value=\"" + quality + "\">" + quality + "%</option>";
} }
@ -34,7 +35,7 @@ function Stream() {
var http = tools.makeRequest("GET", "/streamer/ping", function() { var http = tools.makeRequest("GET", "/streamer/ping", function() {
if (http.readyState === 4) { if (http.readyState === 4) {
var response = (http.status === 200 ? JSON.parse(http.responseText) : null); var response = (http.status === 200 ? JSON.parse(http.responseText) : null);
if (http.status !== 200 || !response.stream.online) { if (http.status !== 200) {
tools.info("Refreshing stream ..."); tools.info("Refreshing stream ...");
__prev_state = false; __prev_state = false;
$("stream-image").className = "stream-image-inactive"; $("stream-image").className = "stream-image-inactive";
@ -43,7 +44,13 @@ function Stream() {
$("stream-led").title = "Stream inactive"; $("stream-led").title = "Stream inactive";
$("stream-reset-button").disabled = true; $("stream-reset-button").disabled = true;
$("stream-quality-select").disabled = true; $("stream-quality-select").disabled = true;
} else if (http.status === 200 && !__prev_state) { } else if (http.status === 200) {
if (__prev_state) {
if (__normal_size != response.stream.resolution) {
__normal_size = response.stream.resolution;
__applySizeFactor();
}
} else {
__normal_size = response.stream.resolution; __normal_size = response.stream.resolution;
__refreshImage(); __refreshImage();
__prev_state = true; __prev_state = true;
@ -55,8 +62,9 @@ function Stream() {
$("stream-quality-select").disabled = false; $("stream-quality-select").disabled = false;
} }
} }
}
}); });
setTimeout(__startPoller, 1500); setTimeout(__startPoller, 1000);
}; };
var __clickResetButton = function() { var __clickResetButton = function() {