Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: webrtc/modules/audio_coding/codecs/audio_encoder.cc

Issue 2799033006: Injectable audio encoders: Moved audio encoder, factory and builtin factory to api/. (Closed)
Patch Set: More backwards-compatibility! Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 int AudioEncoder::RtpTimestampRateHz() const {
28 return SampleRateHz();
29 }
30
31 AudioEncoder::EncodedInfo AudioEncoder::Encode(
32 uint32_t rtp_timestamp,
33 rtc::ArrayView<const int16_t> audio,
34 rtc::Buffer* encoded) {
35 TRACE_EVENT0("webrtc", "AudioEncoder::Encode");
36 RTC_CHECK_EQ(audio.size(),
37 static_cast<size_t>(NumChannels() * SampleRateHz() / 100));
38
39 const size_t old_size = encoded->size();
40 EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded);
41 RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes);
42 return info;
43 }
44
45 bool AudioEncoder::SetFec(bool enable) {
46 return !enable;
47 }
48
49 bool AudioEncoder::SetDtx(bool enable) {
50 return !enable;
51 }
52
53 bool AudioEncoder::GetDtx() const {
54 return false;
55 }
56
57 bool AudioEncoder::SetApplication(Application application) {
58 return false;
59 }
60
61 void AudioEncoder::SetMaxPlaybackRate(int frequency_hz) {}
62
63 void AudioEncoder::SetTargetBitrate(int target_bps) {}
64
65 rtc::ArrayView<std::unique_ptr<AudioEncoder>>
66 AudioEncoder::ReclaimContainedEncoders() { return nullptr; }
67
68 bool AudioEncoder::EnableAudioNetworkAdaptor(const std::string& config_string,
69 RtcEventLog* event_log) {
70 return false;
71 }
72
73 void AudioEncoder::DisableAudioNetworkAdaptor() {}
74
75 void AudioEncoder::OnReceivedUplinkPacketLossFraction(
76 float uplink_packet_loss_fraction) {}
77
78 void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
79 float uplink_recoverable_packet_loss_fraction) {}
80
81 void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
82 OnReceivedUplinkBandwidth(target_audio_bitrate_bps, rtc::Optional<int64_t>());
83 }
84
85 void AudioEncoder::OnReceivedUplinkBandwidth(
86 int target_audio_bitrate_bps,
87 rtc::Optional<int64_t> probing_interval_ms) {}
88
89 void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
90
91 void AudioEncoder::OnReceivedOverhead(size_t overhead_bytes_per_packet) {}
92
93 void AudioEncoder::SetReceiverFrameLengthRange(int min_frame_length_ms,
94 int max_frame_length_ms) {}
95
96 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/audio_encoder.h ('k') | webrtc/modules/audio_coding/codecs/audio_encoder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698