| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 11 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 12 |
| 12 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/trace_event.h" |
| 13 | 15 |
| 14 namespace webrtc { | 16 namespace webrtc { |
| 15 | 17 |
| 16 AudioEncoder::EncodedInfo::EncodedInfo() = default; | 18 AudioEncoder::EncodedInfo::EncodedInfo() = default; |
| 17 | 19 |
| 18 AudioEncoder::EncodedInfo::~EncodedInfo() = default; | 20 AudioEncoder::EncodedInfo::~EncodedInfo() = default; |
| 19 | 21 |
| 20 int AudioEncoder::RtpTimestampRateHz() const { | 22 int AudioEncoder::RtpTimestampRateHz() const { |
| 21 return SampleRateHz(); | 23 return SampleRateHz(); |
| 22 } | 24 } |
| 23 | 25 |
| 24 AudioEncoder::EncodedInfo AudioEncoder::Encode( | 26 AudioEncoder::EncodedInfo AudioEncoder::Encode( |
| 25 uint32_t rtp_timestamp, | 27 uint32_t rtp_timestamp, |
| 26 rtc::ArrayView<const int16_t> audio, | 28 rtc::ArrayView<const int16_t> audio, |
| 27 size_t max_encoded_bytes, | 29 size_t max_encoded_bytes, |
| 28 uint8_t* encoded) { | 30 uint8_t* encoded) { |
| 31 TRACE_EVENT0("webrtc", "AudioEncoder::Encode"); |
| 29 RTC_CHECK_EQ(audio.size(), | 32 RTC_CHECK_EQ(audio.size(), |
| 30 static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); | 33 static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); |
| 31 EncodedInfo info = | 34 EncodedInfo info = |
| 32 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded); | 35 EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded); |
| 33 RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes); | 36 RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes); |
| 34 return info; | 37 return info; |
| 35 } | 38 } |
| 36 | 39 |
| 37 bool AudioEncoder::SetFec(bool enable) { | 40 bool AudioEncoder::SetFec(bool enable) { |
| 38 return !enable; | 41 return !enable; |
| 39 } | 42 } |
| 40 | 43 |
| 41 bool AudioEncoder::SetDtx(bool enable) { | 44 bool AudioEncoder::SetDtx(bool enable) { |
| 42 return !enable; | 45 return !enable; |
| 43 } | 46 } |
| 44 | 47 |
| 45 bool AudioEncoder::SetApplication(Application application) { | 48 bool AudioEncoder::SetApplication(Application application) { |
| 46 return false; | 49 return false; |
| 47 } | 50 } |
| 48 | 51 |
| 49 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} | 52 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} |
| 50 | 53 |
| 51 void AudioEncoder::SetProjectedPacketLossRate(double fraction) {} | 54 void AudioEncoder::SetProjectedPacketLossRate(double fraction) {} |
| 52 | 55 |
| 53 void AudioEncoder::SetTargetBitrate(int target_bps) {} | 56 void AudioEncoder::SetTargetBitrate(int target_bps) {} |
| 54 | 57 |
| 55 } // namespace webrtc | 58 } // namespace webrtc |
| OLD | NEW |