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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 | 120 |
121 return static_cast<size_t>(r); | 121 return static_cast<size_t>(r); |
122 }); | 122 }); |
123 | 123 |
124 RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes()); | 124 RTC_DCHECK_EQ(encoded_bytes, RequiredOutputSizeBytes()); |
125 | 125 |
126 EncodedInfo info; | 126 EncodedInfo info; |
127 info.encoded_bytes = encoded_bytes; | 127 info.encoded_bytes = encoded_bytes; |
128 info.encoded_timestamp = first_timestamp_in_buffer_; | 128 info.encoded_timestamp = first_timestamp_in_buffer_; |
129 info.payload_type = config_.payload_type; | 129 info.payload_type = config_.payload_type; |
130 info.encoder_type = AudioEncoder::CodecType::kIlbc; | |
kwiberg-webrtc
2016/05/16 08:13:26
Nit: Just CodecType::kIlbc should be enough.
aleloi
2016/05/16 08:20:49
Done.
| |
130 return info; | 131 return info; |
131 } | 132 } |
132 | 133 |
133 void AudioEncoderIlbc::Reset() { | 134 void AudioEncoderIlbc::Reset() { |
134 if (encoder_) | 135 if (encoder_) |
135 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_)); | 136 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderFree(encoder_)); |
136 RTC_CHECK(config_.IsOk()); | 137 RTC_CHECK(config_.IsOk()); |
137 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_)); | 138 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderCreate(&encoder_)); |
138 const int encoder_frame_size_ms = config_.frame_size_ms > 30 | 139 const int encoder_frame_size_ms = config_.frame_size_ms > 30 |
139 ? config_.frame_size_ms / 2 | 140 ? config_.frame_size_ms / 2 |
140 : config_.frame_size_ms; | 141 : config_.frame_size_ms; |
141 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms)); | 142 RTC_CHECK_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, encoder_frame_size_ms)); |
142 num_10ms_frames_buffered_ = 0; | 143 num_10ms_frames_buffered_ = 0; |
143 } | 144 } |
144 | 145 |
145 size_t AudioEncoderIlbc::RequiredOutputSizeBytes() const { | 146 size_t AudioEncoderIlbc::RequiredOutputSizeBytes() const { |
146 switch (num_10ms_frames_per_packet_) { | 147 switch (num_10ms_frames_per_packet_) { |
147 case 2: return 38; | 148 case 2: return 38; |
148 case 3: return 50; | 149 case 3: return 50; |
149 case 4: return 2 * 38; | 150 case 4: return 2 * 38; |
150 case 6: return 2 * 50; | 151 case 6: return 2 * 50; |
151 default: FATAL(); | 152 default: FATAL(); |
152 } | 153 } |
153 } | 154 } |
154 | 155 |
155 } // namespace webrtc | 156 } // namespace webrtc |
OLD | NEW |