LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/codecs/g711 - audio_encoder_pcm.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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_G711_AUDIO_ENCODER_PCM_H_
      12             : #define WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_AUDIO_ENCODER_PCM_H_
      13             : 
      14             : #include <vector>
      15             : 
      16             : #include "webrtc/base/constructormagic.h"
      17             : #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
      18             : 
      19             : namespace webrtc {
      20             : 
      21           0 : class AudioEncoderPcm : public AudioEncoder {
      22             :  public:
      23             :   struct Config {
      24             :    public:
      25             :     bool IsOk() const;
      26             : 
      27             :     int frame_size_ms;
      28             :     size_t num_channels;
      29             :     int payload_type;
      30             : 
      31             :    protected:
      32           0 :     explicit Config(int pt)
      33           0 :         : frame_size_ms(20), num_channels(1), payload_type(pt) {}
      34             :   };
      35             : 
      36             :   ~AudioEncoderPcm() override;
      37             : 
      38             :   int SampleRateHz() const override;
      39             :   size_t NumChannels() const override;
      40             :   size_t Num10MsFramesInNextPacket() const override;
      41             :   size_t Max10MsFramesInAPacket() const override;
      42             :   int GetTargetBitrate() const override;
      43             :   void Reset() override;
      44             : 
      45             :  protected:
      46             :   AudioEncoderPcm(const Config& config, int sample_rate_hz);
      47             : 
      48             :   EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
      49             :                          rtc::ArrayView<const int16_t> audio,
      50             :                          rtc::Buffer* encoded) override;
      51             : 
      52             :   virtual size_t EncodeCall(const int16_t* audio,
      53             :                             size_t input_len,
      54             :                             uint8_t* encoded) = 0;
      55             : 
      56             :   virtual size_t BytesPerSample() const = 0;
      57             : 
      58             :   // Used to set EncodedInfoLeaf::encoder_type in
      59             :   // AudioEncoderPcm::EncodeImpl
      60             :   virtual AudioEncoder::CodecType GetCodecType() const = 0;
      61             : 
      62             :  private:
      63             :   const int sample_rate_hz_;
      64             :   const size_t num_channels_;
      65             :   const int payload_type_;
      66             :   const size_t num_10ms_frames_per_packet_;
      67             :   const size_t full_frame_samples_;
      68             :   std::vector<int16_t> speech_buffer_;
      69             :   uint32_t first_timestamp_in_buffer_;
      70             : };
      71             : 
      72             : struct CodecInst;
      73             : 
      74           0 : class AudioEncoderPcmA final : public AudioEncoderPcm {
      75             :  public:
      76             :   struct Config : public AudioEncoderPcm::Config {
      77           0 :     Config() : AudioEncoderPcm::Config(8) {}
      78             :   };
      79             : 
      80           0 :   explicit AudioEncoderPcmA(const Config& config)
      81           0 :       : AudioEncoderPcm(config, kSampleRateHz) {}
      82             :   explicit AudioEncoderPcmA(const CodecInst& codec_inst);
      83             : 
      84             :  protected:
      85             :   size_t EncodeCall(const int16_t* audio,
      86             :                     size_t input_len,
      87             :                     uint8_t* encoded) override;
      88             : 
      89             :   size_t BytesPerSample() const override;
      90             : 
      91             :   AudioEncoder::CodecType GetCodecType() const override;
      92             : 
      93             :  private:
      94             :   static const int kSampleRateHz = 8000;
      95             :   RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmA);
      96             : };
      97             : 
      98           0 : class AudioEncoderPcmU final : public AudioEncoderPcm {
      99             :  public:
     100             :   struct Config : public AudioEncoderPcm::Config {
     101           0 :     Config() : AudioEncoderPcm::Config(0) {}
     102             :   };
     103             : 
     104           0 :   explicit AudioEncoderPcmU(const Config& config)
     105           0 :       : AudioEncoderPcm(config, kSampleRateHz) {}
     106             :   explicit AudioEncoderPcmU(const CodecInst& codec_inst);
     107             : 
     108             :  protected:
     109             :   size_t EncodeCall(const int16_t* audio,
     110             :                     size_t input_len,
     111             :                     uint8_t* encoded) override;
     112             : 
     113             :   size_t BytesPerSample() const override;
     114             : 
     115             :   AudioEncoder::CodecType GetCodecType() const override;
     116             : 
     117             :  private:
     118             :   static const int kSampleRateHz = 8000;
     119             :   RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmU);
     120             : };
     121             : 
     122             : }  // namespace webrtc
     123             : 
     124             : #endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_AUDIO_ENCODER_PCM_H_

Generated by: LCOV version 1.13