diff options
-rw-r--r-- | configs/kvmd/v1.yaml | 2 | ||||
-rw-r--r-- | configs/kvmd/v2.yaml | 4 | ||||
-rw-r--r-- | configs/nginx/nginx.conf | 4 | ||||
-rw-r--r-- | testenv/Dockerfile | 7 | ||||
-rw-r--r-- | testenv/customizepkg.nginx | 1 | ||||
-rw-r--r-- | testenv/kvmd.yaml | 2 | ||||
-rw-r--r-- | web/index.html | 4 | ||||
-rw-r--r-- | web/js/stream.js | 34 |
8 files changed, 37 insertions, 21 deletions
diff --git a/configs/kvmd/v1.yaml b/configs/kvmd/v1.yaml index a5eb0749..e7d858d3 100644 --- a/configs/kvmd/v1.yaml +++ b/configs/kvmd/v1.yaml @@ -44,7 +44,7 @@ kvmd: - "--tv-standard=pal" - "--format=yuyv" - "--encoder=cpu" - - "--jpeg-quality={quality}" + - "--quality={quality}" - "--width=720" - "--height=576" - "--fake-width=800" diff --git a/configs/kvmd/v2.yaml b/configs/kvmd/v2.yaml index 09c4eb33..9dedb630 100644 --- a/configs/kvmd/v2.yaml +++ b/configs/kvmd/v2.yaml @@ -36,14 +36,14 @@ kvmd: init_restart_after: 0.0 shutdown_delay: 10.0 - quality: 80 + quality: 20 cmd: - "/usr/bin/ustreamer" - "--device=/dev/kvmd-streamer" - "--format=uyvy" - "--encoder=omx" - - "--jpeg-quality={quality}" + - "--quality={quality}" - "--dv-timings" - "--host=localhost" - "--port=8082" diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf index f0d6965b..a06ced1b 100644 --- a/configs/nginx/nginx.conf +++ b/configs/nginx/nginx.conf @@ -9,6 +9,7 @@ error_log /dev/null crit; events { worker_connections 1024; use epoll; + multi_accept on; } http { @@ -19,6 +20,8 @@ http { charset utf-8; sendfile on; + tcp_nodelay on; + tcp_nopush on; keepalive_timeout 10; client_body_temp_path /tmp/nginx.client_body_temp; @@ -116,6 +119,7 @@ http { rewrite /streamer/?(.*) /$1 break; proxy_pass http://ustreamer; include /etc/nginx/proxy-params.conf; + postpone_output 0; proxy_buffering off; proxy_ignore_headers X-Accel-Buffering; } diff --git a/testenv/Dockerfile b/testenv/Dockerfile index db7e6538..6a16cf77 100644 --- a/testenv/Dockerfile +++ b/testenv/Dockerfile @@ -27,14 +27,19 @@ RUN useradd -r -d / packer \ && cd - \ && 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 \ && user-packer -S --noconfirm \ + customizepkg \ + && user-packer -S --noconfirm \ python \ python-pip \ nginx-mainline \ - nginx-mainline-mod-lua \ ustreamer \ socat \ + && env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \ && pacman -Sc --noconfirm COPY testenv/requirements.txt requirements.txt diff --git a/testenv/customizepkg.nginx b/testenv/customizepkg.nginx new file mode 100644 index 00000000..5e7db5a4 --- /dev/null +++ b/testenv/customizepkg.nginx @@ -0,0 +1 @@ +replace#global#_nginxver=.*#_nginxver=`pacman -Q nginx-mainline | grep -Po "\\d+\\.\\d+\\.\\d+"` diff --git a/testenv/kvmd.yaml b/testenv/kvmd.yaml index a94dcb2b..4b1a05cc 100644 --- a/testenv/kvmd.yaml +++ b/testenv/kvmd.yaml @@ -41,7 +41,7 @@ kvmd: cmd: - "/usr/bin/ustreamer" - "--device=/dev/kvmd-streamer" - - "--jpeg-quality={quality}" + - "--quality={quality}" - "--width=800" - "--height=600" - "--host=0.0.0.0" diff --git a/web/index.html b/web/index.html index 90fbd11e..4fd108b0 100644 --- a/web/index.html +++ b/web/index.html @@ -76,9 +76,7 @@ <hr> <div data-dont-hide-menu class="ctl-dropdown-content-text"> Quality: - <select disabled id="stream-quality-select"> - <option>80%</option> - </select> + <select disabled id="stream-quality-select"></select> </div> <hr> <div data-dont-hide-menu class="ctl-dropdown-content-text"> diff --git a/web/js/stream.js b/web/js/stream.js index af3e45e9..18907788 100644 --- a/web/js/stream.js +++ b/web/js/stream.js @@ -5,7 +5,7 @@ function Stream() { var __prev_state = false; - var __quality = 80; + var __quality = 10; var __normal_size = {width: 640, height: 480}; var __size_factor = 1; @@ -14,6 +14,7 @@ function Stream() { $("stream-led").title = "Stream inactive"; var quality = 10; + $("stream-quality-select").innerHTML = ""; for (; quality <= 100; quality += 10) { $("stream-quality-select").innerHTML += "<option value=\"" + quality + "\">" + quality + "%</option>"; } @@ -34,7 +35,7 @@ function Stream() { var http = tools.makeRequest("GET", "/streamer/ping", function() { if (http.readyState === 4) { 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 ..."); __prev_state = false; $("stream-image").className = "stream-image-inactive"; @@ -43,20 +44,27 @@ function Stream() { $("stream-led").title = "Stream inactive"; $("stream-reset-button").disabled = true; $("stream-quality-select").disabled = true; - } else if (http.status === 200 && !__prev_state) { - __normal_size = response.stream.resolution; - __refreshImage(); - __prev_state = true; - $("stream-image").className = "stream-image-active"; - $("stream-box").classList.remove("stream-box-inactive"); - $("stream-led").className = "led-on"; - $("stream-led").title = "Stream is active"; - $("stream-reset-button").disabled = false; - $("stream-quality-select").disabled = false; + } 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; + __refreshImage(); + __prev_state = true; + $("stream-image").className = "stream-image-active"; + $("stream-box").classList.remove("stream-box-inactive"); + $("stream-led").className = "led-on"; + $("stream-led").title = "Stream is active"; + $("stream-reset-button").disabled = false; + $("stream-quality-select").disabled = false; + } } } }); - setTimeout(__startPoller, 1500); + setTimeout(__startPoller, 1000); }; var __clickResetButton = function() { |