Floating point exception in RTCP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey all,
I digged more into the problem: I compiled pjsip with "-g", and analyzed the core dump, here is the result.

As I suspected, the problem is I didn't initialize the RTCP session properly, in fact in? `src/pjmedia/rtcp.c` at line 396? the function `pjmedia_rtcp_rx_rtp2` tries to divide by `clock_rate`, which was priviously set to zero by `pjmedia_rtcp_session_setting_default`.
??? Program terminated with signal 8, Arithmetic exception.

??? ...

??? (gdb) backtrace 
??? #0? 0x08059b23 in pjmedia_rtcp_rx_rtp2 (sess=0xa0065d8, seq=16687, rtp_ts=2128045433, payload=292, discarded=0)
? ?? ?? at ../src/pjmedia/rtcp.c:396
??? #1? 0x08059850 in pjmedia_rtcp_rx_rtp (sess=0xa0065d8, seq=16687, rtp_ts=2128045433, payload=292)
? ?? ?? at ../src/pjmedia/rtcp.c:276
??? #2? 0x0804bd60 in rtp_chunkise (ctx=0xa006558, id=0, size=0xbfc41420, ts=0xbfc41428) at input-stream-rtp.c:325
??? #3? 0x0804ae0d in chunkise (s=0xa006008, c=0xbfc4141c) at input-stream.c:84
??? #4? 0x0804aadd in main (argc=7, argv=0xbfc41514) at chunkiser_test.c:241

??? (gdb) frame 0
??? #0? 0x08059b23 in pjmedia_rtcp_rx_rtp2 (sess=0xa0065d8, seq=16687, rtp_ts=2128045433, payload=292, discarded=0)
? ?? ?? at ../src/pjmedia/rtcp.c:396
??? 396??? ??? ??? jitter = jitter * 1000000 / sess->clock_rate;

As a workaround, because I don't care about jitter calculations, I'm now setting clock_rate = 1 when initializing, and it seems to work fine. (don't know if this should be considered a bug, after all I am not using it in the "proper" way). 
Is this safe? Will setting a non-meaningful `clock_rate` have unwanted side effects?

BTW, Now I'm also left with a doubt about the functioning of get_ntp_time, but I'll open another thread for this.


Thanks,
Davide





Il Marted? 4 Febbraio 2014 8:25, Davide <dkk_91-temp at yahoo.it> ha scritto:
 
Hi all, 
>I have recently started using pjmedia and I ran into an issue with the 
RTCP interface: I guess I didn't fully understand how to use it properly. 
>
>Basically, my application receives one (or more) RTP+RTCP stream(s) via 
UDP and I wish to be able to get the NTP timestamp for each incoming RTP 
packet, in order to decide how to push it to the underlying P2P 
streaming network (fyi, I'm writing a module for PeerStreamer [1]). 
>
>In order to do this, what I currently (unsuccessfully) do is: 
>- Initialisation with no extra information (I have a feeling that the 
problem may be here) 
>
>????? struct pjmedia_rtp_session_setting rtp_s; 
>????? struct pjmedia_rtcp_session_setting rtcp_s; 
>????? rtp_s.flags = 0; 
>????? pjmedia_rtcp_session_setting_default(&rtcp_s); 
>????? for (each stream I'm opening) { 
>??????? pjmedia_rtp_session_init2(&streams[i].rtp, rtp_s); 
>??????? pjmedia_rtcp_init2(&streams[i].rtcp, &rtcp_s); 
>????? } 
>
>- For each incoming RTP packet 
>
>????? // read new_pkt from udp socket 
>????? pjmedia_rtp_decode_rtp(&streams[i].rtp, 
>???????????????????????????? new_pkt, new_pkt_size, 
>???????????????????????????? &rtp_h, &rtp_p, &rtp_p_len) 
>????? // Next line generates the problem 
>????? pjmedia_rtcp_rx_rtp(&streams[i].rtcp, ntohs(rtp_h->seq), 
>????????????????????????? ntohl(rtp_h->ts), rtp_p_len); 
>????? pjmedia_rtp_session_update(&streams[i].rtp, rtp_h, NULL); 
>
>- For each incoming RCTP packet 
>
>????? // read new_pkt from udp socket 
>????? pjmedia_rtcp_rx_rtcp(&streams[i].rtcp, 
>?????????????????????????? new_pkt, new_pkt_size); 
>
>The problem is, if I feed my program with some RTP output from VLC, 
after a little while (50 to 300 RTP packets) it crashes with `Floating 
point exception (core dumped)`. 
>
>Do you have any clues about why this happens? I have the feeling this 
may be because I don't initialize most values in RTCP session, but for 
my purposes I don't really care about the RTP payload or its encoding, 
so I don't know anything about clock_rate or samples_per_frame: if this 
is the problem, is there any workaround to obtain the NTP timestamp of 
each RTP packet? 
>Some contextual information follow. 
>
>Thanks in advance for any help, 
>Davide Kirchner
>
>
>I'm on Linux Ubuntu 32 bits, compiled bare-bone pjproject with: 
>./configure --disable-sound --disable-oss --disable-video 
--disable-small-filter --disable-large-filter --disable-speex-aec 
--disable-g711-codec --disable-l16-codec --disable-gsm-codec 
--disable-g722-codec --disable-g7221-codec --disable-speex-codec 
--disable-ilbc-codec --disable-sdl --disable-ffmpeg --disable-v4l2 
--disable-ssl --disable-opencore-amr --disable-silk 
--prefix=/home/davide/pj_install 
>
>The input RTP is generated with this vlc parameters playing a sample 
video file [2]: 
>cvlc --loop "$FILE" --sout 
"#transcode{vcodec=h264,venc=x264{keyint=1,intra-refresh,slice=4},vb=300,fps=25,acodec=mp2,width=240,heigth=320 
}:rtp{dst=127.0.0.1,port=3000,sdp=file:///tmp/channel_in.sdp}" 
>
>[1] http://peerstreamer.org 
>[2] http://halo.disi.unitn.it/~baldesi/exp_stuff/big_buck_bunny_120p_190Kbps_mpeg4_mp2.ts? 
(by
Blender Foundation / www.bigbuckbunny.org)
>_______________________________________________
>Visit our blog: http://blog.pjsip.org
>
>pjsip mailing list
>pjsip at lists.pjsip.org
>http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140206/c7b5c749/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux