pjproject icon indicating copy to clipboard operation
pjproject copied to clipboard

When you call stopTransmit, rtp data is sent all the time

Open chenlx761 opened this issue 1 year ago • 2 comments

Describe the bug

After I establish a call, I mute it through the stopTransmit method, but the server can still see that I send rtp data

Steps to reproduce

Set up a voice call

PJSIP version

2.13

Context

android14 pjsip2.13

Log, call stack, etc

Unable to catch log,Only the message logs of the server

chenlx761 avatar May 11 '24 10:05 chenlx761

message logs of the server 微信图片_20240511181953

chenlx761 avatar May 11 '24 10:05 chenlx761

Check if the data sent are keep-alive packet, or the stream is connected to other port.

trengginas avatar May 17 '24 13:05 trengginas

Check if the data sent are keep-alive packet, or the stream is connected to other port.

It should be a heartbeat packet, because when I change to pcma, the same operation will only be sent once every 5 seconds

chenlx761 avatar May 20 '24 09:05 chenlx761

Yes, it should be heart-beat packets, if the RTP is decoded, the audio should be silence. FYI, the heart-beat mechanism currently relies on codec VAD/DTX features, i.e: the codec will be fed with zero/silence data and send whatever returned by the codecs unless the codec returns zero byte of encoded data.

For codecs without built-in VAD such as PCMA, PJMEDIA will use its silence detector as VAD, it normally returns non-zero data every 5 seconds. For codecs with built-in VAD such as Opus, it may behave differently depends on the codec VAD behavior, some return small/comfort-noise data at normal interval (e.g: 20ms), others may be at much longer interval (codec's DTX feature). If the codec VAD/DTX is disabled, it may send silence audio packets at normal interval.

nanangizz avatar May 21 '24 05:05 nanangizz

Yes, it should be heart-beat packets, if the RTP is decoded, the audio should be silence. FYI, the heart-beat mechanism currently relies on codec VAD/DTX features, i.e: the codec will be fed with zero/silence data and send whatever returned by the codecs unless the codec returns zero byte of encoded data.

For codecs without built-in VAD such as PCMA, PJMEDIA will use its silence detector as VAD, it normally returns non-zero data every 5 seconds. For codecs with built-in VAD such as Opus, it may behave differently depends on the codec VAD behavior, some return small/comfort-noise data at normal interval (e.g: 20ms), others may be at much longer interval (codec's DTX feature). If the codec VAD/DTX is disabled, it may send silence audio packets at normal interval.

I tried the following code according to your prompt, and makeCall crashed if (codecInfo.getCodecId().contains("opus")) { CodecParamSetting paramSetting = new CodecParamSetting(); paramSetting.setVad(false); CodecParam param = new CodecParam(); param.setSetting(paramSetting); sipEndpoint.codecSetParam(codecInfo.getCodecId(), param); }

crashType=2 SIGFPE

#00    pc 0006f5f4    /apex/com.android.runtime/lib/bionic/libc.so (tgkill+12) [armeabi-v8::53602b20fada3ef6cc65a4daf1d67685]
#01    pc 00351cb4    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (__aeabi_ldiv0+8) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#02    pc 00244297    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#03    pc 00243ce7    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjmedia_stream_info_from_sdp+1678) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#04    pc 001bf343    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsua_media_channel_update+1258) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#05    pc 001a7f05    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#06    pc 001d823b    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#07    pc 001d7ff7    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#08    pc 001d88ab    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#09    pc 001d79ab    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#10    pc 00212fe3    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsip_dlg_on_tsx_state+162) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#11    pc 002149dd    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#12    pc 0020c287    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#13    pc 0020d70f    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#14    pc 0020c855    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsip_tsx_recv_msg+144) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#15    pc 0020cfdf    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#16    pc 001f997b    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsip_endpt_process_rx_data+526) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#17    pc 001f90f9    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#18    pc 00201267    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsip_tpmgr_receive_packet+1410) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#19    pc 00205865    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]
#20    pc 00315dcf    /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5]

2024-05-21 14:26:48.490 10833-11137/com.unionbroad.app E/PTT-CrashHandle: #21 pc 0030e80d /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (ioqueue_dispatch_read_event+632) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #22 pc 003108b9 /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pj_ioqueue_poll+908) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #23 pc 001f952f /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsip_endpt_handle_events2+210) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #24 pc 001b5381 /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so (pjsua_handle_events+44) [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #25 pc 001b4b85 /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #26 pc 003123fd /data/app/~~gP9Xns_WuVrdc7Pf1iqOUw==/com.unionbroad.app-6XpJXmQlWoe4hPh8yZAdTg==/lib/arm/libpjsua2.so [armeabi-v7a::093ebd28fde80abf9e8012138365e5e5] #27 pc 0007f923 /apex/com.android.runtime/lib/bionic/libc.so (__unregister_atfork+26) [armeabi-v8::53602b20fada3ef6cc65a4daf1d67685] java: [Failed to get Java stack]

chenlx761 avatar May 21 '24 06:05 chenlx761

This looks like a different issue.

  • Make sure that Opus is supported.
  • Provide us the PJSIP log, so we can check the SDP.

sauwming avatar May 28 '24 05:05 sauwming

This looks like a different issue.

  • Make sure that Opus is supported.
  • Provide us the PJSIP log, so we can check the SDP.

Hello, thank you for your reply. The attachment is the log of pjsip siplog.txt

chenlx761 avatar May 28 '24 10:05 chenlx761

The SDP looks okay and the negotiation seems successful, so I'm not sure what went wrong. I suggest rebuilding it with debugging info (-g) so we can get a more detailed stack trace, and know exactly where within pjmedia_stream_info_from_sdp() the crash occurred.

Also, is there any issue if you use Opus, but do not modify the Opus codec settings (i.e. leave it at default)?

sauwming avatar May 28 '24 10:05 sauwming

The SDP looks okay and the negotiation seems successful, so I'm not sure what went wrong. I suggest rebuilding it with debugging info (-g) so we can get a more detailed stack trace, and know exactly where within pjmedia_stream_info_from_sdp() the crash occurred.

Also, is there any issue if you use Opus, but do not modify the Opus codec settings (i.e. leave it at default)?

If I just use opus, I don't have this crash information, I also have this problem in c# platform, the following is the log, please see if it is useful?

在 pj.Call.answer(Call* , CallOpParam* ) 在 CSharp_pjsua2xamarinfpjsua2_Call_answer___(Void* jarg1, Void* jarg2)

System.DivideByZeroException HResult=0x80020012 Message=尝试除以零。 Source=<无法计算异常源> StackTrace: <无法计算异常堆栈跟踪>

chenlx761 avatar May 31 '24 03:05 chenlx761

We need the detailed stack trace in order to know which code triggered the divide by zero.

sauwming avatar May 31 '24 03:05 sauwming