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

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

Issue 2528933002: Adding OnReceivedOverhead to AudioEncoder. (Closed)
Patch Set: on Michael's comments Created 4 years 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
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 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/array_view.h" 17 #include "webrtc/base/array_view.h"
18 #include "webrtc/base/buffer.h" 18 #include "webrtc/base/buffer.h"
19 #include "webrtc/base/deprecation.h" 19 #include "webrtc/base/deprecation.h"
20 #include "webrtc/base/optional.h"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class Clock; 25 class Clock;
25 26
26 // This is the interface class for encoders in AudioCoding module. Each codec 27 // This is the interface class for encoders in AudioCoding module. Each codec
27 // type must have an implementation of this class. 28 // type must have an implementation of this class.
28 class AudioEncoder { 29 class AudioEncoder {
29 public: 30 public:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 EncodedInfo(); 70 EncodedInfo();
70 EncodedInfo(const EncodedInfo&); 71 EncodedInfo(const EncodedInfo&);
71 EncodedInfo(EncodedInfo&&); 72 EncodedInfo(EncodedInfo&&);
72 ~EncodedInfo(); 73 ~EncodedInfo();
73 EncodedInfo& operator=(const EncodedInfo&); 74 EncodedInfo& operator=(const EncodedInfo&);
74 EncodedInfo& operator=(EncodedInfo&&); 75 EncodedInfo& operator=(EncodedInfo&&);
75 76
76 std::vector<EncodedInfoLeaf> redundant; 77 std::vector<EncodedInfoLeaf> redundant;
77 }; 78 };
78 79
79 virtual ~AudioEncoder() = default; 80 AudioEncoder();
81 virtual ~AudioEncoder();
80 82
81 // Returns the input sample rate in Hz and the number of input channels. 83 // Returns the input sample rate in Hz and the number of input channels.
82 // These are constants set at instantiation time. 84 // These are constants set at instantiation time.
83 virtual int SampleRateHz() const = 0; 85 virtual int SampleRateHz() const = 0;
84 virtual size_t NumChannels() const = 0; 86 virtual size_t NumChannels() const = 0;
85 87
86 // Returns the rate at which the RTP timestamps are updated. The default 88 // Returns the rate at which the RTP timestamps are updated. The default
87 // implementation returns SampleRateHz(). 89 // implementation returns SampleRateHz().
88 virtual int RtpTimestampRateHz() const; 90 virtual int RtpTimestampRateHz() const;
89 91
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Provides uplink packet loss fraction to this encoder to allow it to adapt. 179 // Provides uplink packet loss fraction to this encoder to allow it to adapt.
178 virtual void OnReceivedUplinkPacketLossFraction( 180 virtual void OnReceivedUplinkPacketLossFraction(
179 float uplink_packet_loss_fraction); 181 float uplink_packet_loss_fraction);
180 182
181 // Provides target audio bitrate to this encoder to allow it to adapt. 183 // Provides target audio bitrate to this encoder to allow it to adapt.
182 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps); 184 virtual void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps);
183 185
184 // Provides RTT to this encoder to allow it to adapt. 186 // Provides RTT to this encoder to allow it to adapt.
185 virtual void OnReceivedRtt(int rtt_ms); 187 virtual void OnReceivedRtt(int rtt_ms);
186 188
189 // Provides overhead size to this encoder for it to determine the bitrate
190 // for the payload.
kwiberg-webrtc 2016/11/29 09:46:24 Please consider spending a few more words describi
minyue-webrtc 2016/12/02 10:07:34 Done.
191 virtual void OnReceivedOverhead(size_t overhead_bytes_per_packet);
192
187 // To allow encoder to adapt its frame length, it must be provided the frame 193 // To allow encoder to adapt its frame length, it must be provided the frame
188 // length range that receivers can accept. 194 // length range that receivers can accept.
189 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, 195 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
190 int max_frame_length_ms); 196 int max_frame_length_ms);
191 197
192 protected: 198 protected:
193 // Subclasses implement this to perform the actual encoding. Called by 199 // Subclasses implement this to perform the actual encoding. Called by
194 // Encode(). 200 // Encode().
195 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, 201 virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
196 rtc::ArrayView<const int16_t> audio, 202 rtc::ArrayView<const int16_t> audio,
197 rtc::Buffer* encoded) = 0; 203 rtc::Buffer* encoded) = 0;
204 rtc::Optional<size_t> overhead_bytes_per_packet_;
kwiberg-webrtc 2016/11/29 09:46:24 Interface classes should not have data members! I
minyue-webrtc 2016/12/02 10:07:34 Done.
198 }; 205 };
199 } // namespace webrtc 206 } // namespace webrtc
200 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ 207 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698