blob: e99fc30995995dea55ba1bcae4347b784e4691f3 [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,
29 size_t max_encoded_bytes,
30 uint8_t* encoded) {
Peter Boströmd7b7ae82015-12-08 13:41:35 +010031 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
kwiberg288886b2015-11-06 01:21:35 -080032 RTC_CHECK_EQ(audio.size(),
33 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
jmarusic@webrtc.org9afaee72015-03-19 08:50:26 +000034 EncodedInfo info =
35 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded);
henrikg91d6ede2015-09-17 00:24:34 -070036 RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes);
jmarusic@webrtc.org9afaee72015-03-19 08:50:26 +000037 return info;
henrik.lundin@webrtc.orgf45c8ca2015-02-05 18:29:39 +000038}
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
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000058} // namespace webrtc