FDH2 / UxPlay

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

choppy audio #20

Closed spicemint closed 2 years ago

spicemint commented 2 years ago

installing on ubuntu 16.04 but with nvidia card, removed gstreamer1.0-vaapi Linux SAT 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Video works perfect now, audio is also coming but it is choppy and high pitched, sounds like everyone in haled a bunch of helium, maybe also slightly too fast. Saw that on the rpi version someone had similar problem but those options are not available for this version, but I also installed the RPiPlay on ubuntu, which works, when using the options as mentioned in the referred post, still choppy

debug output uxplay -d -vs ximagesink -s 1920x1080@60 using randomly-generated MAC address 5e:2d:6b:c3:67:3f

Initialized server socket(s) Accepted IPv4 client on socket 31 Local: 10.0.0.96 Remote: 10.0.0.64 Open connections: 1 httpd receiving on socket 31 conn_request Handling request GET with URL /info INFO len = -974112740 httpd receiving on socket 31 conn_request Handling request POST with URL /pair-setup httpd receiving on socket 31 conn_request Handling request POST with URL /pair-verify httpd receiving on socket 31 conn_request Handling request POST with URL /pair-verify httpd receiving on socket 31 conn_request Handling request POST with URL /fp-setup httpd receiving on socket 31 conn_request Handling request POST with URL /fp-setup httpd receiving on socket 31 conn_request Handling request SETUP with URL rtsp://10.0.0.96/10433250987669012610 DACP-ID: FFF8EDD66112E8C9 Active-Remote: 67052714 Transport: null SETUP 1 eiv_len = 16 ekey_len = 72 fairplay_decrypt ret = 0 timing_rport = 61480 raop_ntp parse remote ip = 10.0.0.64 raop_ntp starting time raop_ntp local timing port socket 32 port UDP 46878 raop_rtp parse remote ip = 10.0.0.64 raop_rtp_mirror parse remote ip = 10.0.0.64 eport = 43047, tport = 46878 raop_ntp send_len = 32 raop_ntp receive time type_t packetlen = 32 raop_ntp sync correction = -1633034736060039 Accepted IPv4 client on socket 33 Local: 10.0.0.96 Remote: 10.0.0.64 Open connections: 2 httpd receiving on socket 31 conn_request Handling request GET with URL /info INFO len = -974112740 httpd receiving on socket 31 conn_request Handling request GET_PARAMETER with URL rtsp://10.0.0.96/10433250987669012610 httpd receiving on socket 31 conn_request Handling request RECORD with URL rtsp://10.0.0.96/10433250987669012610 raop_handler_record httpd receiving on socket 31 conn_request Handling request SET_PARAMETER with URL rtsp://10.0.0.96/10433250987669012610 httpd receiving on socket 31 conn_request Handling request SETUP with URL rtsp://10.0.0.96/10433250987669012610 DACP-ID: FFF8EDD66112E8C9 Active-Remote: 67052714 Transport: null type = 110 streamConnectionID = 17152997732226384888 raop_rtp_mirror starting mirroring raop_rtp_mirror local data port socket 34 port TCP 33862 Mirroring initialized successfully raop_rtp_mirror accepting client raop_rtp_mirror width_source = 1440.000000 height_source = 1080.000000 width = 1440.000000 height = 1080.000000 raop_rtp_mirror sps size = 18 raop_rtp_mirror pps size = 4 raop_rtp_mirror video ntp = 1633614429535841, now = 1633614429488758, latency = -47083 raop_rtp_mirror video ntp = 1633614429569176, now = 1633614429501917, latency = -67259 raop_rtp_mirror video ntp = 1633614429594177, now = 1633614429530584, latency = -63593 raop_rtp_mirror video ntp = 1633614429619179, now = 1633614429551446, latency = -67733 raop_rtp_mirror video ntp = 1633614429635845, now = 1633614429594381, latency = -41464 raop_rtp_mirror video ntp = 1633614429677515, now = 1633614429610596, latency = -66919 raop_rtp_mirror video ntp = 1633614429735851, now = 1633614429739675, latency = 3824 -----------------------------------(cut)---------------------------- raop_rtp audio: ntp = 1633614438837652, now = 1633614438478403, latency=-359249, rtp=694333607 raop_rtp audio: ntp = 1633614438848537, now = 1633614438478410, latency=-370127, rtp=694334087 raop_rtp_mirror video ntp = 1633614438565036, now = 1633614438485304, latency = -79732 httpd receiving on socket 31 conn_request Handling request TEARDOWN with URL rtsp://10.0.0.96/10433250987669012610 raop_rtp exiting thread httpd receiving on socket 31 conn_request Handling request SET_PARAMETER with URL rtsp://10.0.0.96/10433250987669012610 raop_rtp_mirror video ntp = 1633614438615038, now = 1633614438540802, latency = -74236 raop_rtp_mirror width_source = 1440.000000 height_source = 1080.000000 width = 1440.000000 height = 1080.000000 raop_rtp_mirror sps size = 18 raop_rtp_mirror pps size = 4 raop_rtp_mirror tcp socket closed httpd receiving on socket 31 conn_request Handling request TEARDOWN with URL rtsp://10.0.0.96/10433250987669012610 raop_rtp_mirror exiting TCP thread httpd receiving on socket 31 conn_request Handling request TEARDOWN with URL rtsp://10.0.0.96/10433250987669012610 httpd receiving on socket 33 Connection closed for socket 33 Destroying connection Open connections: 1 httpd receiving on socket 31 Connection closed for socket 31 Destroying connection Open connections: 0 raop_ntp stopping time thread raop_ntp exiting thread raop_ntp stopped time thread ^CStopping... Exiting HTTP thread

fduncanh commented 2 years ago

