wenxin-wang / PulseDroidRtp

Receive and play PulseAudio RTP stream on Android
48 stars 2 forks source link

Crash after tapping play #7

Closed garywill closed 3 years ago

garywill commented 3 years ago

Android 9 arm v7 32 bit App version 1.0.3 I inputed IP and port, left MTU or other options default. Tapped "play", lines of texts appeared on the top of UI, then crashed

No matter what IP or random IP I inputed, same result. I think this crashing problem is not related to pulseaudio or any network stream

msg: Native crash: Aborted
stacktrace: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
AospExtended Version: 'v6.5'

Revision: '12'
ABI: 'arm'
pid: 11969, tid: 12007, name: g.pulsedroidrtp  >>> me.wenxinwang.pulsedroidrtp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '/buildbot/src/googleplex-android/ndk-release-r20/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type std::__ndk1::system_error: bind: Cannot assign requested address" failed'
    r0  00000000  r1  00002ee7  r2  00000006  r3  00000008
    r4  00002ec1  r5  00002ee7  r6  9d302364  r7  0000010c
    r8  9d38dd39  r9  aa8ca570  r10 9d3028d0  r11 aa8ca57d
    ip  00000041  sp  9d302350  lr  b302d225  pc  b3024f4e

backtrace:
    #00 pc 0001cf4e  /system/lib/libc.so (abort+58)
    #01 pc 0001d1b7  /system/lib/libc.so (__assert2+22)
    #02 pc 0008de69  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so
    #03 pc 0008df69  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so
    #04 pc 0008c509  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so
    #05 pc 0008beb7  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so
    #06 pc 0008be7f  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so (__cxa_throw+74)
    #07 pc 00056823  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so (_ZN4asio12basic_socketINS_2ip3udpENS_9execution12any_executorIJNS3_12context_as_tIRNS_17execution_contextEEENS3_6detail8blocking7never_tILi0EEENS3_11prefer_onlyINSA_10possibly_tILi0EEEEENSD_INS9_16outstanding_work9tracked_tILi0EEEEENSD_INSH_11untracked_tILi0EEEEENSD_INS9_12relationship6fork_tILi0EEEEENSD_INSO_14continuation_tILi0EEEEEEEEE4bindERKNS1_14basic_endpointIS2_EE+134)
    #08 pc 000563e3  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so (RtpReceiveThread::Restart()+538)
    #09 pc 0005e763  /data/app/me.wenxinwang.pulsedroidrtp-Z1kXw0PYxwe57WXsHEZtbg==/lib/arm/libpulsedroid-rtp.so
    #10 pc 00064ba3  /system/lib/libc.so (__pthread_start(void*)+22)
    #11 pc 0001e165  /system/lib/libc.so (__start_thread+32)
wenxin-wang commented 3 years ago

Thank you for the report! If possible, could you paste the output of adb logcat | grep -i PULSE_RTP_OBOE_ENGINE here?

This may be the same crash as in #2, and hopefully we can have enough clue to solve the problem this time.

wenxin-wang commented 3 years ago

Oh, I just realized that the name of the IP and Port field is quite ambiguous. What should go there is the listening address and port of your APP, not that of your server. Maybe this is the cause? You can use 0.0.0.0 for IP if you are confused.

garywill commented 3 years ago

Random IP:

01-30 18:46:26.004 12447 17791 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 1
01-30 18:46:26.004 12447 17791 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-30 18:46:26.004 12447 17791 E PULSE_RTP_OBOE_ENGINE: Restart
01-30 18:46:26.009 12447 17791 I PULSE_RTP_OBOE_ENGINE: Listening on 1.9.8.9 1.9.8.9:4010
01-30 18:46:26.016 12447 12447 I PULSE_RTP_OBOE_ENGINE: Open stream, c:384 s:1 p:12 b:192
01-30 18:46:26.171 12447 17792 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 0
01-30 18:46:26.171 12447 17792 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-30 18:46:26.172 12447 17792 E PULSE_RTP_OBOE_ENGINE: Enter state 0 -> 3 2

crash

IP 0.0.0.0

