Home | History | Annotate | Download | only in codecs
      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"
     12 
     13 #include "webrtc/base/checks.h"
     14 #include "webrtc/base/trace_event.h"
     15 
     16 namespace webrtc {
     17 
     18 AudioEncoder::EncodedInfo::EncodedInfo() = default;
     19 
     20 AudioEncoder::EncodedInfo::~EncodedInfo() = default;
     21 
     22 int AudioEncoder::RtpTimestampRateHz() const {
     23   return SampleRateHz();
     24 }
     25 
     26 AudioEncoder::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) {
     31   TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
     32   RTC_CHECK_EQ(audio.size(),
     33                static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
     34   EncodedInfo info =
     35       EncodeInternal(rtp_timestamp, audio, max_encoded_bytes, encoded);
     36   RTC_CHECK_LE(info.encoded_bytes, max_encoded_bytes);
     37   return info;
     38 }
     39 
     40 bool AudioEncoder::SetFec(bool enable) {
     41   return !enable;
     42 }
     43 
     44 bool AudioEncoder::SetDtx(bool enable) {
     45   return !enable;
     46 }
     47 
     48 bool AudioEncoder::SetApplication(Application application) {
     49   return false;
     50 }
     51 
     52 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
     53 
     54 void AudioEncoder::SetProjectedPacketLossRate(double fraction) {}
     55 
     56 void AudioEncoder::SetTargetBitrate(int target_bps) {}
     57 
     58 }  // namespace webrtc
     59