blob: 1d83e54a0d749853321d41ef942071c92e024057 [file] [log] [blame]
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +00001/*
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.orgf45c8ca2015-02-05 18:29:39 +000012#include "webrtc/base/checks.h"
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000013
14namespace webrtc {
15
16AudioEncoder::EncodedInfo::EncodedInfo() : EncodedInfoLeaf() {
17}
18
19AudioEncoder::EncodedInfo::~EncodedInfo() {
20}
21
tommi@webrtc.org019955d2015-03-18 06:38:04 +000022void 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) {
henrik.lundin@webrtc.orgf45c8ca2015-02-05 18:29:39 +000028 CHECK_EQ(num_samples_per_channel,
kwiberg@webrtc.org05211272015-02-18 12:00:32 +000029 static_cast<size_t>(SampleRateHz() / 100));
tommi@webrtc.org019955d2015-03-18 06:38:04 +000030 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded, info);
31 CHECK_LE(info->encoded_bytes, max_encoded_bytes);
henrik.lundin@webrtc.orgf45c8ca2015-02-05 18:29:39 +000032}
33
kwiberg@webrtc.org05211272015-02-18 12:00:32 +000034int AudioEncoder::RtpTimestampRateHz() const {
35 return SampleRateHz();
henrik.lundin@webrtc.org478cedc2015-01-27 18:24:45 +000036}
37
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000038} // namespace webrtc