| 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 "api/audio_codecs/audio_encoder.h" |
| 12 |
| 13 | #include "rtc_base/checks.h" |
| 14 | #include "rtc_base/trace_event.h" |
| 15 |
| 16 | namespace webrtc { |
| 17 |
| 18 | ANAStats::ANAStats() = default; |
| 19 | ANAStats::~ANAStats() = default; |
| 20 | ANAStats::ANAStats(const ANAStats&) = default; |
| 21 |
| 22 | AudioEncoder::EncodedInfo::EncodedInfo() = default; |
| 23 | AudioEncoder::EncodedInfo::EncodedInfo(const EncodedInfo&) = default; |
| 24 | AudioEncoder::EncodedInfo::EncodedInfo(EncodedInfo&&) = default; |
| 25 | AudioEncoder::EncodedInfo::~EncodedInfo() = default; |
| 26 | AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=( |
| 27 | const EncodedInfo&) = default; |
| 28 | AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) = |
| 29 | default; |
| 30 |
| 31 | int AudioEncoder::RtpTimestampRateHz() const { |
| 32 | return SampleRateHz(); |
| 33 | } |
| 34 |
| 35 | AudioEncoder::EncodedInfo AudioEncoder::Encode( |
| 36 | uint32_t rtp_timestamp, |
| 37 | rtc::ArrayView<const int16_t> audio, |
| 38 | rtc::Buffer* encoded) { |
| 39 | TRACE_EVENT0("webrtc", "AudioEncoder::Encode"); |
| 40 | RTC_CHECK_EQ(audio.size(), |
| 41 | static_cast<size_t>(NumChannels() * SampleRateHz() / 100)); |
| 42 |
| 43 | const size_t old_size = encoded->size(); |
| 44 | EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded); |
| 45 | RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes); |
| 46 | return info; |
| 47 | } |
| 48 |
| 49 | bool AudioEncoder::SetFec(bool enable) { |
| 50 | return !enable; |
| 51 | } |
| 52 |
| 53 | bool AudioEncoder::SetDtx(bool enable) { |
| 54 | return !enable; |
| 55 | } |
| 56 |
| 57 | bool AudioEncoder::GetDtx() const { |
| 58 | return false; |
| 59 | } |
| 60 |
| 61 | bool AudioEncoder::SetApplication(Application application) { |
| 62 | return false; |
| 63 | } |
| 64 |
| 65 | void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {} |
| 66 |
| 67 | void AudioEncoder::SetTargetBitrate(int target_bps) {} |
| 68 |
| 69 | rtc::ArrayView<std::unique_ptr<AudioEncoder>> |
| 70 | AudioEncoder::ReclaimContainedEncoders() { |
| 71 | return nullptr; |
| 72 | } |
| 73 |
| 74 | bool AudioEncoder::EnableAudioNetworkAdaptor(const std::string& config_string, |
| 75 | RtcEventLog* event_log) { |
| 76 | return false; |
| 77 | } |
| 78 |
| 79 | void AudioEncoder::DisableAudioNetworkAdaptor() {} |
| 80 |
| 81 | void AudioEncoder::OnReceivedUplinkPacketLossFraction( |
| 82 | float uplink_packet_loss_fraction) {} |
| 83 |
| 84 | void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction( |
| 85 | float uplink_recoverable_packet_loss_fraction) { |
| 86 | RTC_NOTREACHED(); |
| 87 | } |
| 88 |
| 89 | void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) { |
| 90 | OnReceivedUplinkBandwidth(target_audio_bitrate_bps, absl::nullopt); |
| 91 | } |
| 92 |
| 93 | void AudioEncoder::OnReceivedUplinkBandwidth( |
| 94 | int target_audio_bitrate_bps, |
| 95 | absl::optional<int64_t> bwe_period_ms) {} |
| 96 |
| 97 | void AudioEncoder::OnReceivedUplinkAllocation(BitrateAllocationUpdate update) { |
| 98 | OnReceivedUplinkBandwidth(update.target_bitrate.bps(), |
| 99 | update.bwe_period.ms()); |
| 100 | } |
| 101 |
| 102 | void AudioEncoder::OnReceivedRtt(int rtt_ms) {} |
| 103 |
| 104 | void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {} |
| 105 |
| 106 | void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms, |
| 107 | int max_frame_length_ms) {} |
| 108 |
| 109 | ANAStats AudioEncoder::GetANAStats() const { |
| 110 | return ANAStats(); |
| 111 | } |
| 112 |
| 113 | } // namespace webrtc |
| 114 |