rtp/rtcp中的一些重要概念

 rtp时间戳的作用

时间戳字段是RTP首部中说明数据包时间的同步信息,

TimeStamp的值给出了分组中数据的第一个字节的采样时间(Sampling Instant),这是数据能以正确的时间顺序恢复的关键;另外简单的说RTCP通过多个流的时间戳之间的比较可以实现多个流的同步.如何实现的那,即:发送方报告中含有一个以网络时间协议NTP(Network Time Protocol)格式表示的绝对时间值,RTCP报告中给出一个RTP时间戳值,产生该值的时钟就是产生RTP分组中的TimeStamp字段的那个时钟。由于发送方发出的所有流和发送方报告都使用同一个绝对时钟,接收方就可以比较来自同一数据源的两个流的绝对时间,从而确定如何将一个流中的时间戳值映射为另一个流中的时间戳值。

在RTP中RFC摘抄的相关内容:

timestamp: 32 bits
        The timestamp reflects the sampling instant of the first octet in the RTP data packet. The sampling instant must be derived.from a clock that increments monotonically and linearly in timeto allow synchronization and jitter calculations .  The resolution of the clock must be sufficient for thedesired synchronization accuracy and for measuring packetarrival jitter (one tick per video frame is typically notsufficient).  The clock frequency is dependent on the format ofdata carried as payload and is specified statically in theprofile or payload format specification that defines the format, or may be specified dynamically for payload formats defined through non-RTP means. If RTP packets are generated  periodically, the nominal sampling instant as determined from the sampling clock is to be used, not a reading of the system clock. As an example, for fixed-rate audio the timestamp clock  would likely increment by one for each sampling period.  If an audio application reads blocks covering 160 sampling periods from the input device, the timestamp would be increased by 160 for each such block, regardless of whether the block is transmitted in a packet or dropped as silent.The initial value of the timestamp is random, as for the sequence   number. Several consecutive RTP packets may have equal timestamps if they are (logically) generated at once, e.g., belong to the same  video frame. Consecutive RTP packets may contain timestamps that are   not monotonic if the data is not transmitted in the order it was sampled, as in the case of MPEG interpolated video frames. (The   sequence numbers of the packets as transmitted will still be  monotonic.)

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