OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 (int16_t*)_audioBuffer, | 220 (int16_t*)_audioBuffer, |
221 MAX_AUDIO_BUFFER_IN_BYTES, outLen); | 221 MAX_AUDIO_BUFFER_IN_BYTES, outLen); |
222 encodedLenInBytes = outLen * sizeof(int16_t); | 222 encodedLenInBytes = outLen * sizeof(int16_t); |
223 } | 223 } |
224 | 224 |
225 // Codec may not be operating at a frame rate of 10 ms. Whenever enough | 225 // Codec may not be operating at a frame rate of 10 ms. Whenever enough |
226 // 10 ms chunks of data has been pushed to the encoder an encoded frame | 226 // 10 ms chunks of data has been pushed to the encoder an encoded frame |
227 // will be available. Wait until then. | 227 // will be available. Wait until then. |
228 if (encodedLenInBytes) | 228 if (encodedLenInBytes) |
229 { | 229 { |
230 uint16_t msOfData = | 230 if (WriteEncodedAudioData(_audioBuffer, encodedLenInBytes) == -1) |
231 ptrAudioFrame->samples_per_channel_ / | |
232 uint16_t(ptrAudioFrame->sample_rate_hz_ / 1000); | |
233 if (WriteEncodedAudioData(_audioBuffer, encodedLenInBytes, msOfData, | |
234 playoutTS) == -1) | |
235 { | 231 { |
236 return -1; | 232 return -1; |
237 } | 233 } |
238 } | 234 } |
239 return 0; | 235 return 0; |
240 } | 236 } |
241 | 237 |
242 int32_t FileRecorderImpl::SetUpAudioEncoder() | 238 int32_t FileRecorderImpl::SetUpAudioEncoder() |
243 { | 239 { |
244 if (_fileFormat == kFileFormatPreencodedFile || | 240 if (_fileFormat == kFileFormatPreencodedFile || |
(...skipping 12 matching lines...) Expand all Loading... |
257 int32_t FileRecorderImpl::codec_info(CodecInst& codecInst) const | 253 int32_t FileRecorderImpl::codec_info(CodecInst& codecInst) const |
258 { | 254 { |
259 if(codec_info_.plfreq == 0) | 255 if(codec_info_.plfreq == 0) |
260 { | 256 { |
261 return -1; | 257 return -1; |
262 } | 258 } |
263 codecInst = codec_info_; | 259 codecInst = codec_info_; |
264 return 0; | 260 return 0; |
265 } | 261 } |
266 | 262 |
267 int32_t FileRecorderImpl::WriteEncodedAudioData( | 263 int32_t FileRecorderImpl::WriteEncodedAudioData(const int8_t* audioBuffer, |
268 const int8_t* audioBuffer, | 264 size_t bufferLength) |
269 size_t bufferLength, | |
270 uint16_t /*millisecondsOfData*/, | |
271 const TickTime* /*playoutTS*/) | |
272 { | 265 { |
273 return _moduleFile->IncomingAudioData(audioBuffer, bufferLength); | 266 return _moduleFile->IncomingAudioData(audioBuffer, bufferLength); |
274 } | 267 } |
275 } // namespace webrtc | 268 } // namespace webrtc |
OLD | NEW |