2

I am writing a jitter buffer program in c to handle rtp packets.Here RTP uses UDP for transportation so connection is not reliable and packets will not be in order and also there will be some packet loss.In case of change in packet order,i will arrange them through sequence number(in RTP header information) but how can i handle or compensate packet loss?(because packet loss is not in my hand)

Note: I am handling h264 as payload and they asked me to use only RTP header

Techky
  • 85
  • 2
  • 9
  • Are you asking how to code the packet loss handling, or what strategies you can employ to handle packet loss (e.g. fill in comfort noise, replay previous packets, fade in/out etc. ?) – nos Mar 27 '15 at 09:16
  • It will better for me if u say how to code the packet lost handling? if it is difficult then tell some best techniques or strategies , i will change it to coding by understanding that. – Techky Mar 27 '15 at 09:38
  • Then it's probably out of scope for a simple answer - it's going to be a lot of code, and it's non-trivial – nos Mar 27 '15 at 11:27
  • Is the server creating the RTP packets under your control? There are some server side techniques that can mitigate packet loss – Joel Cunningham Mar 27 '15 at 23:39
  • @nos sorry for late reply, Its ok i no need code just suggest me some good techniques (as u mentioned above fill in comfort noise, replay previous packets, fade in/out etc ) which might helpful for me implement code.(atleast some useful links) – Techky Mar 30 '15 at 06:16
  • @JoelCunningham No, RTP packet creation is not in my control and my work is only to get the RTP packet from server and to manipulate them such a way to reduce jitter in it (i.e by handling packet loss,duplicate packets,arrange packets etc..) – Techky Mar 30 '15 at 06:21
  • 1
    The [Colin Perkins RTP book](http://csperkins.org/standards/rtp-book.html) has two relevant chapters: Error Concealment and Error Correction. I'd recommend getting the book, it's one of the best RTP resources. – Joel Cunningham Apr 03 '15 at 00:18

2 Answers2

3

You can't. Short of fabricating the lost data there's nothing you can do.

Hopefully the actual encoding used within the RTP packets can help the actual recipient deal with packet loss a little better. Short of you decoding the RTP payload and acting as a codec for the payload there's nothing that you can do that the codec wont do anyway.

With H.264 each RTP packet will contain either a whole NAL unit, a NAL unit fragment or, perhaps, multiple NAL units. The H.264 codec will just expect to be fed the stream of NAL units and IT will know what to do if there is packet loss.

Len Holgate
  • 21,282
  • 4
  • 45
  • 92
1

In short, as others said it as well, you can't.

If packets are lost randomly following a uniform distribution, you can protect your stream by adding FEC to it.

Balázs Kreith
  • 141
  • 2
  • 8