OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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_UTILITY_SOURCE_CODER_H_ | 11 #ifndef WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ |
12 #define WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ | 12 #define WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
17 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" | 17 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" |
18 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" | 18 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
19 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 19 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
20 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 class AudioFrame; | 23 class AudioFrame; |
24 | 24 |
25 class AudioCoder : public AudioPacketizationCallback | 25 class AudioCoder : public AudioPacketizationCallback { |
26 { | 26 public: |
27 public: | 27 AudioCoder(uint32_t instanceID); |
28 AudioCoder(uint32_t instanceID); | 28 ~AudioCoder(); |
29 ~AudioCoder(); | |
30 | 29 |
31 int32_t SetEncodeCodec(const CodecInst& codecInst); | 30 int32_t SetEncodeCodec(const CodecInst& codecInst); |
32 | 31 |
33 int32_t SetDecodeCodec(const CodecInst& codecInst); | 32 int32_t SetDecodeCodec(const CodecInst& codecInst); |
34 | 33 |
35 int32_t Decode(AudioFrame& decodedAudio, uint32_t sampFreqHz, | 34 int32_t Decode(AudioFrame& decodedAudio, |
36 const int8_t* incomingPayload, size_t payloadLength); | 35 uint32_t sampFreqHz, |
36 const int8_t* incomingPayload, | |
37 size_t payloadLength); | |
37 | 38 |
38 int32_t PlayoutData(AudioFrame& decodedAudio, uint16_t& sampFreqHz); | 39 int32_t PlayoutData(AudioFrame& decodedAudio, uint16_t& sampFreqHz); |
39 | 40 |
40 int32_t Encode(const AudioFrame& audio, int8_t* encodedData, | 41 int32_t Encode(const AudioFrame& audio, |
41 size_t& encodedLengthInBytes); | 42 int8_t* encodedData, |
43 size_t& encodedLengthInBytes); | |
42 | 44 |
43 protected: | 45 protected: |
44 int32_t SendData(FrameType frameType, | 46 int32_t SendData(FrameType frameType, |
45 uint8_t payloadType, | 47 uint8_t payloadType, |
46 uint32_t timeStamp, | 48 uint32_t timeStamp, |
47 const uint8_t* payloadData, | 49 const uint8_t* payloadData, |
48 size_t payloadSize, | 50 size_t payloadSize, |
49 const RTPFragmentationHeader* fragmentation) override; | 51 const RTPFragmentationHeader* fragmentation) override; |
50 | 52 |
51 private: | 53 private: |
52 std::unique_ptr<AudioCodingModule> _acm; | 54 std::unique_ptr<AudioCodingModule> _acm; |
perkj_webrtc
2016/05/04 10:43:55
fix the naming while your are at it? acm_ here and
kwiberg-webrtc
2016/05/04 10:49:04
Sure, but can I do it in a follow-up CL? One of th
| |
53 acm2::CodecManager codec_manager_; | 55 acm2::CodecManager codec_manager_; |
54 acm2::RentACodec rent_a_codec_; | 56 acm2::RentACodec rent_a_codec_; |
55 | 57 |
56 CodecInst _receiveCodec; | 58 CodecInst _receiveCodec; |
57 | 59 |
58 uint32_t _encodeTimestamp; | 60 uint32_t _encodeTimestamp; |
59 int8_t* _encodedData; | 61 int8_t* _encodedData; |
60 size_t _encodedLengthInBytes; | 62 size_t _encodedLengthInBytes; |
61 | 63 |
62 uint32_t _decodeTimestamp; | 64 uint32_t _decodeTimestamp; |
63 }; | 65 }; |
64 } // namespace webrtc | 66 } // namespace webrtc |
65 | 67 |
66 #endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ | 68 #endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ |
OLD | NEW |