| 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 public: | 26 public: |
| 27 AudioCoder(uint32_t instance_id); | 27 explicit AudioCoder(uint32_t instance_id); |
| 28 ~AudioCoder(); | 28 ~AudioCoder(); |
| 29 | 29 |
| 30 int32_t SetEncodeCodec(const CodecInst& codec_inst); | 30 int32_t SetEncodeCodec(const CodecInst& codec_inst); |
| 31 | 31 |
| 32 int32_t SetDecodeCodec(const CodecInst& codec_inst); | 32 int32_t SetDecodeCodec(const CodecInst& codec_inst); |
| 33 | 33 |
| 34 int32_t Decode(AudioFrame& decoded_audio, | 34 int32_t Decode(AudioFrame* decoded_audio, |
| 35 uint32_t samp_freq_hz, | 35 uint32_t samp_freq_hz, |
| 36 const int8_t* incoming_payload, | 36 const int8_t* incoming_payload, |
| 37 size_t payload_length); | 37 size_t payload_length); |
| 38 | 38 |
| 39 int32_t PlayoutData(AudioFrame& decoded_audio, uint16_t& samp_freq_hz); | 39 int32_t PlayoutData(AudioFrame* decoded_audio, uint16_t samp_freq_hz); |
| 40 | 40 |
| 41 int32_t Encode(const AudioFrame& audio, | 41 int32_t Encode(const AudioFrame& audio, |
| 42 int8_t* encoded_data, | 42 int8_t* encoded_data, |
| 43 size_t& encoded_length_in_bytes); | 43 size_t* encoded_length_in_bytes); |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 int32_t SendData(FrameType frame_type, | 46 int32_t SendData(FrameType frame_type, |
| 47 uint8_t payload_type, | 47 uint8_t payload_type, |
| 48 uint32_t time_stamp, | 48 uint32_t time_stamp, |
| 49 const uint8_t* payload_data, | 49 const uint8_t* payload_data, |
| 50 size_t payload_size, | 50 size_t payload_size, |
| 51 const RTPFragmentationHeader* fragmentation) override; | 51 const RTPFragmentationHeader* fragmentation) override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 std::unique_ptr<AudioCodingModule> acm_; | 54 std::unique_ptr<AudioCodingModule> acm_; |
| 55 acm2::CodecManager codec_manager_; | 55 acm2::CodecManager codec_manager_; |
| 56 acm2::RentACodec rent_a_codec_; | 56 acm2::RentACodec rent_a_codec_; |
| 57 | 57 |
| 58 CodecInst receive_codec_; | 58 CodecInst receive_codec_; |
| 59 | 59 |
| 60 uint32_t encode_timestamp_; | 60 uint32_t encode_timestamp_; |
| 61 int8_t* encoded_data_; | 61 int8_t* encoded_data_; |
| 62 size_t encoded_length_in_bytes_; | 62 size_t encoded_length_in_bytes_; |
| 63 | 63 |
| 64 uint32_t decode_timestamp_; | 64 uint32_t decode_timestamp_; |
| 65 }; | 65 }; |
| 66 } // namespace webrtc | 66 } // namespace webrtc |
| 67 | 67 |
| 68 #endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ | 68 #endif // WEBRTC_MODULES_UTILITY_SOURCE_CODER_H_ |
| OLD | NEW |