blob: 000371d28ac099adbf7ba42ba9e8ed8f6f3f1e85 [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;
kjellander470dd372016-04-19 03:03:23 -070019AudioEncoder::EncodedInfo::EncodedInfo(const EncodedInfo&) = default;
kwiberg4fb3d2b2016-04-22 04:59:31 -070020AudioEncoder::EncodedInfo::EncodedInfo(EncodedInfo&&) = default;
kwiberg12cfc9b2015-09-08 05:57:53 -070021AudioEncoder::EncodedInfo::~EncodedInfo() = default;
kwiberg4fb3d2b2016-04-22 04:59:31 -070022AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(
23 const EncodedInfo&) = default;
24AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) =
25 default;
kwiberg12cfc9b2015-09-08 05:57:53 -070026
27int AudioEncoder::RtpTimestampRateHz() const {
28 return SampleRateHz();
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000029}
30
kwiberg288886b2015-11-06 01:21:35 -080031AudioEncoder::EncodedInfo AudioEncoder::Encode(
32 uint32_t rtp_timestamp,
33 rtc::ArrayView<const int16_t> audio,
ossu10a029e2016-03-01 00:41:31 -080034 rtc::Buffer* encoded) {
35 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
36 RTC_CHECK_EQ(audio.size(),
37 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
38
39 const size_t old_size = encoded->size();
ossu4f43fcf2016-03-04 00:54:32 -080040 EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
ossu10a029e2016-03-01 00:41:31 -080041 RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
42 return info;
43}
44
kwiberg12cfc9b2015-09-08 05:57:53 -070045bool AudioEncoder::SetFec(bool enable) {
46 return !enable;
henrik.lundin@webrtc.org478cedc2015-01-27 18:24:45 +000047}
48
kwiberg12cfc9b2015-09-08 05:57:53 -070049bool AudioEncoder::SetDtx(bool enable) {
50 return !enable;
51}
52
53bool AudioEncoder::SetApplication(Application application) {
54 return false;
55}
56
kwiberg3f5f1c22015-09-08 23:15:33 -070057void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
kwiberg12cfc9b2015-09-08 05:57:53 -070058
59void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}
60
61void AudioEncoder::SetTargetBitrate(int target_bps) {}
62
henrik.lundin@webrtc.orgc1c92912014-12-16 13:41:36 +000063} // namespace webrtc