I am writing a small RTSP server application. I have been able to stream audio and video from a single source and VLC clients plays them perfectly fine but NOT synced. I experimented many things to get AV sync working but no luck yet. It will be great help if someone can provide insight to internal working of VLC by answering following questions.
1. In RTP packets sent by server, does RTP timestamp have to be samplilng instance only? can it be presentation time? if yes, what unit milliSecond/microSecond?
2. If two stream are from the same source (and no RTCP from server), does VLC client try to sync these streams using its internal clock? OR does it adjust its internal clock based on the timestamp received in RTP packets? or it just plays the packets as and when it (VLC) receives them?
3. I just implemented RTCP mechanism for AV sync. I see fairly good AV sync. However, VLC client drops many audio and some video packets with errors "PTS out of range" or "late picture". So my question is - how it uses the RTP and NTP timestamps in RTCP packets from each of the audio and video streams to match with corresponding RTP timestamps in RTP packets?
Thank you very much.