antimof / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.36k stars 186 forks source link

Crashes when a connection is initiated #3

Open alvesvaren opened 4 years ago

alvesvaren commented 4 years ago

When I start the program it crashes after I connected to it with my ios device Console output:

Initialized server socket(s)
*** WARNING *** The program 'uxplay' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Accepted IPv4 client on socket 28
Local: 192.168.1.104
Remote: 192.168.1.73
Accepted IPv4 client on socket 30
Local: 192.168.1.104
Remote: 192.168.1.73
raop_rtp_mirror starting mirroring
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  150 (XVideo)
  Minor opcode of failed request:  19 ()
  Serial number of failed request:  103
  Current serial number in output stream:  104

Any ideas? There isn't even a window that appears when starting it, if that should happen.

distro: Arch Linux de: plasma/kde

antimof commented 4 years ago

I think this problem is caused by gstreamer videosink element in your enviroment. Please send me the output of the following: GST_DEBUG=3 ./uxplay

alvesvaren commented 4 years ago
0:00:00.084508499 23489 0x562241a3d9e0 FIXME                default gstutils.c:3980:gst_pad_create_stream_id_internal:<video_source:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Initialized server socket(s)
*** WARNING *** The program 'uxplay' uses the Apple Bonjour compatibility layer of Avahi.
0:00:00.088860877 23489 0x56224170d800 FIXME                default gstutils.c:3980:gst_pad_create_stream_id_internal:<audio_source:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
Accepted IPv4 client on socket 28
Local: 192.168.1.104
Remote: 192.168.1.73
Accepted IPv4 client on socket 30
Local: 192.168.1.104
Remote: 192.168.1.73
raop_rtp_mirror starting mirroring
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  150 (XVideo)
  Minor opcode of failed request:  19 ()
  Serial number of failed request:  103
  Current serial number in output stream:  104
OmniOrej commented 4 years ago

Hey, first time posting here and I really don't understand much. I had the same error, and got solved. that videosink element, there is one that is cross platform "glimagesink", i was using the linux one and didn't work, here is the command i used, hope it helps

$ gst-launch-1.0 --gst-plugin-load="/home/username/Downloads/libgstairplay.so" airplaysrc ! queue ! h264parse ! avdec_h264 max-threads=1 ! glimagesink

distro: Arch Linux de: plasma/kde

christophfeinauer commented 4 years ago

I had the same problem on 5.7.14-1-MANJARO with

$ pacman -Qn | grep gst
clutter-gst 3.0.27-3
gst-libav 1.16.2-2
gst-plugins-bad 1.16.2-13
gst-plugins-bad-libs 1.16.2-13
gst-plugins-base 1.16.2-2
gst-plugins-base-libs 1.16.2-2
gst-plugins-good 1.16.2-3
gst-plugins-ugly 1.16.2-4
gstreamer 1.16.2-2
lib32-gstreamer 1.16.2-1
lib32-libcanberra-gstreamer 0.30+2+gc0620e4-3
libcanberra-gstreamer 0.30+2+gc0620e4-3
phonon-qt5-gstreamer 4.10.0-2

Seems to be a problem with gstreamer & XVideo since

$ gst-launch-1.0 -v videotestsrc ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstXvImageSink:xvimagesink0.GstPad:sink: caps = video/x-raw, format=(string)YUY2, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  150 (XVideo)
  Minor opcode of failed request:  19 ()
  Serial number of failed request:  70
  Current serial number in output stream:  7

Switching to ximagesink fixes this for me. So after changing the line

renderer->pipeline = gst_parse_launch("appsrc name=video_source stream-type=0 format=GST_FORMAT_TIME is-live=true !"                                                                                                                   
      "queue ! decodebin ! videoconvert ! autovideosink name=video_sink sync=false", &error)

to

renderer->pipeline = gst_parse_launch("appsrc name=video_source stream-type=0 format=GST_FORMAT_TIME is-live=true !"                                                                                                                   
      "queue ! decodebin ! videoconvert ! ximagesink name=video_sink sync=false", &error)

in renderers/video_renderer_gstreamer.c and recompiling everything works.

I am not sure what the origin of that bug is.

nsauk commented 2 years ago

The issue is still reproducible and fix by @christophfeinauer still works. One-liner to add in your PKGBUILD (in build function after first cd):

sed -i 's/autovideosink/ximagesink/' renderers/video_renderer_gstreamer.c