LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/video - receive_statistics_proxy.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
      12             : #define WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_
      13             : 
      14             : #include <map>
      15             : #include <string>
      16             : 
      17             : #include "webrtc/base/criticalsection.h"
      18             : #include "webrtc/base/rate_statistics.h"
      19             : #include "webrtc/base/ratetracker.h"
      20             : #include "webrtc/base/thread_annotations.h"
      21             : #include "webrtc/common_types.h"
      22             : #include "webrtc/common_video/include/frame_callback.h"
      23             : #include "webrtc/modules/video_coding/include/video_coding_defines.h"
      24             : #include "webrtc/video/quality_threshold.h"
      25             : #include "webrtc/video/report_block_stats.h"
      26             : #include "webrtc/video/stats_counter.h"
      27             : #include "webrtc/video/video_stream_decoder.h"
      28             : #include "webrtc/video_receive_stream.h"
      29             : 
      30             : namespace webrtc {
      31             : 
      32             : class Clock;
      33             : class ViECodec;
      34             : class ViEDecoderObserver;
      35             : struct CodecSpecificInfo;
      36             : 
      37             : class ReceiveStatisticsProxy : public VCMReceiveStatisticsCallback,
      38             :                                public RtcpStatisticsCallback,
      39             :                                public RtcpPacketTypeCounterObserver,
      40             :                                public StreamDataCountersCallback {
      41             :  public:
      42             :   ReceiveStatisticsProxy(const VideoReceiveStream::Config* config,
      43             :                          Clock* clock);
      44             :   virtual ~ReceiveStatisticsProxy();
      45             : 
      46             :   VideoReceiveStream::Stats GetStats() const;
      47             : 
      48             :   void OnDecodedFrame();
      49             :   void OnSyncOffsetUpdated(int64_t sync_offset_ms, double estimated_freq_khz);
      50             :   void OnRenderedFrame(const VideoFrame& frame);
      51             :   void OnIncomingPayloadType(int payload_type);
      52             :   void OnDecoderImplementationName(const char* implementation_name);
      53             :   void OnIncomingRate(unsigned int framerate, unsigned int bitrate_bps);
      54             :   void OnDecoderTiming(int decode_ms,
      55             :                        int max_decode_ms,
      56             :                        int current_delay_ms,
      57             :                        int target_delay_ms,
      58             :                        int jitter_buffer_ms,
      59             :                        int min_playout_delay_ms,
      60             :                        int render_delay_ms,
      61             :                        int64_t rtt_ms);
      62             :   void ReceiveStateChange(VideoReceiveState state);
      63             : 
      64             :   void OnPreDecode(const EncodedImage& encoded_image,
      65             :                    const CodecSpecificInfo* codec_specific_info);
      66             : 
      67             :   // Overrides VCMReceiveStatisticsCallback.
      68             :   void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) override;
      69             :   void OnFrameCountsUpdated(const FrameCounts& frame_counts) override;
      70             :   void OnDiscardedPacketsUpdated(int discarded_packets) override;
      71             : 
      72             :   // Overrides RtcpStatisticsCallback.
      73             :   void StatisticsUpdated(const webrtc::RtcpStatistics& statistics,
      74             :                          uint32_t ssrc) override;
      75             :   void CNameChanged(const char* cname, uint32_t ssrc) override;
      76             : 
      77             :   // Overrides RtcpPacketTypeCounterObserver.
      78             :   void RtcpPacketTypesCounterUpdated(
      79             :       uint32_t ssrc,
      80             :       const RtcpPacketTypeCounter& packet_counter) override;
      81             :   // Overrides StreamDataCountersCallback.
      82             :   void DataCountersUpdated(const webrtc::StreamDataCounters& counters,
      83             :                            uint32_t ssrc) override;
      84             : 
      85             :  private:
      86             :   struct SampleCounter {
      87           0 :     SampleCounter() : sum(0), num_samples(0) {}
      88             :     void Add(int sample);
      89             :     int Avg(int64_t min_required_samples) const;
      90             :     void Reset();
      91             : 
      92             :    private:
      93             :     int64_t sum;
      94             :     int64_t num_samples;
      95             :   };
      96           0 :   struct QpCounters {
      97             :     SampleCounter vp8;
      98             :   };
      99             : 
     100             :   void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
     101             : 
     102             :   void QualitySample() EXCLUSIVE_LOCKS_REQUIRED(crit_);
     103             : 
     104             :   Clock* const clock_;
     105             :   // Ownership of this object lies with the owner of the ReceiveStatisticsProxy
     106             :   // instance.  Lifetime is guaranteed to outlive |this|.
     107             :   // TODO(tommi): In practice the config_ reference is only used for accessing
     108             :   // config_.rtp.ulpfec.ulpfec_payload_type.  Instead of holding a pointer back,
     109             :   // we could just store the value of ulpfec_payload_type and change the
     110             :   // ReceiveStatisticsProxy() ctor to accept a const& of Config (since we'll
     111             :   // then no longer store a pointer to the object).
     112             :   const VideoReceiveStream::Config& config_;
     113             :   const int64_t start_ms_;
     114             : 
     115             :   rtc::CriticalSection crit_;
     116             :   int64_t last_sample_time_ GUARDED_BY(crit_);
     117             :   QualityThreshold fps_threshold_ GUARDED_BY(crit_);
     118             :   QualityThreshold qp_threshold_ GUARDED_BY(crit_);
     119             :   QualityThreshold variance_threshold_ GUARDED_BY(crit_);
     120             :   SampleCounter qp_sample_ GUARDED_BY(crit_);
     121             :   int num_bad_states_ GUARDED_BY(crit_);
     122             :   int num_certain_states_ GUARDED_BY(crit_);
     123             :   VideoReceiveStream::Stats stats_ GUARDED_BY(crit_);
     124             :   RateStatistics decode_fps_estimator_ GUARDED_BY(crit_);
     125             :   RateStatistics renders_fps_estimator_ GUARDED_BY(crit_);
     126             :   rtc::RateTracker render_fps_tracker_ GUARDED_BY(crit_);
     127             :   rtc::RateTracker render_pixel_tracker_ GUARDED_BY(crit_);
     128             :   SampleCounter render_width_counter_ GUARDED_BY(crit_);
     129             :   SampleCounter render_height_counter_ GUARDED_BY(crit_);
     130             :   SampleCounter sync_offset_counter_ GUARDED_BY(crit_);
     131             :   SampleCounter decode_time_counter_ GUARDED_BY(crit_);
     132             :   SampleCounter jitter_buffer_delay_counter_ GUARDED_BY(crit_);
     133             :   SampleCounter target_delay_counter_ GUARDED_BY(crit_);
     134             :   SampleCounter current_delay_counter_ GUARDED_BY(crit_);
     135             :   SampleCounter delay_counter_ GUARDED_BY(crit_);
     136             :   SampleCounter e2e_delay_counter_ GUARDED_BY(crit_);
     137             :   MaxCounter freq_offset_counter_ GUARDED_BY(crit_);
     138             :   int64_t first_report_block_time_ms_ GUARDED_BY(crit_);
     139             :   ReportBlockStats report_block_stats_ GUARDED_BY(crit_);
     140             :   QpCounters qp_counters_;  // Only accessed on the decoding thread.
     141             :   VideoReceiveState receive_state_ GUARDED_BY(crit_);
     142             :   std::map<uint32_t, StreamDataCounters> rtx_stats_ GUARDED_BY(crit_);
     143             : };
     144             : 
     145             : }  // namespace webrtc
     146             : #endif  // WEBRTC_VIDEO_RECEIVE_STATISTICS_PROXY_H_

Generated by: LCOV version 1.13