henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
henrik.lundin@webrtc.org | f45c8ca | 2015-02-05 18:29:39 +0000 | [diff] [blame^] | 12 | #include "webrtc/base/checks.h" |
henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 13 | |
| 14 | namespace webrtc { |
| 15 | |
| 16 | AudioEncoder::EncodedInfo::EncodedInfo() : EncodedInfoLeaf() { |
| 17 | } |
| 18 | |
| 19 | AudioEncoder::EncodedInfo::~EncodedInfo() { |
| 20 | } |
| 21 | |
henrik.lundin@webrtc.org | f45c8ca | 2015-02-05 18:29:39 +0000 | [diff] [blame^] | 22 | bool AudioEncoder::Encode(uint32_t rtp_timestamp, |
| 23 | const int16_t* audio, |
| 24 | size_t num_samples_per_channel, |
| 25 | size_t max_encoded_bytes, |
| 26 | uint8_t* encoded, |
| 27 | EncodedInfo* info) { |
| 28 | CHECK_EQ(num_samples_per_channel, |
| 29 | static_cast<size_t>(sample_rate_hz() / 100)); |
| 30 | bool ret = |
| 31 | EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded, info); |
| 32 | CHECK_LE(info->encoded_bytes, max_encoded_bytes); |
| 33 | return ret; |
| 34 | } |
| 35 | |
henrik.lundin@webrtc.org | 478cedc | 2015-01-27 18:24:45 +0000 | [diff] [blame] | 36 | int AudioEncoder::rtp_timestamp_rate_hz() const { |
| 37 | return sample_rate_hz(); |
| 38 | } |
| 39 | |
henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 40 | } // namespace webrtc |