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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 info.encoded_timestamp = first_timestamp_in_buffer_; | 89 info.encoded_timestamp = first_timestamp_in_buffer_; |
90 info.payload_type = payload_type_; | 90 info.payload_type = payload_type_; |
91 info.encoded_bytes = | 91 info.encoded_bytes = |
92 encoded->AppendData(full_frame_samples_ * BytesPerSample(), | 92 encoded->AppendData(full_frame_samples_ * BytesPerSample(), |
93 [&] (rtc::ArrayView<uint8_t> encoded) { | 93 [&] (rtc::ArrayView<uint8_t> encoded) { |
94 return EncodeCall(&speech_buffer_[0], | 94 return EncodeCall(&speech_buffer_[0], |
95 full_frame_samples_, | 95 full_frame_samples_, |
96 encoded.data()); | 96 encoded.data()); |
97 }); | 97 }); |
98 speech_buffer_.clear(); | 98 speech_buffer_.clear(); |
| 99 info.encoder_type = GetCodecType(); |
99 return info; | 100 return info; |
100 } | 101 } |
101 | 102 |
| 103 AudioEncoder::CodecType AudioEncoderPcm::GetCodecType() const { |
| 104 return AudioEncoder::CodecType::kOther; |
| 105 } |
| 106 |
102 void AudioEncoderPcm::Reset() { | 107 void AudioEncoderPcm::Reset() { |
103 speech_buffer_.clear(); | 108 speech_buffer_.clear(); |
104 } | 109 } |
105 | 110 |
106 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) | 111 AudioEncoderPcmA::AudioEncoderPcmA(const CodecInst& codec_inst) |
107 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} | 112 : AudioEncoderPcmA(CreateConfig<AudioEncoderPcmA>(codec_inst)) {} |
108 | 113 |
109 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, | 114 size_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, |
110 size_t input_len, | 115 size_t input_len, |
111 uint8_t* encoded) { | 116 uint8_t* encoded) { |
112 return WebRtcG711_EncodeA(audio, input_len, encoded); | 117 return WebRtcG711_EncodeA(audio, input_len, encoded); |
113 } | 118 } |
114 | 119 |
115 size_t AudioEncoderPcmA::BytesPerSample() const { | 120 size_t AudioEncoderPcmA::BytesPerSample() const { |
116 return 1; | 121 return 1; |
117 } | 122 } |
118 | 123 |
| 124 AudioEncoder::CodecType AudioEncoderPcmA::GetCodecType() const { |
| 125 return AudioEncoder::CodecType::kPcmA; |
| 126 } |
| 127 |
119 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) | 128 AudioEncoderPcmU::AudioEncoderPcmU(const CodecInst& codec_inst) |
120 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} | 129 : AudioEncoderPcmU(CreateConfig<AudioEncoderPcmU>(codec_inst)) {} |
121 | 130 |
122 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, | 131 size_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, |
123 size_t input_len, | 132 size_t input_len, |
124 uint8_t* encoded) { | 133 uint8_t* encoded) { |
125 return WebRtcG711_EncodeU(audio, input_len, encoded); | 134 return WebRtcG711_EncodeU(audio, input_len, encoded); |
126 } | 135 } |
127 | 136 |
128 size_t AudioEncoderPcmU::BytesPerSample() const { | 137 size_t AudioEncoderPcmU::BytesPerSample() const { |
129 return 1; | 138 return 1; |
130 } | 139 } |
131 | 140 |
| 141 AudioEncoder::CodecType AudioEncoderPcmU::GetCodecType() const { |
| 142 return AudioEncoder::CodecType::kPcmU; |
| 143 } |
| 144 |
132 } // namespace webrtc | 145 } // namespace webrtc |
OLD | NEW |