OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef VOICE_ENGINE_CODER_H_ | |
12 #define VOICE_ENGINE_CODER_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "common_types.h" // NOLINT(build/include) | |
17 #include "modules/audio_coding/acm2/codec_manager.h" | |
18 #include "modules/audio_coding/acm2/rent_a_codec.h" | |
19 #include "modules/audio_coding/include/audio_coding_module.h" | |
20 #include "typedefs.h" // NOLINT(build/include) | |
21 | |
22 namespace webrtc { | |
23 class AudioFrame; | |
24 | |
25 class AudioCoder : public AudioPacketizationCallback { | |
26 public: | |
27 explicit AudioCoder(uint32_t instance_id); | |
28 ~AudioCoder(); | |
29 | |
30 int32_t SetEncodeCodec(const CodecInst& codec_inst); | |
31 | |
32 int32_t SetDecodeCodec(const CodecInst& codec_inst); | |
33 | |
34 int32_t Decode(AudioFrame* decoded_audio, | |
35 uint32_t samp_freq_hz, | |
36 const int8_t* incoming_payload, | |
37 size_t payload_length); | |
38 | |
39 int32_t PlayoutData(AudioFrame* decoded_audio, uint16_t samp_freq_hz); | |
40 | |
41 int32_t Encode(const AudioFrame& audio, | |
42 int8_t* encoded_data, | |
43 size_t* encoded_length_in_bytes); | |
44 | |
45 protected: | |
46 int32_t SendData(FrameType frame_type, | |
47 uint8_t payload_type, | |
48 uint32_t time_stamp, | |
49 const uint8_t* payload_data, | |
50 size_t payload_size, | |
51 const RTPFragmentationHeader* fragmentation) override; | |
52 | |
53 private: | |
54 std::unique_ptr<AudioCodingModule> acm_; | |
55 acm2::CodecManager codec_manager_; | |
56 acm2::RentACodec rent_a_codec_; | |
57 | |
58 CodecInst receive_codec_; | |
59 | |
60 uint32_t encode_timestamp_; | |
61 int8_t* encoded_data_; | |
62 size_t encoded_length_in_bytes_; | |
63 | |
64 uint32_t decode_timestamp_; | |
65 }; | |
66 } // namespace webrtc | |
67 | |
68 #endif // VOICE_ENGINE_CODER_H_ | |
OLD | NEW |