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

          Line data    Source code
       1             : /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
       2             : *
       3             : *  Use of this source code is governed by a BSD-style license
       4             : *  that can be found in the LICENSE file in the root of the source
       5             : *  tree. An additional intellectual property rights grant can be found
       6             : *  in the file PATENTS.  All contributing project authors may
       7             : *  be found in the AUTHORS file in the root of the source tree.
       8             : */
       9             : #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_
      10             : #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_
      11             : 
      12             : #include <vector>
      13             : 
      14             : #include "webrtc/base/rate_statistics.h"
      15             : #include "webrtc/base/timeutils.h"
      16             : #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
      17             : #include "webrtc/modules/video_coding/utility/frame_dropper.h"
      18             : #include "webrtc/typedefs.h"
      19             : 
      20             : namespace webrtc {
      21             : 
      22             : struct CodecSpecificInfoVP8;
      23             : class Clock;
      24             : 
      25             : class ScreenshareLayers : public TemporalLayers {
      26             :  public:
      27             :   static const double kMaxTL0FpsReduction;
      28             :   static const double kAcceptableTargetOvershoot;
      29             :   static const int kTl0Flags;
      30             :   static const int kTl1Flags;
      31             :   static const int kTl1SyncFlags;
      32             :   static const int kMaxFrameIntervalMs;
      33             : 
      34             :   ScreenshareLayers(int num_temporal_layers,
      35             :                     uint8_t initial_tl0_pic_idx,
      36             :                     Clock* clock);
      37             :   virtual ~ScreenshareLayers();
      38             : 
      39             :   // Returns the recommended VP8 encode flags needed. May refresh the decoder
      40             :   // and/or update the reference buffers.
      41             :   int EncodeFlags(uint32_t timestamp) override;
      42             : 
      43             :   // Update state based on new bitrate target and incoming framerate.
      44             :   // Returns the bitrate allocation for the active temporal layers.
      45             :   std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps,
      46             :                                        int max_bitrate_kbps,
      47             :                                        int framerate) override;
      48             : 
      49             :   // Update the encoder configuration with target bitrates or other parameters.
      50             :   // Returns true iff the configuration was actually modified.
      51             :   bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override;
      52             : 
      53             :   void PopulateCodecSpecific(bool base_layer_sync,
      54             :                              CodecSpecificInfoVP8* vp8_info,
      55             :                              uint32_t timestamp) override;
      56             : 
      57             :   void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) override;
      58             : 
      59             :   int CurrentLayerId() const override;
      60             : 
      61             :  private:
      62             :   bool TimeToSync(int64_t timestamp) const;
      63             :   uint32_t GetCodecTargetBitrateKbps() const;
      64             : 
      65             :   Clock* const clock_;
      66             : 
      67             :   int number_of_temporal_layers_;
      68             :   bool last_base_layer_sync_;
      69             :   uint8_t tl0_pic_idx_;
      70             :   int active_layer_;
      71             :   int64_t last_timestamp_;
      72             :   int64_t last_sync_timestamp_;
      73             :   int64_t last_emitted_tl0_timestamp_;
      74             :   rtc::TimestampWrapAroundHandler time_wrap_handler_;
      75             :   int min_qp_;
      76             :   int max_qp_;
      77             :   uint32_t max_debt_bytes_;
      78             : 
      79             :   // Configured max framerate.
      80             :   rtc::Optional<uint32_t> target_framerate_;
      81             :   // Incoming framerate from capturer.
      82             :   rtc::Optional<uint32_t> capture_framerate_;
      83             :   // Tracks what framerate we actually encode, and drops frames on overshoot.
      84             :   RateStatistics encode_framerate_;
      85             :   bool bitrate_updated_;
      86             : 
      87             :   static constexpr int kMaxNumTemporalLayers = 2;
      88             :   struct TemporalLayer {
      89           0 :     TemporalLayer()
      90           0 :         : state(State::kNormal),
      91             :           enhanced_max_qp(-1),
      92             :           last_qp(-1),
      93             :           debt_bytes_(0),
      94           0 :           target_rate_kbps_(0) {}
      95             : 
      96             :     enum class State {
      97             :       kNormal,
      98             :       kDropped,
      99             :       kReencoded,
     100             :       kQualityBoost,
     101             :     } state;
     102             : 
     103             :     int enhanced_max_qp;
     104             :     int last_qp;
     105             :     uint32_t debt_bytes_;
     106             :     uint32_t target_rate_kbps_;
     107             : 
     108             :     void UpdateDebt(int64_t delta_ms);
     109             :   } layers_[kMaxNumTemporalLayers];
     110             : 
     111             :   void UpdateHistograms();
     112             :   // Data for histogram statistics.
     113           0 :   struct Stats {
     114             :     int64_t first_frame_time_ms_ = -1;
     115             :     int64_t num_tl0_frames_ = 0;
     116             :     int64_t num_tl1_frames_ = 0;
     117             :     int64_t num_dropped_frames_ = 0;
     118             :     int64_t num_overshoots_ = 0;
     119             :     int64_t tl0_qp_sum_ = 0;
     120             :     int64_t tl1_qp_sum_ = 0;
     121             :     int64_t tl0_target_bitrate_sum_ = 0;
     122             :     int64_t tl1_target_bitrate_sum_ = 0;
     123             :   } stats_;
     124             : };
     125             : }  // namespace webrtc
     126             : 
     127             : #endif  // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SCREENSHARE_LAYERS_H_

Generated by: LCOV version 1.13