_installing on ubuntu 16.04 but with nvidia card, removed gstreamer1.0-vaapi Linux SAT 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x8664 GNU/Linux

Video works perfect now, audio is also coming but it is choppy and high pitched, sounds like everyone in haled a bunch of helium, maybe also slightly too fast. Saw that on the rpi version someone had similar problem but those options are not available for this version, but I also installed the RPiPlay on ubuntu, which works, when using the options as mentioned in the referred post, still choppy

what kind of machines is this running on? what kind of audio?

Is uxplay also choppy on ubuntu? On the same machine as a dual boot, or some other machine?

is it a really old machine?

I believe the RPiPlay reports you mention are about running on RPi with RPi renderers, not with gstreamer.

The audio pipeline in renderers/audio_renderer_gstreamer.c ends in autoaudiosink. you could edit this and recompile to investigate whether substitution of "autoaudiosink" by some other GStreamer audiosink improves things.

If it does I could add a -as option for audiosink choice like -vs for videosink choice

spicemint commented 2 years ago

_installing on ubuntu 16.04 but with nvidia card, removed gstreamer1.0-vaapi Linux SAT 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x8664 GNU/Linux

Video works perfect now, audio is also coming but it is choppy and high pitched, sounds like everyone in haled a bunch of helium, maybe also slightly too fast. Saw that on the rpi version someone had similar problem but those options are not available for this version, but I also installed the RPiPlay on ubuntu, which works, when using the options as mentioned in the referred post, still choppy

what kind of machines is this running on? what kind of audio?

Is uxplay also choppy on ubuntu? On the same machine as a dual boot, or some other machine?

is it a really old machine?

I believe the RPiPlay reports you mention are about running on RPi with RPi renderers, not with gstreamer.

The audio pipeline in renderers/audio_renderer_gstreamer.c ends in autoaudiosink. you could edit this and recompile to investigate whether substitution of "autoaudiosink" by some other GStreamer audiosink improves things.

If it does I could add a -as option for audiosink choice like -vs for videosink choice

I have on pc with a ryzen 5 1600 cpu and asus TUF B450M-PRO mainboard and nvidia video card, so not really an old machine, though I run ubuntu 16.04 on it. There is no other operating system on this machine.

I installed UxPlay on this machine and for the fun of it also RPiPlay, both behave the same in regards to the audio issue. (I also have a pi3 with RPiPlay, which works fine for audio and video).

With RpiPlay you seem to be able to switch between different renderers: "-ar renderer: Select an audio renderer to use (rpi, gstreamer, or dummy)"

I'm using the vga out of the video card to connect to tv and the audio out from the mainboard (so not hdmi from video card)

08:00.3 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) HD Audio Controller Subsystem: ASUSTeK Computer Inc. Device 8796 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- SERR- <PERR- INTx- Latency: 0, Cache Line Size: 64 bytes Interrupt: pin C routed to IRQ 61 Region 0: Memory at f6800000 (32-bit, non-prefetchable) [size=32K] Capabilities: [48] Vendor Specific Information: Len=08 <?> Capabilities: [50] Power Management version 3 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- Capabilities: [64] Express (v2) Endpoint, MSI 00 DevCap:MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- DevCtl:Report errors: Correctable- Non-Fatal- Fatal- Unsupported- RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+ MaxPayload 256 bytes, MaxReadReq 512 bytes DevSta:CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend- LnkCap:Port #0, Speed 8GT/s, Width x16, ASPM L0s L1, Exit Latency L0s <64ns, L1 <1us ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+ LnkCtl:ASPM Disabled; RCB 64 bytes Disabled- CommClk+ ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt- LnkSta:Speed 8GT/s, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt- DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR-, OBFF Not Supported DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1- EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest- Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Address: 00000000fee02000 Data: 4035 Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?> Capabilities: [150 v2] Advanced Error Reporting UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol- UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol- UESvrt:DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol- CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+ CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+ AERCap:First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn- Capabilities: [2a0 v1] Access Control Services ACSCap:SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans- ACSCtl:SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans- Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel

hm I'm not sure on how/ to what/in what way to edit the renderers/audio_renderer_gstreamer.c as you suggest (I'm not very techie or let's say i'm still a beginner) but will see what I can do with it and play around, thank you so far :)

fduncanh commented 2 years ago

UxPlay 1.38 has new option -as audiosink

try uxplay -as pulsesink (for pulse audio) uxplay -as alsasink (alsa audio)

or osssink (oss audio) oss4sink (oss4 audio) depending on what your audio system is.

fduncanh commented 2 years ago

please also post the output of ldd uxplay

fduncanh commented 2 years ago

This is very unlikely to be the cause, but have you upgraded to the very recent OpenSSL 3.0.0? Some change in this new major release of OpenSSL (with a GPLv3 compatible license, at last) makes the audio choppy ...

spicemint commented 2 years ago

UxPlay 1.38 has new option -as audiosink

try uxplay -as pulsesink (for pulse audio) uxplay -as alsasink (alsa audio)

or osssink (oss audio) oss4sink (oss4 audio) depending on what your audio system is.

upgraded to 1.38 and tried: uxplay -as pulsesink (for pulse audio) uxplay -as alsasink (alsa audio)

both give audio but still same issue, choppy, also tried: osssink (oss audio) oss4sink (oss4 audio)

had no audio come out at all with neither.

spicemint commented 2 years ago

This is very unlikely to be the cause, but have you upgraded to the very recent OpenSSL 3.0.0? Some change in this new major release of OpenSSL (with a GPLv3 compatible license, at last) makes the audio choppy ...

current openssl version is 1.1.1 I have for now setup a pi that works very nicely, I'm not going to be on location to run more test and be able to see/hear the results, thus closing the issue for now, thanks for the support! :)