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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 first_timestamp_in_buffer_ = rtp_timestamp; | 81 first_timestamp_in_buffer_ = rtp_timestamp; |
82 } | 82 } |
83 for (int i = 0; i < num_samples; ++i) { | 83 for (int i = 0; i < num_samples; ++i) { |
84 speech_buffer_.push_back(audio[i]); | 84 speech_buffer_.push_back(audio[i]); |
85 } | 85 } |
86 if (speech_buffer_.size() < full_frame_samples_) { | 86 if (speech_buffer_.size() < full_frame_samples_) { |
87 return EncodedInfo(); | 87 return EncodedInfo(); |
88 } | 88 } |
89 CHECK_EQ(speech_buffer_.size(), full_frame_samples_); | 89 CHECK_EQ(speech_buffer_.size(), full_frame_samples_); |
90 CHECK_GE(max_encoded_bytes, full_frame_samples_); | 90 CHECK_GE(max_encoded_bytes, full_frame_samples_); |
91 int16_t ret = EncodeCall(&speech_buffer_[0], full_frame_samples_, encoded); | |
92 CHECK_GE(ret, 0); | |
93 speech_buffer_.clear(); | |
94 EncodedInfo info; | 91 EncodedInfo info; |
95 info.encoded_timestamp = first_timestamp_in_buffer_; | 92 info.encoded_timestamp = first_timestamp_in_buffer_; |
96 info.payload_type = payload_type_; | 93 info.payload_type = payload_type_; |
| 94 int16_t ret = EncodeCall(&speech_buffer_[0], full_frame_samples_, encoded); |
| 95 CHECK_GE(ret, 0); |
97 info.encoded_bytes = static_cast<size_t>(ret); | 96 info.encoded_bytes = static_cast<size_t>(ret); |
| 97 speech_buffer_.clear(); |
98 return info; | 98 return info; |
99 } | 99 } |
100 | 100 |
101 int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, | 101 int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, |
102 size_t input_len, | 102 size_t input_len, |
103 uint8_t* encoded) { | 103 uint8_t* encoded) { |
104 return WebRtcG711_EncodeA(audio, static_cast<int16_t>(input_len), encoded); | 104 return WebRtcG711_EncodeA(audio, static_cast<int16_t>(input_len), encoded); |
105 } | 105 } |
106 | 106 |
107 int16_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, | 107 int16_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, |
(...skipping 17 matching lines...) Expand all Loading... |
125 : AudioEncoderMutableImpl<AudioEncoderPcmU>( | 125 : AudioEncoderMutableImpl<AudioEncoderPcmU>( |
126 CreateConfig<AudioEncoderPcmU>(codec_inst)) { | 126 CreateConfig<AudioEncoderPcmU>(codec_inst)) { |
127 } | 127 } |
128 | 128 |
129 AudioEncoderMutablePcmA::AudioEncoderMutablePcmA(const CodecInst& codec_inst) | 129 AudioEncoderMutablePcmA::AudioEncoderMutablePcmA(const CodecInst& codec_inst) |
130 : AudioEncoderMutableImpl<AudioEncoderPcmA>( | 130 : AudioEncoderMutableImpl<AudioEncoderPcmA>( |
131 CreateConfig<AudioEncoderPcmA>(codec_inst)) { | 131 CreateConfig<AudioEncoderPcmA>(codec_inst)) { |
132 } | 132 } |
133 | 133 |
134 } // namespace webrtc | 134 } // namespace webrtc |
OLD | NEW |