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

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2014 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_MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_
      12             : #define WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_
      13             : 
      14             : #include <memory>
      15             : #include <vector>
      16             : 
      17             : #include "webrtc/base/constructormagic.h"
      18             : #include "webrtc/common_audio/vad/include/vad.h"
      19             : #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
      20             : #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
      21             : 
      22             : namespace webrtc {
      23             : 
      24             : class Vad;
      25             : 
      26           0 : class AudioEncoderCng final : public AudioEncoder {
      27             :  public:
      28           0 :   struct Config {
      29             :     Config();
      30             :     Config(Config&&);
      31             :     ~Config();
      32             :     bool IsOk() const;
      33             : 
      34             :     size_t num_channels = 1;
      35             :     int payload_type = 13;
      36             :     std::unique_ptr<AudioEncoder> speech_encoder;
      37             :     Vad::Aggressiveness vad_mode = Vad::kVadNormal;
      38             :     int sid_frame_interval_ms = 100;
      39             :     int num_cng_coefficients = 8;
      40             :     // The Vad pointer is mainly for testing. If a NULL pointer is passed, the
      41             :     // AudioEncoderCng creates (and destroys) a Vad object internally. If an
      42             :     // object is passed, the AudioEncoderCng assumes ownership of the Vad
      43             :     // object.
      44             :     Vad* vad = nullptr;
      45             :   };
      46             : 
      47             :   explicit AudioEncoderCng(Config&& config);
      48             :   ~AudioEncoderCng() override;
      49             : 
      50             :   int SampleRateHz() const override;
      51             :   size_t NumChannels() const override;
      52             :   int RtpTimestampRateHz() const override;
      53             :   size_t Num10MsFramesInNextPacket() const override;
      54             :   size_t Max10MsFramesInAPacket() const override;
      55             :   int GetTargetBitrate() const override;
      56             :   EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
      57             :                          rtc::ArrayView<const int16_t> audio,
      58             :                          rtc::Buffer* encoded) override;
      59             :   void Reset() override;
      60             :   bool SetFec(bool enable) override;
      61             :   bool SetDtx(bool enable) override;
      62             :   bool SetApplication(Application application) override;
      63             :   void SetMaxPlaybackRate(int frequency_hz) override;
      64             :   rtc::ArrayView<std::unique_ptr<AudioEncoder>> ReclaimContainedEncoders()
      65             :       override;
      66             :   void OnReceivedUplinkPacketLossFraction(
      67             :       float uplink_packet_loss_fraction) override;
      68             :   void OnReceivedUplinkBandwidth(
      69             :       int target_audio_bitrate_bps,
      70             :       rtc::Optional<int64_t> probing_interval_ms) override;
      71             : 
      72             :  private:
      73             :   EncodedInfo EncodePassive(size_t frames_to_encode,
      74             :                             rtc::Buffer* encoded);
      75             :   EncodedInfo EncodeActive(size_t frames_to_encode,
      76             :                            rtc::Buffer* encoded);
      77             :   size_t SamplesPer10msFrame() const;
      78             : 
      79             :   std::unique_ptr<AudioEncoder> speech_encoder_;
      80             :   const int cng_payload_type_;
      81             :   const int num_cng_coefficients_;
      82             :   const int sid_frame_interval_ms_;
      83             :   std::vector<int16_t> speech_buffer_;
      84             :   std::vector<uint32_t> rtp_timestamps_;
      85             :   bool last_frame_active_;
      86             :   std::unique_ptr<Vad> vad_;
      87             :   std::unique_ptr<ComfortNoiseEncoder> cng_encoder_;
      88             : 
      89             :   RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderCng);
      90             : };
      91             : 
      92             : }  // namespace webrtc
      93             : 
      94             : #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_

Generated by: LCOV version 1.13