[pjsip] Strange RTP receive issue in PJ-MEDIA

Benny Prijono bennylp at pjsip.org
Mon Apr 7 09:42:05 EDT 2008


On Sun, Apr 6, 2008 at 9:21 PM, Jeremy King <jerry.ipe.thomas at gmail.com> wrote:
>
>
> Hi Benny,

Hi Jeremy,

(since you Cc-ed your second mail to the list, I'm taking the freedom
to Cc the list on my reply too. I apologize if that's not what you
wanted).


>   I am facing a problem in RTP receive side of PJ-MEDIA. I apologise for the
>   length of this mail.
>
>   My test set-up is as shown below from a media perspective.
>
>   <---[LAN]--->|     |<---[INTERNET]--->|     |<---[SERVICE_PROVIDER]--->
>                | NAT |                  |     |
>                |  +  |                  | RTP |
>      [PJSUA]----| F/W |------------------|     |----[MEDIA SERVER]
>                |  +  |                  |PROXY|
>                | G/W |                  |     |
>                 |     |                  |     |
>
>   When a UA makes a call to a particular service number, the media server
> ends
>   up playing out a series of announcements to the UA. G.711 u-law codec is
> used
>    between the media server and PJ. The media server sends out RTP packets
> at a
>   more or less regular 20 ms interval. However, in the RTP packets the media
>   server sends to the UA, the timestamp and SSRC fields are both '0'.
>    Nevertheless, the sequence of arrival of RTP packets as well as the
> sequence
>   numbers in those RTP packets seem correct.

If the timestamp in RTP packets are always zero, then basically it's broken.

>   However, the announcements, when played out at PJSUA, sounds very
> "choppy".
>    The playout sounds as if there is massive packet loss.

Yep, it's quite expected.

>   I am using the latest SVN check-out of PJ without any modifications and
> have
>   set the PJ_CONFIG_MAXIMUM_SPEED group of compile-time options.
>
>    Since a Wireshark capture showed that all the RTP packets are arriving
>   correctly at the PC where PJSUA is running, I tried investigating further
>   focusing on how the incoming frame is inserted into the jitter buffer.
>
>   On seeing that in "on_rx_rtp" in "pjmedia\src\pjmedia\stream.c", just
> before
>   "pjmedia_jbuf_put_frame", the frame sequence number is calculated based on
>   the RTP timestamp, I tried to manually generate a timestamp from the RTP
>    sequence number inside "on_rx_rtp".
>
>   That is when I found out that the incoming RTP packets are coming
> completely
>   out of order i.e. there is a sequence difference of around 250 packets,
> which
>    I assume the jitter buffer will never be able to handle.

I think probably you missed converting the numbers to host byte order,
hence the 256 difference. All the values in RTP header (including in
pjmedia_rtp_hdr) are in network byte order.

Cheers
 Benny

>   I removed the timestamp generation code and retained the following RTP
> packet
>   header log line.
>
>     PJ_LOG(3,(stream->port.info.name.ptr,
>        "RTP Pkt #%05hu: PT->[%05hu] TS->[%010lu] SSRC->[%010lu]",
>       hdr->seq, hdr->pt, hdr->ts, hdr->ssrc));
>
>   I am attaching the following with this mail:
>
>     1. Wireshark Packet Capture     -> pktCap_20080406235400_TS4.cap
>      2. PJSUA Generated Log File     -> pjsua_log_20080406235400_TS4.txt
>     3. Recording of PJSUA Playback  -> audioCap_20080406235400_TS4.wav
>     4. PCM extracted from the RTP   -> audioRef_20080406235400_TS4.wav
>
>   The build environment is WinXP SP2 with Feb 2003 edition of platform SDK,
> Oct
>   2004 edition of DXSDK and VC6 IDE.
>
>   I hope I haven't missed out something that was right in front of me and
> that
>    I am not doing something wrong!
>
>   Thanks for taking the time to read this. I would appreciate any help on
> this
>   issue.
>
>   - Jerry
>




More information about the pjsip mailing list