RtpStatistics { public void onRtpSent(RtpPacket packet) { this.rtpTxPackets++; this.rtpTxOctets += packet.getPayloadLength(); this.rtpSentOn = this.wallClock.getCurrentTime(); this.rtpTimestamp = packet.getTimestamp(); if (!this.weSent) { addSender(Long.valueOf(this.ssrc)); } } 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 testOnRtpSent() { RtpStatistics stats = new RtpStatistics(rtpClock, SSRC, CNAME); RtpPacket p1 = new RtpPacket(172, false); RtpPacket p2 = new RtpPacket(172, false); p1.wrap(false, 8, 1, 160 * 1, stats.getSsrc(), new byte[160], 0, 160); p2.wrap(false, 8, 1, 160 * 2, stats.getSsrc(), new byte[160], 0, 160); stats.onRtpSent(p1); wallClock.tick(20000000L); stats.onRtpSent(p2); assertEquals(2, stats.getRtpPacketsSent()); assertEquals(p1.getPayloadLength() + p2.getPayloadLength(), stats.getRtpOctetsSent()); assertEquals(wallClock.getCurrentTime(), stats.getRtpSentOn()); assertTrue(stats.hasSent()); assertTrue(stats.isSender(stats.getSsrc())); assertEquals(1, stats.getSenders()); }