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 | |
kwiberg | 12cfc9b | 2015-09-08 05:57:53 -0700 | [diff] [blame] | 16 | AudioEncoder::EncodedInfo::EncodedInfo() = default; |
henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 17 | |
kwiberg | 12cfc9b | 2015-09-08 05:57:53 -0700 | [diff] [blame] | 18 | AudioEncoder::EncodedInfo::~EncodedInfo() = default; |
| 19 | |
| 20 | int AudioEncoder::RtpTimestampRateHz() const { |
| 21 | return SampleRateHz(); |
henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 22 | } |
| 23 | |
kwiberg | 288886b | 2015-11-06 01:21:35 -0800 | [diff] [blame] | 24 | AudioEncoder::EncodedInfo AudioEncoder::Encode( |
| 25 | uint32_t rtp_timestamp, |
| 26 | rtc::ArrayView<const int16_t> audio, |
| 27 | size_t max_encoded_bytes, |
| 28 | uint8_t* encoded) { |
| 29 | RTC_CHECK_EQ(audio.size(), |
| 30 | static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); |
jmarusic@webrtc.org | 9afaee7 | 2015-03-19 08:50:26 +0000 | [diff] [blame] | 31 | EncodedInfo info = |
| 32 | EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded); |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 33 | RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes); |
jmarusic@webrtc.org | 9afaee7 | 2015-03-19 08:50:26 +0000 | [diff] [blame] | 34 | return info; |
henrik.lundin@webrtc.org | f45c8ca | 2015-02-05 18:29:39 +0000 | [diff] [blame] | 35 | } |
| 36 | |
kwiberg | 12cfc9b | 2015-09-08 05:57:53 -0700 | [diff] [blame] | 37 | bool AudioEncoder::SetFec(bool enable) { |
| 38 | return !enable; |
henrik.lundin@webrtc.org | 478cedc | 2015-01-27 18:24:45 +0000 | [diff] [blame] | 39 | } |
| 40 | |
kwiberg | 12cfc9b | 2015-09-08 05:57:53 -0700 | [diff] [blame] | 41 | bool AudioEncoder::SetDtx(bool enable) { |
| 42 | return !enable; |
| 43 | } |
| 44 | |
| 45 | bool AudioEncoder::SetApplication(Application application) { |
| 46 | return false; |
| 47 | } |
| 48 | |
kwiberg | 3f5f1c2 | 2015-09-08 23:15:33 -0700 | [diff] [blame] | 49 | void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} |
kwiberg | 12cfc9b | 2015-09-08 05:57:53 -0700 | [diff] [blame] | 50 | |
| 51 | void AudioEncoder::SetProjectedPacketLossRate(double fraction) {} |
| 52 | |
| 53 | void AudioEncoder::SetTargetBitrate(int target_bps) {} |
| 54 | |
henrik.lundin@webrtc.org | c1c9291 | 2014-12-16 13:41:36 +0000 | [diff] [blame] | 55 | } // namespace webrtc |