tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

audio_encoder_pcm16b.h (1547B)


      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 MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
     12 #define MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
     13 
     14 #include <cstddef>
     15 #include <cstdint>
     16 
     17 #include "api/audio_codecs/audio_encoder.h"
     18 #include "modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
     19 
     20 namespace webrtc {
     21 
     22 class AudioEncoderPcm16B final : public AudioEncoderPcm {
     23 public:
     24  struct Config : public AudioEncoderPcm::Config {
     25   public:
     26    Config() : AudioEncoderPcm::Config(107), sample_rate_hz(8000) {}
     27    bool IsOk() const;
     28 
     29    int sample_rate_hz;
     30  };
     31 
     32  explicit AudioEncoderPcm16B(const Config& config)
     33      : AudioEncoderPcm(config, config.sample_rate_hz) {}
     34 
     35  AudioEncoderPcm16B(const AudioEncoderPcm16B&) = delete;
     36  AudioEncoderPcm16B& operator=(const AudioEncoderPcm16B&) = delete;
     37 
     38 protected:
     39  size_t EncodeCall(const int16_t* audio,
     40                    size_t input_len,
     41                    uint8_t* encoded) override;
     42 
     43  size_t BytesPerSample() const override;
     44 
     45  AudioEncoder::CodecType GetCodecType() const override;
     46 };
     47 
     48 }  // namespace webrtc
     49 
     50 #endif  // MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_