Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h |
| diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h |
| index 48fb494dbe180bb7b151c5fe36767c83c84411be..63128c9a900dd89b764933140428c41eef3dd70a 100644 |
| --- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h |
| +++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h |
| @@ -15,6 +15,7 @@ |
| #include "webrtc/base/constructormagic.h" |
| #include "webrtc/base/optional.h" |
| +#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h" |
| #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" |
| #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| @@ -47,6 +48,7 @@ class AudioEncoderOpus final : public AudioEncoder { |
| int max_playback_rate_hz = 48000; |
| int complexity = kDefaultComplexity; |
| bool dtx_enabled = false; |
| + bool audio_network_adaptor_enabled = false; |
|
kwiberg-webrtc
2016/09/27 09:35:55
Do you need this? Isn't it enough that the constru
minyue-webrtc
2016/09/27 16:02:33
I wanted to do that. But it will need a lot of oth
minyue-webrtc
2016/09/29 15:34:25
But I removed due to another reason: it becomes re
|
| private: |
| #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) || defined(WEBRTC_ARCH_ARM) |
| @@ -58,8 +60,12 @@ class AudioEncoderOpus final : public AudioEncoder { |
| #endif |
| }; |
| - explicit AudioEncoderOpus(const Config& config); |
| - explicit AudioEncoderOpus(const CodecInst& codec_inst); |
| + AudioEncoderOpus( |
| + const Config& config, |
| + std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor = nullptr); |
| + |
| + AudioEncoderOpus(const CodecInst& codec_inst); |
|
kwiberg-webrtc
2016/09/27 09:35:55
This constructor should still be explicit, right?
minyue-webrtc
2016/09/27 16:02:33
oh, right, I tried to add audio network adaptor ar
|
| + |
| ~AudioEncoderOpus() override; |
| int SampleRateHz() const override; |
| @@ -82,9 +88,21 @@ class AudioEncoderOpus final : public AudioEncoder { |
| void SetProjectedPacketLossRate(double fraction) override; |
| void SetTargetBitrate(int target_bps) override; |
| + bool SetAudioNetworkAdaptor(bool enable) override; |
| + void OnReceivedUplinkBandwidth(int uplink_bandwidth_bps) override; |
| + void OnReceivedUplinkPacketLossFraction( |
| + float uplink_packet_loss_fraction) override; |
| + void OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) override; |
| + void OnReceivedRtt(int rtt_ms) override; |
| + void SetReceiverFrameLengthRange(int min_frame_length_ms, |
| + int max_frame_length_ms) override; |
| + |
| // Getters for testing. |
| double packet_loss_rate() const { return packet_loss_rate_; } |
| ApplicationMode application() const { return config_.application; } |
| + bool fec_enabled() const { return config_.fec_enabled; } |
| + size_t num_channels_to_encode() const { return num_channels_to_encode_; } |
| + int next_frame_length_ms() const { return next_frame_size_ms_; } |
| protected: |
| EncodedInfo EncodeImpl(uint32_t rtp_timestamp, |
| @@ -96,12 +114,19 @@ class AudioEncoderOpus final : public AudioEncoder { |
| size_t SamplesPer10msFrame() const; |
| size_t SufficientOutputBufferSize() const; |
| bool RecreateEncoderInstance(const Config& config); |
| + void SetFrameLength(int frame_length_ms); |
| + void SetNumChannelsToEncode(size_t num_channels_to_encode); |
| + void ApplyAudioNetworkAdaptor(); |
| Config config_; |
| double packet_loss_rate_; |
| std::vector<int16_t> input_buffer_; |
| OpusEncInst* inst_; |
| uint32_t first_timestamp_in_buffer_; |
| + size_t num_channels_to_encode_; |
| + int next_frame_size_ms_; |
| + std::unique_ptr<AudioNetworkAdaptor> audio_network_adaptor_; |
| + |
| RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderOpus); |
| }; |