Line data Source code
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 : AudioEncoder::EncodedInfo::EncodedInfo(const EncodedInfo&) = default;
20 : AudioEncoder::EncodedInfo::EncodedInfo(EncodedInfo&&) = default;
21 : AudioEncoder::EncodedInfo::~EncodedInfo() = default;
22 : AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(
23 : const EncodedInfo&) = default;
24 : AudioEncoder::EncodedInfo& AudioEncoder::EncodedInfo::operator=(EncodedInfo&&) =
25 : default;
26 :
27 0 : int AudioEncoder::RtpTimestampRateHz() const {
28 0 : return SampleRateHz();
29 : }
30 :
31 0 : AudioEncoder::EncodedInfo AudioEncoder::Encode(
32 : uint32_t rtp_timestamp,
33 : rtc::ArrayView<const int16_t> audio,
34 : rtc::Buffer* encoded) {
35 0 : TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
36 0 : RTC_CHECK_EQ(audio.size(),
37 0 : static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
38 :
39 0 : const size_t old_size = encoded->size();
40 0 : EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
41 0 : RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
42 0 : return info;
43 : }
44 :
45 0 : bool AudioEncoder::SetFec(bool enable) {
46 0 : return !enable;
47 : }
48 :
49 0 : bool AudioEncoder::SetDtx(bool enable) {
50 0 : return !enable;
51 : }
52 :
53 0 : bool AudioEncoder::GetDtx() const {
54 0 : return false;
55 : }
56 :
57 0 : bool AudioEncoder::SetApplication(Application application) {
58 0 : return false;
59 : }
60 :
61 0 : void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
62 :
63 0 : void AudioEncoder::SetTargetBitrate(int target_bps) {}
64 :
65 : rtc::ArrayView<std::unique_ptr<AudioEncoder>>
66 0 : AudioEncoder::ReclaimContainedEncoders() { return nullptr; }
67 :
68 0 : bool AudioEncoder::EnableAudioNetworkAdaptor(const std::string& config_string,
69 : RtcEventLog* event_log,
70 : const Clock* clock) {
71 0 : return false;
72 : }
73 :
74 0 : void AudioEncoder::DisableAudioNetworkAdaptor() {}
75 :
76 0 : void AudioEncoder::OnReceivedUplinkPacketLossFraction(
77 0 : float uplink_packet_loss_fraction) {}
78 :
79 0 : void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
80 0 : OnReceivedUplinkBandwidth(target_audio_bitrate_bps, rtc::Optional<int64_t>());
81 0 : }
82 :
83 0 : void AudioEncoder::OnReceivedUplinkBandwidth(
84 : int target_audio_bitrate_bps,
85 0 : rtc::Optional<int64_t> probing_interval_ms) {}
86 :
87 0 : void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
88 :
89 0 : void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {}
90 :
91 0 : void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms,
92 0 : int max_frame_length_ms) {}
93 :
94 : } // namespace webrtc
|