OLD | NEW |
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 encoders_[i].encoded_buffer.SetSize(samples_per_channel / 2); | 53 encoders_[i].encoded_buffer.SetSize(samples_per_channel / 2); |
54 } | 54 } |
55 Reset(); | 55 Reset(); |
56 } | 56 } |
57 | 57 |
58 AudioEncoderG722::AudioEncoderG722(const CodecInst& codec_inst) | 58 AudioEncoderG722::AudioEncoderG722(const CodecInst& codec_inst) |
59 : AudioEncoderG722(CreateConfig(codec_inst)) {} | 59 : AudioEncoderG722(CreateConfig(codec_inst)) {} |
60 | 60 |
61 AudioEncoderG722::~AudioEncoderG722() = default; | 61 AudioEncoderG722::~AudioEncoderG722() = default; |
62 | 62 |
| 63 size_t AudioEncoderG722::MaxEncodedBytes() const { |
| 64 return SamplesPerChannel() / 2 * num_channels_; |
| 65 } |
| 66 |
63 int AudioEncoderG722::SampleRateHz() const { | 67 int AudioEncoderG722::SampleRateHz() const { |
64 return kSampleRateHz; | 68 return kSampleRateHz; |
65 } | 69 } |
66 | 70 |
67 size_t AudioEncoderG722::NumChannels() const { | 71 size_t AudioEncoderG722::NumChannels() const { |
68 return num_channels_; | 72 return num_channels_; |
69 } | 73 } |
70 | 74 |
71 int AudioEncoderG722::RtpTimestampRateHz() const { | 75 int AudioEncoderG722::RtpTimestampRateHz() const { |
72 // The RTP timestamp rate for G.722 is 8000 Hz, even though it is a 16 kHz | 76 // The RTP timestamp rate for G.722 is 8000 Hz, even though it is a 16 kHz |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 158 |
155 AudioEncoderG722::EncoderState::~EncoderState() { | 159 AudioEncoderG722::EncoderState::~EncoderState() { |
156 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); | 160 RTC_CHECK_EQ(0, WebRtcG722_FreeEncoder(encoder)); |
157 } | 161 } |
158 | 162 |
159 size_t AudioEncoderG722::SamplesPerChannel() const { | 163 size_t AudioEncoderG722::SamplesPerChannel() const { |
160 return kSampleRateHz / 100 * num_10ms_frames_per_packet_; | 164 return kSampleRateHz / 100 * num_10ms_frames_per_packet_; |
161 } | 165 } |
162 | 166 |
163 } // namespace webrtc | 167 } // namespace webrtc |
OLD | NEW |