01-30 18:48:05.364 17848 17896 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 0
01-30 18:48:05.377 17848 17848 I PULSE_RTP_OBOE_ENGINE: Open stream, c:384 s:1 p:12 b:192
01-30 18:48:05.372 17848 17896 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-30 18:48:05.389 17848 17896 E PULSE_RTP_OBOE_ENGINE: Restart
01-30 18:48:05.389 17848 17896 I PULSE_RTP_OBOE_ENGINE: Listening on 0.0.0.0 0.0.0.0:4010
01-30 18:48:05.389 17848 17896 I PULSE_RTP_OBOE_ENGINE: Start Receiving
01-30 18:48:05.460 17848 17897 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 1
01-30 18:48:05.460 17848 17897 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-30 18:48:05.460 17848 17897 E PULSE_RTP_OBOE_ENGINE: Enter state 0 -> 3 2
01-30 18:48:15.398 17848 17896 E PULSE_RTP_OBOE_ENGINE: Is Idle Now

didn't crash ( but didn't receive any sound. Not sure if it's about my LAN router's broadcast policy)

wenxin-wang commented 3 years ago

Please don't set a random IP. It must be one of: 0.0.0.0, the exact ip of your android device, or a IPv4 multicast address.

If the app is not receiving any sound (and you can see the last log says it's idle now), this means that the app is not receiving any data from your pulseaudio server. The reason is mostly likely that your server has been configured to stream audio data to a different IP or a different port. Please give my settings in README.md a try: first setup pulseaudio server according to the readme, and then in the app set 224.0.0.56 as IP, 4010 as port, 320 as mtu, 2 as channel.

garywill commented 3 years ago

setup pulseaudio server according to the readme,

that's what I did.

in the app set 224.0.0.56 as IP

began to receive data after setting that. I didn't recognize the "IP" in app is listening IP and didn't understand broadcasting IP correctly.

I see network speed on Linux and Android both, but still no sound playing from phone

01-31 09:55:56.539  8637  8890 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 0
01-31 09:55:56.539  8637  8890 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-31 09:55:56.539  8637  8890 E PULSE_RTP_OBOE_ENGINE: Restart
01-31 09:55:56.540  8637  8890 I PULSE_RTP_OBOE_ENGINE: Listening on 224.0.0.56 0.0.0.0:4010
01-31 09:55:56.541  8637  8890 I PULSE_RTP_OBOE_ENGINE: Start Receiving
01-31 09:55:56.554  8637  8637 I PULSE_RTP_OBOE_ENGINE: Open stream, c:384 s:1 p:12 b:192
01-31 09:55:56.638  8637  8891 I PULSE_RTP_OBOE_ENGINE: Binding to current CPU ID 1
01-31 09:55:56.639  8637  8891 V PULSE_RTP_OBOE_ENGINE: Thread affinity set
01-31 09:56:06.785  8637  8891 E PULSE_RTP_OBOE_ENGINE: Enter state 0 -> 2 2
01-31 09:56:06.794  8637  8891 E PULSE_RTP_OBOE_ENGINE: Change state1 2 -> 3
01-31 09:56:06.848  8637  8891 E PULSE_RTP_OBOE_ENGINE: Change state1 3 -> 0
01-31 09:57:02.277  8637  8891 E PULSE_RTP_OBOE_ENGINE: Enter state 0 -> 1 2
01-31 09:57:09.148  8637  8891 E PULSE_RTP_OBOE_ENGINE: Change state1 1 -> 0
wenxin-wang commented 3 years ago

began to receive data after setting that. I didn't recognize the "IP" in app is listening IP and didn't understand broadcasting IP correctly.

I should add some doc, and clarify the names in app.

I see network speed on Linux and Android both, but still no sound playing from phone

Do you have pavucontrol installed, or any other tools that helps you inspect pulseaudio settings? Please check if your music player is using null output as output device. Here's a screenshot of mine:

pulse-audio-config

garywill commented 3 years ago

I found my solution. Thank you !!

My phone gets sound after selecting the program's output to "NULL", but "NULL" only appears when module-null-sink loaded.

I found pactl load-module module-rtp-send source=0 destination=224.0.0.56 port=4010 mtu=320 rate=48000 channels=1 works for me. I get sound output from both Linux and phone. I don't need the null-sink

wenxin-wang commented 3 years ago

Nice to hear that!