| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "webrtc/api/audio_codecs/audio_encoder.h" | 16 #include "webrtc/api/audio_codecs/audio_encoder.h" |
| 17 #include "webrtc/api/audio_codecs/audio_format.h" | |
| 18 #include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h" | 17 #include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h" |
| 19 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h" | 18 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h" |
| 20 #include "webrtc/rtc_base/buffer.h" | 19 #include "webrtc/rtc_base/buffer.h" |
| 21 #include "webrtc/rtc_base/constructormagic.h" | 20 #include "webrtc/rtc_base/constructormagic.h" |
| 22 | 21 |
| 23 namespace webrtc { | 22 namespace webrtc { |
| 24 | 23 |
| 25 struct CodecInst; | 24 struct CodecInst; |
| 26 | 25 |
| 27 class AudioEncoderG722Impl final : public AudioEncoder { | 26 class AudioEncoderG722Impl final : public AudioEncoder { |
| 28 public: | 27 public: |
| 29 static rtc::Optional<AudioEncoderG722Config> SdpToConfig( | |
| 30 const SdpAudioFormat& format); | |
| 31 | |
| 32 AudioEncoderG722Impl(const AudioEncoderG722Config& config, int payload_type); | 28 AudioEncoderG722Impl(const AudioEncoderG722Config& config, int payload_type); |
| 33 explicit AudioEncoderG722Impl(const CodecInst& codec_inst); | 29 explicit AudioEncoderG722Impl(const CodecInst& codec_inst); |
| 34 AudioEncoderG722Impl(int payload_type, const SdpAudioFormat& format); | |
| 35 ~AudioEncoderG722Impl() override; | 30 ~AudioEncoderG722Impl() override; |
| 36 | 31 |
| 37 static constexpr const char* GetPayloadName() { return "G722"; } | |
| 38 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( | |
| 39 const SdpAudioFormat& format); | |
| 40 | |
| 41 int SampleRateHz() const override; | 32 int SampleRateHz() const override; |
| 42 size_t NumChannels() const override; | 33 size_t NumChannels() const override; |
| 43 int RtpTimestampRateHz() const override; | 34 int RtpTimestampRateHz() const override; |
| 44 size_t Num10MsFramesInNextPacket() const override; | 35 size_t Num10MsFramesInNextPacket() const override; |
| 45 size_t Max10MsFramesInAPacket() const override; | 36 size_t Max10MsFramesInAPacket() const override; |
| 46 int GetTargetBitrate() const override; | 37 int GetTargetBitrate() const override; |
| 47 void Reset() override; | 38 void Reset() override; |
| 48 | 39 |
| 49 protected: | 40 protected: |
| 50 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, | 41 EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 68 const size_t num_10ms_frames_per_packet_; | 59 const size_t num_10ms_frames_per_packet_; |
| 69 size_t num_10ms_frames_buffered_; | 60 size_t num_10ms_frames_buffered_; |
| 70 uint32_t first_timestamp_in_buffer_; | 61 uint32_t first_timestamp_in_buffer_; |
| 71 const std::unique_ptr<EncoderState[]> encoders_; | 62 const std::unique_ptr<EncoderState[]> encoders_; |
| 72 rtc::Buffer interleave_buffer_; | 63 rtc::Buffer interleave_buffer_; |
| 73 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderG722Impl); | 64 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderG722Impl); |
| 74 }; | 65 }; |
| 75 | 66 |
| 76 } // namespace webrtc | 67 } // namespace webrtc |
| 77 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ | 68 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ |
| OLD | NEW |