blob: fa262c46446baeb329edef103d134e0874841a5c [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"
Peter Boströmd7b7ae82015-12-08 13:41:35 +010012
henrik.lundin@webrtc.orgf45c8ca2015-02-05 18:29:39 +000013#include "webrtc/base/checks.h"
Peter Boströmd7b7ae82015-12-08 13:41:35 +010014#include "webrtc/base/trace_event.h"
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000015
16namespace webrtc {
17
kwiberg12cfc9b2015-09-08 05:57:53 -070018AudioEncoder::EncodedInfo::EncodedInfo() = default;
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000019
kwiberg12cfc9b2015-09-08 05:57:53 -070020AudioEncoder::EncodedInfo::~EncodedInfo() = default;
21
22int AudioEncoder::RtpTimestampRateHz() const {
23 return SampleRateHz();
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000024}
25
kwiberg288886b2015-11-06 01:21:35 -080026AudioEncoder::EncodedInfo AudioEncoder::Encode(
27 uint32_t rtp_timestamp,
28 rtc::ArrayView<const int16_t> audio,
ossu10a029e2016-03-01 00:41:31 -080029 rtc::Buffer* encoded) {
30 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
31 RTC_CHECK_EQ(audio.size(),
32 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
33
34 const size_t old_size = encoded->size();
ossu4f43fcf2016-03-04 00:54:32 -080035 EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
ossu10a029e2016-03-01 00:41:31 -080036 RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
37 return info;
38}
39
kwiberg12cfc9b2015-09-08 05:57:53 -070040bool AudioEncoder::SetFec(bool enable) {
41 return !enable;
henrik.lundin@webrtc.org478cedc2015-01-27 18:24:45 +000042}
43
kwiberg12cfc9b2015-09-08 05:57:53 -070044bool AudioEncoder::SetDtx(bool enable) {
45 return !enable;
46}
47
48bool AudioEncoder::SetApplication(Application application) {
49 return false;
50}
51
kwiberg3f5f1c22015-09-08 23:15:33 -070052void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
kwiberg12cfc9b2015-09-08 05:57:53 -070053
54void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}
55
56void AudioEncoder::SetTargetBitrate(int target_bps) {}
57
ossu2903ba52016-04-18 06:14:33 -070058size_t AudioEncoder::MaxEncodedBytes() const {
59 RTC_CHECK(false);
60 return 0;
61}
62
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000063} // namespace webrtc