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

Side by Side Diff: webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h

Issue 2934833002: G722 implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 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
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" 17 #include "webrtc/api/audio_codecs/audio_format.h"
18 #include "webrtc/api/audio_codecs/g722/audio_encoder_g722_config.h"
18 #include "webrtc/base/buffer.h" 19 #include "webrtc/base/buffer.h"
19 #include "webrtc/base/constructormagic.h" 20 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h" 21 #include "webrtc/modules/audio_coding/codecs/g722/g722_interface.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 struct CodecInst; 25 struct CodecInst;
25 26
26 class AudioEncoderG722 final : public AudioEncoder { 27 class AudioEncoderG722Impl final : public AudioEncoder {
27 public: 28 public:
28 struct Config { 29 static rtc::Optional<AudioEncoderG722Config> SdpToConfig(
29 bool IsOk() const; 30 const SdpAudioFormat& format);
30 31
31 int payload_type = 9; 32 AudioEncoderG722Impl(const AudioEncoderG722Config& config, int payload_type);
32 int frame_size_ms = 20; 33 explicit AudioEncoderG722Impl(const CodecInst& codec_inst);
33 size_t num_channels = 1; 34 AudioEncoderG722Impl(int payload_type, const SdpAudioFormat& format);
34 }; 35 ~AudioEncoderG722Impl() override;
35
36 explicit AudioEncoderG722(const Config& config);
37 explicit AudioEncoderG722(const CodecInst& codec_inst);
38 AudioEncoderG722(int payload_type, const SdpAudioFormat& format);
39 ~AudioEncoderG722() override;
40 36
41 static constexpr const char* GetPayloadName() { return "G722"; } 37 static constexpr const char* GetPayloadName() { return "G722"; }
42 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder( 38 static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
43 const SdpAudioFormat& format); 39 const SdpAudioFormat& format);
44 40
45 int SampleRateHz() const override; 41 int SampleRateHz() const override;
46 size_t NumChannels() const override; 42 size_t NumChannels() const override;
47 int RtpTimestampRateHz() const override; 43 int RtpTimestampRateHz() const override;
48 size_t Num10MsFramesInNextPacket() const override; 44 size_t Num10MsFramesInNextPacket() const override;
49 size_t Max10MsFramesInAPacket() const override; 45 size_t Max10MsFramesInAPacket() const override;
(...skipping 17 matching lines...) Expand all
67 63
68 size_t SamplesPerChannel() const; 64 size_t SamplesPerChannel() const;
69 65
70 const size_t num_channels_; 66 const size_t num_channels_;
71 const int payload_type_; 67 const int payload_type_;
72 const size_t num_10ms_frames_per_packet_; 68 const size_t num_10ms_frames_per_packet_;
73 size_t num_10ms_frames_buffered_; 69 size_t num_10ms_frames_buffered_;
74 uint32_t first_timestamp_in_buffer_; 70 uint32_t first_timestamp_in_buffer_;
75 const std::unique_ptr<EncoderState[]> encoders_; 71 const std::unique_ptr<EncoderState[]> encoders_;
76 rtc::Buffer interleave_buffer_; 72 rtc::Buffer interleave_buffer_;
77 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderG722); 73 RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderG722Impl);
78 }; 74 };
79 75
80 } // namespace webrtc 76 } // namespace webrtc
81 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_ 77 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_G722_AUDIO_ENCODER_G722_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698