| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ | 5 #ifndef REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ |
| 6 #define REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ | 6 #define REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ |
| 7 | 7 |
| 8 #include "remoting/codec/audio_encoder.h" | 8 #include "remoting/codec/audio_encoder.h" |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace remoting { | 22 namespace remoting { |
| 23 | 23 |
| 24 class AudioPacket; | 24 class AudioPacket; |
| 25 | 25 |
| 26 class AudioEncoderOpus : public AudioEncoder { | 26 class AudioEncoderOpus : public AudioEncoder { |
| 27 public: | 27 public: |
| 28 AudioEncoderOpus(); | 28 AudioEncoderOpus(); |
| 29 ~AudioEncoderOpus() override; | 29 ~AudioEncoderOpus() override; |
| 30 | 30 |
| 31 // AudioEncoder interface. | 31 // AudioEncoder interface. |
| 32 scoped_ptr<AudioPacket> Encode(scoped_ptr<AudioPacket> packet) override; | 32 std::unique_ptr<AudioPacket> Encode( |
| 33 std::unique_ptr<AudioPacket> packet) override; |
| 33 int GetBitrate() override; | 34 int GetBitrate() override; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 void InitEncoder(); | 37 void InitEncoder(); |
| 37 void DestroyEncoder(); | 38 void DestroyEncoder(); |
| 38 bool ResetForPacket(AudioPacket* packet); | 39 bool ResetForPacket(AudioPacket* packet); |
| 39 | 40 |
| 40 void FetchBytesToResample(int resampler_frame_delay, | 41 void FetchBytesToResample(int resampler_frame_delay, |
| 41 media::AudioBus* audio_bus); | 42 media::AudioBus* audio_bus); |
| 42 | 43 |
| 43 int sampling_rate_; | 44 int sampling_rate_; |
| 44 AudioPacket::Channels channels_; | 45 AudioPacket::Channels channels_; |
| 45 OpusEncoder* encoder_; | 46 OpusEncoder* encoder_; |
| 46 | 47 |
| 47 int frame_size_; | 48 int frame_size_; |
| 48 scoped_ptr<media::MultiChannelResampler> resampler_; | 49 std::unique_ptr<media::MultiChannelResampler> resampler_; |
| 49 scoped_ptr<char[]> resample_buffer_; | 50 std::unique_ptr<char[]> resample_buffer_; |
| 50 scoped_ptr<media::AudioBus> resampler_bus_; | 51 std::unique_ptr<media::AudioBus> resampler_bus_; |
| 51 | 52 |
| 52 // Used to pass packet to the FetchBytesToResampler() callback. | 53 // Used to pass packet to the FetchBytesToResampler() callback. |
| 53 const char* resampling_data_; | 54 const char* resampling_data_; |
| 54 int resampling_data_size_; | 55 int resampling_data_size_; |
| 55 int resampling_data_pos_; | 56 int resampling_data_pos_; |
| 56 | 57 |
| 57 // Left-over unencoded samples from the previous AudioPacket. | 58 // Left-over unencoded samples from the previous AudioPacket. |
| 58 scoped_ptr<int16_t[]> leftover_buffer_; | 59 std::unique_ptr<int16_t[]> leftover_buffer_; |
| 59 int leftover_buffer_size_; | 60 int leftover_buffer_size_; |
| 60 int leftover_samples_; | 61 int leftover_samples_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); | 63 DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace remoting | 66 } // namespace remoting |
| 66 | 67 |
| 67 #endif // REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ | 68 #endif // REMOTING_CODEC_AUDIO_ENCODER_OPUS_H_ |
| OLD | NEW |