Index: webrtc/video/send_statistics_proxy.h |
diff --git a/webrtc/video/send_statistics_proxy.h b/webrtc/video/send_statistics_proxy.h |
index c098e3a810b3c1cae73cce52c833bf4d2ea4ae77..6473acaa4323370dfa3b0c8144d8a251574de7d1 100644 |
--- a/webrtc/video/send_statistics_proxy.h |
+++ b/webrtc/video/send_statistics_proxy.h |
@@ -35,7 +35,8 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
public BitrateStatisticsObserver, |
public FrameCountObserver, |
public VideoEncoderRateObserver, |
- public SendSideDelayObserver { |
+ public SendSideDelayObserver, |
+ public SendPacketObserver { |
public: |
static const int kStatsTimeoutMs; |
@@ -65,6 +66,8 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
// how stats are collected. |
void SetContentType(VideoEncoderConfig::ContentType content_type); |
+ bool OnSentPacket(int packet_id); |
+ |
protected: |
// From CpuOveruseMetricsObserver. |
void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; |
@@ -93,7 +96,30 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
int max_delay_ms, |
uint32_t ssrc) override; |
+ void OnSendPacket(uint16_t packet_id, |
+ int64_t capture_time_ms, |
+ uint32_t ssrc) override; |
+ |
private: |
+ // Map holding sent packets (mapped by packet id). |
+ class PacketIdLessThan { |
+ public: |
+ bool operator()(uint16_t seq1, uint16_t seq2) const { |
+ return IsNewerSequenceNumber(seq2, seq1); |
+ } |
+ }; |
+ struct Packet { |
+ public: |
+ Packet(uint32_t ssrc, int64_t capture_time_ms, int64_t send_time_ms) |
+ : ssrc_(ssrc), |
+ capture_time_ms_(capture_time_ms), |
+ send_time_ms_(send_time_ms) {} |
+ uint32_t ssrc_; |
+ int64_t capture_time_ms_; |
+ int64_t send_time_ms_; |
stefan-webrtc
2016/01/18 19:48:26
I prefer to remove the trailing _ since this is a
åsapersson
2016/04/06 14:52:37
Done.
|
+ }; |
+ typedef std::map<uint16_t, Packet, PacketIdLessThan> PacketMap; |
+ |
class SampleCounter { |
public: |
SampleCounter() : sum(0), num_samples(0) {} |
@@ -126,6 +152,8 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
EXCLUSIVE_LOCKS_REQUIRED(crit_); |
+ void RemoveOld(int64_t now, PacketMap* packets) |
+ EXCLUSIVE_LOCKS_REQUIRED(crit_); |
Clock* const clock_; |
const VideoSendStream::Config config_; |
@@ -135,6 +163,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); |
std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); |
rtc::ExpFilter encode_time_ GUARDED_BY(crit_); |
+ PacketMap packets_ GUARDED_BY(crit_); |
// Contains stats used for UMA histograms. These stats will be reset if |
// content type changes between real-time video and screenshare, since these |
@@ -162,6 +191,7 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
SampleCounter max_delay_counter_; |
rtc::RateTracker input_frame_rate_tracker_; |
rtc::RateTracker sent_frame_rate_tracker_; |
+ std::map<uint32_t, SampleCounter> send_delay_counters_; // Mapped by SSRC. |
}; |
rtc::scoped_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |