Posted on 2009-01-02 21:32
猫头鹰 阅读(2577)
评论(1) 编辑 收藏 引用 所属分类:
视频学习之路
这是JRTPLIB@Conference系列的第三编《JRTPLIB的几个重要类说明》,本系列的主要工作是实现一个基于JRTPLIB的,建立在RTP组播基础上的多媒体视频会议系统。这只是一个实验系统,用于学习JRTPLIB、RTP、和多媒体相关的编程,不是一个完善的软件工程。而且,我只会在业余的时间出于兴趣写一写。有志同道合的朋友可以通过tinnal@136.com这个邮箱或博客回复(推荐)和我交流。
上一部《JRTPLIB@Conference DIY视频会议系统 二、基本例程分析 》
这一部的主要内容是要研究一个JRTPLIB常用的几个非常重要的类,在进行JRTPLIB或RTP编程时会经常和这个几类打交道,或都从这些类中继承。
这是续上一编《JRTPLIB@Conference DIY视频会议系统 三、JRTPLIB的几个重要类说明(续一)》的,上一编中,我们研究了JRTPLIB中的一个重要的类RTPPacket,我们现在来讲一下另外一个类RTPSourceData。
三、 RTPSourceData
头文件:rtpsourcedata.h
RTPSourceData 类收集了有关这个会话的某一个源的所有信息(ps:这些信息其实也就是从其它组成员的RTCP数据包中获得)。接口如下:
• uint32 t GetSSRC() const
返回这个源的SSRC标识符
• bool HasData() const
看看这个源是否有RTP数据可能提取
• RTPPacket *GetNextPacket()
从这个源的RTP包队列中提取第一个数据包
• void FlushPackets()
清空这个源的RTP包队列
• bool IsOwnSSRC() const
如果这个源是由RTPSources成员函数CreateOwnSSRC加入的,就返回真。PS:如果为真,那就是我们自己了。:)
• bool IsCSRC() const
如果这个源是由的RTP数据包而加入的,就返回真,否则返回假。
• bool IsSender() const
如果我们是发送者,则返回真。PS:至于怎么才是发送者,请看RFC3550
• bool IsValidated() const
看看这个源是否有效:收到一定数的连续的RTP数据包或一个CNAME项目。则返回真,否则返回假。
• bool IsActive() const
如果这个源有效,而且没有收到BYE数据包,则这源是活动的,返回真,否则返回假。
• void SetProcessedInRTCP(bool v)
这个函数是由RTCPPacketBuilder调用,用于标识这些个源的在report block中的信息是否已经处理。
• bool IsProcessedInRTCP() const
这个函数是由RTCPPacketBuilder调用,用于判断report block中的信息是否已经处理。
• bool IsRTPAddressSet() const
如果这个源的RTP数据包源IP地址已经设置过,则返回真,否则返回假。
• bool IsRTCPAddressSet() const
如果这个源的RTP数据包源IP地址已经设置过,则返回真,否则返回假。
• const RTPAddress *GetRTPDataAddress() const
返回这个源的RTP数据包的源IP地址,如果这个地址已经设置了(通过IsRTPAddressSet函数判断就可以)但却返回NULL,则标志这个包是我们自己发的。
• const RTPAddress *GetRTCPDataAddress() const
返回这个源的RTCP数据包的源IP地址,如果这个地址已经设置了(通过IsRTCPAddressSet函数判断就可以)但却返回NULL,则标志这个包是我们自己发的。
• bool ReceivedBYE() const
如果为真表明收到一个BYE数据包
• uint8 t *GetBYEReason(size t *len) const
得到BYE的源因
• RTPTime GetBYETime() const
返回BYE的时间
• void SetTimestampUnit(double tsu)
Sets the value for the timestamp unit to be used in jitter calculations for data received from this participant. If not set, the library uses an approximation for the timestamp unit which is calculated from two consecutive RTCP sender reports. The timestamp unit is defined as a time interval
divided by the number of samples in that interval: for 8000Hz audio this would be 1.0/8000.0.
• double GetTimestampUnit() const
Returns the timestamp unit used for this participant.
• bool SR HasInfo() const
Returns true if an RTCP sender report has been received from this participant.
• RTPNTPTime SR GetNTPTimestamp() const
Returns the NTP timestamp contained in the last sender report.
• uint32 t SR GetRTPTimestamp() const
Returns the RTP timestamp contained in the last sender report.
• uint32 t SR GetPacketCount() const
Returns the packet count contained in the last sender report.
• uint32 t SR GetByteCount() const
Returns the octet count contained in the last sender report.
• RTPTime SR GetReceiveTime() const
Returns the time at which the last sender report was received.
• bool SR Prev HasInfo() const
Returns true if more than one RTCP sender report has been received.
• RTPNTPTime SR Prev GetNTPTimestamp() const
Returns the NTP timestamp contained in the second to last sender report.
• uint32 t SR Prev GetRTPTimestamp() const
Returns the RTP timestamp contained in the second to last sender report.
• uint32 t SR Prev GetPacketCount() const
Returns the packet count contained in the second to last sender report.
• uint32 t SR Prev GetByteCount() const
Returns the octet count contained in the second to last sender report.
• RTPTime SR Prev GetReceiveTime() const
Returns the time at which the second to last sender report was received.
• bool RR HasInfo() const
Returns true if this participant sent a receiver report with information about the reception of our data.
• double RR GetFractionLost() const
Returns the fraction lost value from the last report.
• int32 t RR GetPacketsLost() const
Returns the number of lost packets contained in the last report.
• uint32 t RR GetExtendedHighestSequenceNumber() const
Returns the extended highest sequence number contained in the last report.
• uint32 t RR GetJitter() const
Returns the jitter value from the last report.
• uint32 t RR GetLastSRTimestamp() const
Returns the LSR value from the last report.
• uint32 t RR GetDelaySinceLastSR() const
Returns the DLSR value from the last report.
• RTPTime RR GetReceiveTime() const
Returns the time at which the last report was received.
• bool RR Prev HasInfo() const
Returns true if this participant sent more than one receiver report with information about the reception of our data.
• double RR Prev GetFractionLost() const
Returns the fraction lost value from the second to last report.
• int32 t RR Prev GetPacketsLost() const
Returns the number of lost packets contained in the second to last report.
• uint32 t RR Prev GetExtendedHighestSequenceNumber() const
Returns the extended highest sequence number contained in the second to last report.
• uint32 t RR Prev GetJitter() const
Returns the jitter value from the second to last report.
• uint32 t RR Prev GetLastSRTimestamp() const
Returns the LSR value from the second to last report.
• uint32 t RR Prev GetDelaySinceLastSR() const
Returns the DLSR value from the second to last report.
• RTPTime RR Prev GetReceiveTime() const
Returns the time at which the second to last report was received.
• bool INF HasSentData() const
Returns true if validated RTP packets have been received from this participant.
• int32 t INF GetNumPacketsReceived() const
Returns the total number of received packets from this participant.
• uint32 t INF GetBaseSequenceNumber() const
Returns the base sequence number of this participant.
• uint32 t INF GetExtendedHighestSequenceNumber() const
Returns the extended highest sequence number received from this participant.
• uint32 t INF GetJitter() const
Returns the current jitter value for this participant.
• RTPTime INF GetLastMessageTime() const
Returns the time at which something was last heard from this member.
• RTPTime INF GetLastRTPPacketTime() const
Returns the time at which the last RTP packet was received.
• double INF GetEstimatedTimestampUnit() const
Returns the estimated timestamp unit. The estimate is made from two consecutive sender reports.
• uint32 t INF GetNumPacketsReceivedInInterval() const
Returns the number of packets received since a new interval was started with INF StartNewInterval.
• uint32 t INF GetSavedExtendedSequenceNumber() const
Returns the extended sequence number which was stored by the INF StartNewInterval call.
• void INF StartNewInterval()
Starts a new interval to count received packets in. This also stores the current extended highest sequence number to be able to calculate the packet loss during the interval.
• RTPTime INF GetRoundtripTime() const
Estimates the round trip time by using the LSR and DLSR info from the last receiver report.
• RTPTime INF GetLastSDESNoteTime() const
Returns the time at which the last SDES NOTE item was received.
• uint8 t *SDES GetCNAME(size t *len) const
Returns a pointer to the SDES CNAME item of this participant and stores its length in len.
• uint8 t *SDES GetName(size t *len) const
Returns a pointer to the SDES name item of this participant and stores its length in len.
• uint8 t *SDES GetEMail(size t *len) const
Returns a pointer to the SDES e-mail item of this participant and stores its length in len.
• uint8 t *SDES GetPhone(size t *len) const
Returns a pointer to the SDES phone item of this participant and stores its length in len.
• uint8 t *SDES GetLocation(size t *len) const
Returns a pointer to the SDES location item of this participant and stores its length in len.
• uint8 t *SDES GetTool(size t *len) const
Returns a pointer to the SDES tool item of this participant and stores its length in len.
• uint8 t *SDES GetNote(size t *len) const
Returns a pointer to the SDES note item of this participant and stores its length in len.
If SDES private item support was enabled at compile-time, the following member functions are also available:
• void SDES GotoFirstPrivateValue()
Starts the iteration over the stored SDES private item prefixes and their associated values.
• bool SDES GetNextPrivateValue(uint8 t **prefix, size t *prefixlen,uint8 t **value, size t *valuelen)
If available, returns true and stores the next SDES private item prefix in prefix and its length in prefixlen. The associated value and its length are then stored in value and valuelen. Otherwise, it returns false.
• bool SDES GetPrivateValue(uint8 t *prefix, size t prefixlen, uint8 t **value, size t *valuelen) const
Looks for the entry which corresponds to the SDES private item prefix prefix with length prefixlen. If found, the function returns true and stores the associated value and its length in value and valuelen respectively.