RtpStatistics { public void onRtcpSent(RtcpPacket packet) { calculateAvgRtcpSize(packet.getSize()); this.rtcpTxPackets++; this.rtcpTxOctets += packet.getSize(); } RtpStatistics(final RtpClock clock, final long ssrc, final String cname);  RtpStatistics(final RtpClock clock, final long ssrc);  RtpStatistics(final RtpClock clock); void setSsrc(long ssrc); void setCname(String cname); long getLastHeartbeat(); void setLastHeartbeat(long rtpKeepAlive); long getTime(); long getCurrentTime(); long getRtpTime(long time); long getSsrc(); String getCname(); long getRtpPacketsReceived(); long getRtpOctetsReceived(); long getRtpPacketsSent(); long getRtpOctetsSent(); long getRtpReceivedOn(); long getRtpSentOn(); long getRtpTimestamp(); boolean hasSent(); double getRtcpBw(); RtcpPacketType getRtcpPacketType(); void setRtcpPacketType(RtcpPacketType packetType); int getSenders(); boolean isSender(long ssrc); void clearSenders(); int getPmembers(); int getMembers(); RtpMember getMember(long ssrc); List<Long> getMembersList(); boolean isMember(long ssrc); void confirmMembers(); void resetMembers(); double getRtcpAvgSize(); void setRtcpAvgSize(double avgSize); long getRtcpPacketsSent(); long getRtcpOctetsSent(); long rtcpInterval(boolean initial); long rtcpReceiverInterval(boolean initial); boolean isSenderTimeout(); void reset(); void onRtpSent(RtpPacket packet); void onRtpReceive(RtpPacket packet); void onRtcpSent(RtcpPacket packet); void onRtcpReceive(RtcpPacket rtcpPacket); static final int RTP_DEFAULT_BW; static final double RTCP_BW_FRACTION; static final double RTCP_DEFAULT_BW; static final double RTCP_SENDER_BW_FRACTION; static final double RTCP_RECEIVER_BW_FRACTION; static final double RTCP_DEFAULT_AVG_SIZE; }
@Test public void testOnRtcpSent() { RtpStatistics stats = new RtpStatistics(rtpClock, SSRC, CNAME); RtcpPacket p1 = RtcpPacketFactory.buildReport(stats); RtcpPacket p2 = RtcpPacketFactory.buildReport(stats); double initialAvgSize = stats.getRtcpAvgSize(); p1.encode(new byte[RtpPacket.RTP_PACKET_MAX_SIZE], 0); p2.encode(new byte[RtpPacket.RTP_PACKET_MAX_SIZE], 0); stats.onRtcpSent(p1); wallClock.tick(20000000L); stats.onRtcpSent(p2); double avgSize = calculateAvgSize(initialAvgSize, p1.getSize(), p2.getSize()); assertEquals(avgSize, stats.getRtcpAvgSize(), 0); }