rtpbin: warning: rtpsource.c:XXXX:calculate_jitter: cannot get clock-rate for pt NN
I've been trying to debug other issues I've been having by setting GST_DEBUG=2, however the logs were getting spammed with the following warning message repeatedly. (the full log is attached)
0:00:00.159406572 5991 0x1422800 WARN rtpsource rtpsource.c:1013:calculate_jitter: cannot get clock-rate for pt 96
Digging into the related code it seems that for whatever reason rtpsource is unable to obtain the clock-rate through the use of callbacks. I don't have the log handy but I have seen that in one different test case it was able to correctly get the clock-rate as part of rtp_source_update_caps, but then would some how set it back to -1 and then continually warn me that it couldn't get it as part of the callback from fetch_clock_rate_from_payload.
0:00:00.139710579 5991 0x1422800 DEBUG rtpsource rtpsource.c:1058:init_seq: base_seq 3737
0:00:00.139730486 5991 0x1422800 DEBUG rtpsource rtpsource.c:1137:update_receiver_stats: probation: seqnr 3737 == expected 3737
0:00:00.139748005 5991 0x1422800 DEBUG rtpsource rtpsource.c:1151:update_receiver_stats: probation 1: queue packet
0:00:00.158875276 5991 0x1422800 DEBUG rtpbin gstrtpbin.c:3481:pt_map_requested:<rtpbin> payload map requested for pt 96 in session 0
0:00:00.158921295 5991 0x1422800 DEBUG rtpbin gstrtpbin.c:881:get_pt_map: searching pt 96 in cache
0:00:00.158970998 5991 0x1422800 DEBUG rtpbin gstrtpbin.c:894:get_pt_map: emitting signal for pt 96 in session 0
0:00:00.159028406 5991 0x1422800 DEBUG rtpbin gstrtpbin.c:945:get_pt_map: no pt map could be obtained
0:00:00.159078202 5991 0x1422800 DEBUG rtpbin gstrtpbin.c:3492:pt_map_requested:<rtpbin> could not get caps
0:00:00.159130665 5991 0x1422800 DEBUG rtpsession gstrtpsession.c:1667:gst_rtp_session_get_caps_for_pt:<rtpsession0> could not get caps
0:00:00.159178035 5991 0x1422800 DEBUG rtpsession rtpsession.c:1542:source_clock_rate: got clock-rate -1 for pt 96
0:00:00.159225554 5991 0x1422800 DEBUG rtpsource rtpsource.c:944:fetch_clock_rate_from_payload: got clock-rate -1
0:00:00.159275609 5991 0x1422800 DEBUG rtpsource rtpsource.c:1137:update_receiver_stats: probation: seqnr 3738 == expected 3738
0:00:00.159315794 5991 0x1422800 DEBUG rtpsource rtpsource.c:1146:update_receiver_stats: probation done!
0:00:00.159363479 5991 0x1422800 DEBUG rtpsource rtpsource.c:1058:init_seq: base_seq 3738
0:00:00.159406572 5991 0x1422800 WARN rtpsource rtpsource.c:1013:calculate_jitter: cannot get clock-rate for pt 96
Here are the two commands used. (each run in a different terminal).
gst-launch-1.0 rtpbin name=rtpbin \
audiotestsrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink host=127.0.0.1 port=5002 \
rtpbin.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5003 sync=false async=false \
udpsrc port=5007 ! rtpbin.recv_rtcp_sink_0
gst-launch-1.0 -v rtpbin name=rtpbin \
udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" \
port=5002 ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! rtpamrdepay ! amrnbdec ! alsasink \
udpsrc port=5003 ! rtpbin.recv_rtcp_sink_0 \
rtpbin.send_rtcp_src_0 ! udpsink host=127.0.0.1 port=5007 sync=false async=false
The full error log with "export GST_DEBUG=2,rtp*:5" is attached to help see the full context. simple_example_cannot_get_clock_rate_for_pt.txt
I'm not really sure why it keeps saying "no pt map could be obtained" when the caps are specified on the udpsrc. I also tried writing a custom program where I implement the callback for "request-pt-map" but it didn't seem to have any effect. I'm not sure if I needed to force clear the pt cache with "clear-pt-map" or not.
Anyways I would have thought the example provided above should work fine as the cap is available for the udpsrc, and the rtpjitterbuffer has not difficulty getting the clock-rate from the caps.
0:00:00.162786993 5991 0x1422800 DEBUG rtpjitterbuffer gstrtpjitterbuffer.c:1408:gst_jitter_buffer_sink_parse_caps:<rtpjitterbuffer0> got caps application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)AMR, encoding-params=(string)1, octet-align=(string)1, ssrc=(uint)2921936800
0:00:00.162815456 5991 0x1422800 DEBUG rtpjitterbuffer gstrtpjitterbuffer.c:1430:gst_jitter_buffer_sink_parse_caps:<rtpjitterbuffer0> got clock-rate 8000
Let me know if there's any additional information I can provide that would help me determine if I am just doing something wrong or if there is some issue causing rtpbin to not be able to supply the caps to rtpsession and rtpsource (perhaps due to missing callbacks).
I've reproduced this on 1.14, 1.16.2 and 1.17.2.1 (the latest master)