[Spice-devel] [PATCH v9 00/24] Add GStreamer support for video streaming
Uri Lublin
uril at redhat.com
Wed Feb 3 11:34:44 CET 2016
On 01/18/2016 01:03 PM, Francois Gouget wrote:
>
> The source changed so here is the new revision of this patchset.
>
> This patch series adds support for using GStreamer to encode and decode
> the video streams, adding support for VP8 and h264 codecs. As before the
> patches can also be grabbed from the repositories below:
Hi,
I've tried testing this patch-set with qemu-kvm.
I wrote a patch for qemu-kvm to enable this feature, see at the bottom.
I found it working with spice:mjpeg but hangs with gstreamer:vp8 codec.
I do not have x264 installed.
if I set video-codecs to "gstreamer:h264;spice:mjpeg" and also with
gstreamer:h264 it falls back to spice:mjpeg.
With gstreamer:mjpeg it also fallbacks to spice:mjpeg with the following
error:
Spice-Debug **: gstreamer-encoder.c:795:create_pipeline: GStreamer
pipeline: appsrc name=src format=2 do-timestamp=true ! videoconvert !
avenc_mjpeg name=encoder ! appsink name=sink
Spice-Warning **: gstreamer-encoder.c:799:create_pipeline: GStreamer
error: no element "avenc_mjpeg"
When running with "gstreamer:vp8;spice:mjpeg" I see the following
spice-server warnings:
((null):17523): Spice-Debug **: gstreamer-encoder.c:795:create_pipeline:
GStreamer pipeline: appsrc name=src format=2 do-timestamp=true !
videoconvert ! vp8enc name=encoder ! appsink name=sink
((null):17523): Spice-Debug **:
stream.c:454:display_channel_create_stream: stream 49 511x20 (5, 703)
(516, 723) 30 fps
((null):17523): Spice-Debug **: stream.c:333:before_reattach_stream:
ignoring drop, same process_commands_generation as previous frame
and later
((null):17523): Spice-Debug **:
gstreamer-encoder.c:1282:spice_gst_encoder_encode_frame: video format
change: width 0 -> 516, height 0 -> 25, format 0 -> 8
((null):17523): Spice-Warning **: gstreamer-encoder.c:726:map_format:
The 8 format has not been tested yet
((null):17523): Spice-Debug **:
gstreamer-encoder.c:862:set_gstenc_bitrate: setting the GStreamer
target-bitrate to 0
((null):17523): Spice-Debug **:
gstreamer-encoder.c:939:configure_pipeline: setting state to PLAYING
Attaching with gdb: I see the following threads:
(gdb) info threads
Id Target Id Frame
13 Thread 0x7f763d1bb700 (LWP 17524) "qemu-system-x86"
0x00007f76477cdc59 in syscall () from /lib64/libc.so.6
12 Thread 0x7f763b5bb700 (LWP 17531) "qemu-system-x86"
0x00007f7647aa1045 in do_futex_wait () from /lib64/libpthread.so.0
11 Thread 0x7f763aab7700 (LWP 17532) "qemu-system-x86"
0x00007f76477c9707 in ioctl () from /lib64/libc.so.6
10 Thread 0x7f7639dff700 (LWP 17533) "qemu-system-x86"
0x00007f76477cdc59 in syscall () from /lib64/libc.so.6
9 Thread 0x7f759ffff700 (LWP 17579) "src:src" 0x00007f76477cdc59
in syscall () from /lib64/libc.so.6
8 Thread 0x7f759f7fe700 (LWP 17580) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
7 Thread 0x7f759effd700 (LWP 17581) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
6 Thread 0x7f759e7fc700 (LWP 17582) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
5 Thread 0x7f759dffb700 (LWP 17583) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
4 Thread 0x7f759d7fa700 (LWP 17584) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
3 Thread 0x7f759cff9700 (LWP 17585) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
2 Thread 0x7f7597fff700 (LWP 17586) "src:src" 0x00007f7647aa0e57
in do_futex_wait.constprop () from /lib64/libpthread.so.0
* 1 Thread 0x7f764d78cbc0 (LWP 17523) "qemu-system-x86"
0x00007f76477c80a1 in ppoll () from /lib64/libc.so.6
(gdb) thread 8
[Switching to thread 8 (Thread 0x7f759f7fe700 (LWP 17580))]
#0 0x00007f7647aa0e57 in do_futex_wait.constprop () from
/lib64/libpthread.so.0
(gdb) bt
#0 0x00007f7647aa0e57 in do_futex_wait.constprop () at
/lib64/libpthread.so.0
#1 0x00007f7647aa0f04 in __new_sem_wait_slow.constprop.0 () at
/lib64/libpthread.so.0
#2 0x00007f7647aa0faa in sem_wait@@GLIBC_2.2.5 () at /lib64/libpthread.so.0
#3 0x00007f75ac63ee41 in thread_encoding_proc () at /lib64/libvpx.so.2
#4 0x00007f7647a9960a in start_thread () at /lib64/libpthread.so.0
#5 0x00007f76477d3a4d in clone () at /lib64/libc.so.6
(gdb) detach
---
From 4a29ad1422971e10f560ef95a1646ffa4dbac7a4 Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril at redhat.com>
Date: Thu, 14 Jan 2016 17:23:08 +0200
Subject: [PATCH] spice: add video-codecs option
Starting with spice-0.12.7 some video codecs in addition
to mjpeg.
Signed-off-by: Uri Lublin <uril at redhat.com>
---
qemu-options.hx | 6 ++++++
ui/spice-core.c | 22 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
index 215d00d..70024ce 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1051,6 +1051,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,
" [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"
" [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"
" [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"
+ " [,video-codecs=list-of-codecs]\n"
" enable spice\n"
" at least one of {port, tls-port} is mandatory\n",
QEMU_ARCH_ALL)
@@ -1142,6 +1143,11 @@ Enable/disable audio stream compression (using
celt 0.5.1). Default is on.
@item seamless-migration=[on|off]
Enable/disable spice seamless migration. Default is off.
+ at item video-codecs=list-of-codecs]
+Set spice video codecs. The list items are separated by semicolons (;)
+Current supported codecs are spice:mjpeg gstreamer:[mjpeg|v8|h264]
+Default is spice:mjpeg
+
@end table
ETEXI
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 6a62d71..769d162 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -496,6 +496,9 @@ static QemuOptsList qemu_spice_opts = {
}, {
.name = "seamless-migration",
.type = QEMU_OPT_BOOL,
+ }, {
+ .name = "video-codecs",
+ .type = QEMU_OPT_STRING,
},
{ /* end of list */ }
},
@@ -794,6 +797,25 @@ void qemu_spice_init(void)
seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);
spice_server_set_seamless_migration(spice_server, seamless_migration);
+
+ str = qemu_opt_get(opts, "video-codecs");
+ #if SPICE_SERVER_VERSION >= 0x000c07 /* 0.12.7 */
+ if (str) {
+ if (spice_server_set_video_codecs(spice_server, str)) {
+ error_report("spice: invalid video encoder %s", str);
+ exit(1);
+ }
+ } else {
+ spice_server_set_video_codecs(spice_server, "spice:mjpeg");
+ }
+#else
+ if (str) {
+ error_report("this qemu build does not support the "
+ "\"video-codecs\" option");
+ exit(1);
+ }
+#endif
+
if (spice_server_init(spice_server, &core_interface) != 0) {
error_report("failed to initialize spice server");
exit(1);
--
2.5.0
More information about the Spice-devel
mailing list