mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
some fixes for ustreamer
This commit is contained in:
parent
8fd196bde8
commit
054f8e44db
@ -44,7 +44,7 @@ kvmd:
|
||||
- "--tv-standard=pal"
|
||||
- "--format=yuyv"
|
||||
- "--encoder=cpu"
|
||||
- "--jpeg-quality={quality}"
|
||||
- "--quality={quality}"
|
||||
- "--width=720"
|
||||
- "--height=576"
|
||||
- "--fake-width=800"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
1
testenv/customizepkg.nginx
Normal file
1
testenv/customizepkg.nginx
Normal file
@ -0,0 +1 @@
|
||||
replace#global#_nginxver=.*#_nginxver=`pacman -Q nginx-mainline | grep -Po "\\d+\\.\\d+\\.\\d+"`
|
||||
@ -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"
|
||||
|
||||
@ -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">
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user