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

Side by Side Diff: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h

Issue 1764583003: Renamed new EncodeInternal to EncodeImpl to ensure proper backwards compatibility. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Clarified doc comments in AudioEncoder. Created 4 years, 9 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
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
(...skipping 12 matching lines...) Expand all
23 23
24 // Deleter for use with unique_ptr. 24 // Deleter for use with unique_ptr.
25 struct CngInstDeleter { 25 struct CngInstDeleter {
26 void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); } 26 void operator()(CNG_enc_inst* ptr) const { WebRtcCng_FreeEnc(ptr); }
27 }; 27 };
28 28
29 class Vad; 29 class Vad;
30 30
31 class AudioEncoderCng final : public AudioEncoder { 31 class AudioEncoderCng final : public AudioEncoder {
32 public: 32 public:
33 using AudioEncoder::EncodeInternal;
34
35 struct Config { 33 struct Config {
36 bool IsOk() const; 34 bool IsOk() const;
37 35
38 size_t num_channels = 1; 36 size_t num_channels = 1;
39 int payload_type = 13; 37 int payload_type = 13;
40 // Caller keeps ownership of the AudioEncoder object. 38 // Caller keeps ownership of the AudioEncoder object.
41 AudioEncoder* speech_encoder = nullptr; 39 AudioEncoder* speech_encoder = nullptr;
42 Vad::Aggressiveness vad_mode = Vad::kVadNormal; 40 Vad::Aggressiveness vad_mode = Vad::kVadNormal;
43 int sid_frame_interval_ms = 100; 41 int sid_frame_interval_ms = 100;
44 int num_cng_coefficients = 8; 42 int num_cng_coefficients = 8;
45 // The Vad pointer is mainly for testing. If a NULL pointer is passed, the 43 // The Vad pointer is mainly for testing. If a NULL pointer is passed, the
46 // AudioEncoderCng creates (and destroys) a Vad object internally. If an 44 // AudioEncoderCng creates (and destroys) a Vad object internally. If an
47 // object is passed, the AudioEncoderCng assumes ownership of the Vad 45 // object is passed, the AudioEncoderCng assumes ownership of the Vad
48 // object. 46 // object.
49 Vad* vad = nullptr; 47 Vad* vad = nullptr;
50 }; 48 };
51 49
52 explicit AudioEncoderCng(const Config& config); 50 explicit AudioEncoderCng(const Config& config);
53 ~AudioEncoderCng() override; 51 ~AudioEncoderCng() override;
54 52
55 size_t MaxEncodedBytes() const override; 53 size_t MaxEncodedBytes() const override;
56 int SampleRateHz() const override; 54 int SampleRateHz() const override;
57 size_t NumChannels() const override; 55 size_t NumChannels() const override;
58 int RtpTimestampRateHz() const override; 56 int RtpTimestampRateHz() const override;
59 size_t Num10MsFramesInNextPacket() const override; 57 size_t Num10MsFramesInNextPacket() const override;
60 size_t Max10MsFramesInAPacket() const override; 58 size_t Max10MsFramesInAPacket() const override;
61 int GetTargetBitrate() const override; 59 int GetTargetBitrate() const override;
62 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, 60 EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
63 rtc::ArrayView<const int16_t> audio, 61 rtc::ArrayView<const int16_t> audio,
64 rtc::Buffer* encoded) override; 62 rtc::Buffer* encoded) override;
65 void Reset() override; 63 void Reset() override;
66 bool SetFec(bool enable) override; 64 bool SetFec(bool enable) override;
67 bool SetDtx(bool enable) override; 65 bool SetDtx(bool enable) override;
68 bool SetApplication(Application application) override; 66 bool SetApplication(Application application) override;
69 void SetMaxPlaybackRate(int frequency_hz) override; 67 void SetMaxPlaybackRate(int frequency_hz) override;
70 void SetProjectedPacketLossRate(double fraction) override; 68 void SetProjectedPacketLossRate(double fraction) override;
71 void SetTargetBitrate(int target_bps) override; 69 void SetTargetBitrate(int target_bps) override;
72 70
73 private: 71 private:
74 EncodedInfo EncodePassive(size_t frames_to_encode, 72 EncodedInfo EncodePassive(size_t frames_to_encode,
(...skipping 11 matching lines...) Expand all
86 bool last_frame_active_; 84 bool last_frame_active_;
87 std::unique_ptr<Vad> vad_; 85 std::unique_ptr<Vad> vad_;
88 std::unique_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_; 86 std::unique_ptr<CNG_enc_inst, CngInstDeleter> cng_inst_;
89 87
90 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderCng); 88 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderCng);
91 }; 89 };
92 90
93 } // namespace webrtc 91 } // namespace webrtc
94 92
95 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_ 93 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_CNG_AUDIO_ENCODER_CNG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698