mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-html5
synced 2025-12-29 00:15:10 +00:00
HACK: force H.264 with WebCodecs
This commit is contained in:
parent
f279fe81fa
commit
b4474e3d76
@ -197,6 +197,20 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
#login, #Sidenav {
|
||||
display: none;
|
||||
}
|
||||
#spice-screen {
|
||||
xcursor: none ! important;
|
||||
}
|
||||
video {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="login">
|
||||
<button onclick="open_nav()">☰ SPICE</button>
|
||||
|
||||
@ -1204,6 +1204,35 @@ function new_video_cluster(stream, msg)
|
||||
|
||||
function process_video_stream_data(stream, msg)
|
||||
{
|
||||
if (stream.start_time == 0) {
|
||||
const context = document.querySelector("canvas").getContext("2d");
|
||||
const decoder = stream.decoder = new VideoDecoder({
|
||||
output(frame) {
|
||||
context.drawImage(frame, 0, 0, frame.displayWidth, frame.displayHeight);
|
||||
frame.close();
|
||||
},
|
||||
error(v) {
|
||||
console.error(v);
|
||||
},
|
||||
});
|
||||
decoder.configure({
|
||||
codec: "avc1.640028",
|
||||
codedWidth: 1920,
|
||||
codedHeight: 1080,
|
||||
optimizeForLatency: true,
|
||||
avc: {
|
||||
format: "annexb",
|
||||
},
|
||||
});
|
||||
}
|
||||
stream.decoder.decode(
|
||||
new EncodedVideoChunk({
|
||||
timestamp: stream.start_time,
|
||||
type: "key",
|
||||
data: msg.data,
|
||||
})
|
||||
);
|
||||
|
||||
if (stream.start_time == 0)
|
||||
{
|
||||
stream.start_time = msg.base.multi_media_time;
|
||||
|
||||
@ -196,7 +196,7 @@ export var Constants = {
|
||||
SPICE_DISPLAY_CAP_GL_SCANOUT : 7,
|
||||
SPICE_DISPLAY_CAP_MULTI_CODEC : 8,
|
||||
SPICE_DISPLAY_CAP_CODEC_MJPEG : 9,
|
||||
SPICE_DISPLAY_CAP_CODEC_VP8 : 10,
|
||||
SPICE_DISPLAY_CAP_CODEC_VP8 : 11,
|
||||
|
||||
SPICE_AUDIO_DATA_MODE_INVALID : 0,
|
||||
SPICE_AUDIO_DATA_MODE_RAW : 1,
|
||||
@ -332,7 +332,7 @@ export var Constants = {
|
||||
SPICE_CURSOR_TYPE_COLOR32 : 6,
|
||||
|
||||
SPICE_VIDEO_CODEC_TYPE_MJPEG : 1,
|
||||
SPICE_VIDEO_CODEC_TYPE_VP8 : 2,
|
||||
SPICE_VIDEO_CODEC_TYPE_VP8 : 3,
|
||||
|
||||
VD_AGENT_PROTOCOL : 1,
|
||||
VD_AGENT_MAX_DATA_SIZE : 2048,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user