OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 public: | 76 public: |
77 struct Config : public AudioEncoderPcm::Config { | 77 struct Config : public AudioEncoderPcm::Config { |
78 Config() : AudioEncoderPcm::Config(8) {} | 78 Config() : AudioEncoderPcm::Config(8) {} |
79 }; | 79 }; |
80 | 80 |
81 explicit AudioEncoderPcmA(const Config& config) | 81 explicit AudioEncoderPcmA(const Config& config) |
82 : AudioEncoderPcm(config, kSampleRateHz) {} | 82 : AudioEncoderPcm(config, kSampleRateHz) {} |
83 explicit AudioEncoderPcmA(const CodecInst& codec_inst); | 83 explicit AudioEncoderPcmA(const CodecInst& codec_inst); |
84 AudioEncoderPcmA(int payload_type, const SdpAudioFormat& format); | 84 AudioEncoderPcmA(int payload_type, const SdpAudioFormat& format); |
85 | 85 |
86 static constexpr const char* GetPayloadName() { return "pcma"; } | 86 static constexpr const char* GetPayloadName() { return "PCMA"; } |
87 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( | 87 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( |
88 const SdpAudioFormat& format); | 88 const SdpAudioFormat& format); |
89 | 89 |
90 protected: | 90 protected: |
91 size_t EncodeCall(const int16_t* audio, | 91 size_t EncodeCall(const int16_t* audio, |
92 size_t input_len, | 92 size_t input_len, |
93 uint8_t* encoded) override; | 93 uint8_t* encoded) override; |
94 | 94 |
95 size_t BytesPerSample() const override; | 95 size_t BytesPerSample() const override; |
96 | 96 |
97 AudioEncoder::CodecType GetCodecType() const override; | 97 AudioEncoder::CodecType GetCodecType() const override; |
98 | 98 |
99 private: | 99 private: |
100 static const int kSampleRateHz = 8000; | 100 static const int kSampleRateHz = 8000; |
101 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmA); | 101 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmA); |
102 }; | 102 }; |
103 | 103 |
104 class AudioEncoderPcmU final : public AudioEncoderPcm { | 104 class AudioEncoderPcmU final : public AudioEncoderPcm { |
105 public: | 105 public: |
106 struct Config : public AudioEncoderPcm::Config { | 106 struct Config : public AudioEncoderPcm::Config { |
107 Config() : AudioEncoderPcm::Config(0) {} | 107 Config() : AudioEncoderPcm::Config(0) {} |
108 }; | 108 }; |
109 | 109 |
110 explicit AudioEncoderPcmU(const Config& config) | 110 explicit AudioEncoderPcmU(const Config& config) |
111 : AudioEncoderPcm(config, kSampleRateHz) {} | 111 : AudioEncoderPcm(config, kSampleRateHz) {} |
112 explicit AudioEncoderPcmU(const CodecInst& codec_inst); | 112 explicit AudioEncoderPcmU(const CodecInst& codec_inst); |
113 AudioEncoderPcmU(int payload_type, const SdpAudioFormat& format); | 113 AudioEncoderPcmU(int payload_type, const SdpAudioFormat& format); |
114 | 114 |
115 static constexpr const char* GetPayloadName() { return "pcmu"; } | 115 static constexpr const char* GetPayloadName() { return "PCMU"; } |
116 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( | 116 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( |
117 const SdpAudioFormat& format); | 117 const SdpAudioFormat& format); |
118 | 118 |
119 protected: | 119 protected: |
120 size_t EncodeCall(const int16_t* audio, | 120 size_t EncodeCall(const int16_t* audio, |
121 size_t input_len, | 121 size_t input_len, |
122 uint8_t* encoded) override; | 122 uint8_t* encoded) override; |
123 | 123 |
124 size_t BytesPerSample() const override; | 124 size_t BytesPerSample() const override; |
125 | 125 |
126 AudioEncoder::CodecType GetCodecType() const override; | 126 AudioEncoder::CodecType GetCodecType() const override; |
127 | 127 |
128 private: | 128 private: |
129 static const int kSampleRateHz = 8000; | 129 static const int kSampleRateHz = 8000; |
130 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmU); | 130 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcmU); |
131 }; | 131 }; |
132 | 132 |
133 } // namespace webrtc | 133 } // namespace webrtc |
134 | 134 |
135 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_AUDIO_ENCODER_PCM_H_ | 135 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_AUDIO_ENCODER_PCM_H_ |
OLD | NEW |