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

Side by Side Diff: webrtc/modules/audio_coding/codecs/g711/include/audio_encoder_pcm.h

Issue 1184313002: Add AudioEncoder::GetTargetBitrate (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Getting rid of erroneous code Created 5 years, 6 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 23 matching lines...) Expand all
34 : frame_size_ms(20), num_channels(1), payload_type(pt) {} 34 : frame_size_ms(20), num_channels(1), payload_type(pt) {}
35 }; 35 };
36 36
37 ~AudioEncoderPcm() override; 37 ~AudioEncoderPcm() override;
38 38
39 int SampleRateHz() const override; 39 int SampleRateHz() const override;
40 int NumChannels() const override; 40 int NumChannels() const override;
41 size_t MaxEncodedBytes() const override; 41 size_t MaxEncodedBytes() const override;
42 int Num10MsFramesInNextPacket() const override; 42 int Num10MsFramesInNextPacket() const override;
43 int Max10MsFramesInAPacket() const override; 43 int Max10MsFramesInAPacket() const override;
44 int SetTargetBitrate(int bits_per_second) override;
44 EncodedInfo EncodeInternal(uint32_t rtp_timestamp, 45 EncodedInfo EncodeInternal(uint32_t rtp_timestamp,
45 const int16_t* audio, 46 const int16_t* audio,
46 size_t max_encoded_bytes, 47 size_t max_encoded_bytes,
47 uint8_t* encoded) override; 48 uint8_t* encoded) override;
48 49
49 protected: 50 protected:
50 AudioEncoderPcm(const Config& config, int sample_rate_hz); 51 AudioEncoderPcm(const Config& config, int sample_rate_hz);
51 52
52 virtual int16_t EncodeCall(const int16_t* audio, 53 virtual int16_t EncodeCall(const int16_t* audio,
53 size_t input_len, 54 size_t input_len,
54 uint8_t* encoded) = 0; 55 uint8_t* encoded) = 0;
55 56
56 private: 57 private:
57 const int sample_rate_hz_; 58 const int sample_rate_hz_;
58 const int num_channels_; 59 const int num_channels_;
59 const int payload_type_; 60 const int payload_type_;
60 const int num_10ms_frames_per_packet_; 61 const int num_10ms_frames_per_packet_;
61 const size_t full_frame_samples_; 62 const size_t full_frame_samples_;
62 std::vector<int16_t> speech_buffer_; 63 std::vector<int16_t> speech_buffer_;
63 uint32_t first_timestamp_in_buffer_; 64 uint32_t first_timestamp_in_buffer_;
64 }; 65 };
65 66
66 class AudioEncoderPcmA : public AudioEncoderPcm { 67 class AudioEncoderPcmA final : public AudioEncoderPcm {
67 public: 68 public:
68 struct Config : public AudioEncoderPcm::Config { 69 struct Config : public AudioEncoderPcm::Config {
69 Config() : AudioEncoderPcm::Config(8) {} 70 Config() : AudioEncoderPcm::Config(8) {}
70 }; 71 };
71 72
72 explicit AudioEncoderPcmA(const Config& config) 73 explicit AudioEncoderPcmA(const Config& config)
73 : AudioEncoderPcm(config, kSampleRateHz) {} 74 : AudioEncoderPcm(config, kSampleRateHz) {}
74 75
75 protected: 76 protected:
76 int16_t EncodeCall(const int16_t* audio, 77 int16_t EncodeCall(const int16_t* audio,
77 size_t input_len, 78 size_t input_len,
78 uint8_t* encoded) override; 79 uint8_t* encoded) override;
79 80
80 private: 81 private:
81 static const int kSampleRateHz = 8000; 82 static const int kSampleRateHz = 8000;
82 }; 83 };
83 84
84 class AudioEncoderPcmU : public AudioEncoderPcm { 85 class AudioEncoderPcmU final : public AudioEncoderPcm {
85 public: 86 public:
86 struct Config : public AudioEncoderPcm::Config { 87 struct Config : public AudioEncoderPcm::Config {
87 Config() : AudioEncoderPcm::Config(0) {} 88 Config() : AudioEncoderPcm::Config(0) {}
88 }; 89 };
89 90
90 explicit AudioEncoderPcmU(const Config& config) 91 explicit AudioEncoderPcmU(const Config& config)
91 : AudioEncoderPcm(config, kSampleRateHz) {} 92 : AudioEncoderPcm(config, kSampleRateHz) {}
92 93
93 protected: 94 protected:
94 int16_t EncodeCall(const int16_t* audio, 95 int16_t EncodeCall(const int16_t* audio,
(...skipping 13 matching lines...) Expand all
108 }; 109 };
109 110
110 class AudioEncoderMutablePcmA 111 class AudioEncoderMutablePcmA
111 : public AudioEncoderMutableImpl<AudioEncoderPcmA> { 112 : public AudioEncoderMutableImpl<AudioEncoderPcmA> {
112 public: 113 public:
113 explicit AudioEncoderMutablePcmA(const CodecInst& codec_inst); 114 explicit AudioEncoderMutablePcmA(const CodecInst& codec_inst);
114 }; 115 };
115 116
116 } // namespace webrtc 117 } // namespace webrtc
117 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_INCLUDE_AUDIO_ENCODER_PCM_H_ 118 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G711_INCLUDE_AUDIO_ENCODER_PCM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698