diff --git a/src/org/jitsi/impl/neomedia/MediaStreamImpl.java b/src/org/jitsi/impl/neomedia/MediaStreamImpl.java index 222ca684df122194f2e3e096b8d509e8ccfdef0b..f2d924998cd687b8717368b62c1fc32ec6efc39c 100644 --- a/src/org/jitsi/impl/neomedia/MediaStreamImpl.java +++ b/src/org/jitsi/impl/neomedia/MediaStreamImpl.java @@ -537,6 +537,12 @@ protected CsrcTransformEngine getCsrcEngine() */ public void close() { + /* Some statistics cannot be taken from the RTP manager and have to + * be gathered from the ReceiveStream. We need to do this before + * calling stop(). */ + if(logger.isInfoEnabled()) + printReceiveStreamStatistics(); + stop(); closeSendStreams(); @@ -2688,16 +2694,6 @@ private void printFlowStatistics(StreamRTPManager rtpManager) .append("\n").append(StatisticsEngine.RTP_STAT_PREFIX) .append("unknown types: ").append(rs.getUnknownTypes()); - /* The number of discarded packets is not available in - * <tt>GlobalReceptionStats</tt>. Neither is the number of - * decoded using FEC. */ - buff.append("\n").append(StatisticsEngine.RTP_STAT_PREFIX) - .append("discarded RTP packets: ") - .append(mediaStreamStatsImpl.getNbDiscarded()) - .append("\n").append(StatisticsEngine.RTP_STAT_PREFIX) - .append("decoded with FEC: ") - .append(mediaStreamStatsImpl.getNbFec()); - logger.info(buff); } catch(Throwable t) @@ -2706,6 +2702,18 @@ private void printFlowStatistics(StreamRTPManager rtpManager) } } + private void printReceiveStreamStatistics() + { + mediaStreamStatsImpl.updateStats(); + StringBuilder buff = new StringBuilder("\nReceive stream stats: " + + "discarded RTP packets: ") + .append(mediaStreamStatsImpl.getNbDiscarded()) + .append("\n").append("Receive stream stats: " + + "decoded with FEC: ") + .append(mediaStreamStatsImpl.getNbFec()); + logger.info(buff); + } + /** * Sets the <tt>RTPTranslator</tt> which is to forward RTP and RTCP traffic * between this and other <tt>MediaStream</tt>s.