solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ |
| 12 | #define WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ |
| 13 | |
aleloi | aed581a | 2016-10-20 06:32:39 -0700 | [diff] [blame] | 14 | #include "webrtc/api/audio/audio_mixer.h" |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 15 | #include "webrtc/base/constructormagic.h" |
aleloi | aed581a | 2016-10-20 06:32:39 -0700 | [diff] [blame] | 16 | #include "webrtc/base/race_checker.h" |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 17 | #include "webrtc/base/thread_checker.h" |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 18 | #include "webrtc/voice_engine/channel_manager.h" |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 19 | #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 20 | |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 21 | #include <memory> |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 22 | #include <string> |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 23 | #include <vector> |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 26 | |
Tommi | f888bb5 | 2015-12-12 01:37:01 +0100 | [diff] [blame] | 27 | class AudioSinkInterface; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 28 | class PacketRouter; |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 29 | class RtcEventLog; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 30 | class RtpPacketSender; |
mflodman | 3d7db26 | 2016-04-29 00:57:13 -0700 | [diff] [blame] | 31 | class Transport; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 32 | class TransportFeedbackObserver; |
| 33 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 34 | namespace voe { |
| 35 | |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 36 | class Channel; |
| 37 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 38 | // This class provides the "view" of a voe::Channel that we need to implement |
| 39 | // webrtc::AudioSendStream and webrtc::AudioReceiveStream. It serves two |
| 40 | // purposes: |
| 41 | // 1. Allow mocking just the interfaces used, instead of the entire |
| 42 | // voe::Channel class. |
| 43 | // 2. Provide a refined interface for the stream classes, including assumptions |
| 44 | // on return values and input adaptation. |
| 45 | class ChannelProxy { |
| 46 | public: |
| 47 | ChannelProxy(); |
| 48 | explicit ChannelProxy(const ChannelOwner& channel_owner); |
Tommi | f888bb5 | 2015-12-12 01:37:01 +0100 | [diff] [blame] | 49 | virtual ~ChannelProxy(); |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 50 | |
| 51 | virtual void SetRTCPStatus(bool enable); |
| 52 | virtual void SetLocalSSRC(uint32_t ssrc); |
| 53 | virtual void SetRTCP_CNAME(const std::string& c_name); |
solenberg | 971cab0 | 2016-06-14 10:02:41 -0700 | [diff] [blame] | 54 | virtual void SetNACKStatus(bool enable, int max_packets); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 55 | virtual void SetSendAudioLevelIndicationStatus(bool enable, int id); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 56 | virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id); |
stefan | 3313ec9 | 2016-01-21 06:32:43 -0800 | [diff] [blame] | 57 | virtual void EnableSendTransportSequenceNumber(int id); |
| 58 | virtual void EnableReceiveTransportSequenceNumber(int id); |
stefan | bba9dec | 2016-02-01 04:39:55 -0800 | [diff] [blame] | 59 | virtual void RegisterSenderCongestionControlObjects( |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 60 | RtpPacketSender* rtp_packet_sender, |
| 61 | TransportFeedbackObserver* transport_feedback_observer, |
| 62 | PacketRouter* packet_router); |
stefan | bba9dec | 2016-02-01 04:39:55 -0800 | [diff] [blame] | 63 | virtual void RegisterReceiverCongestionControlObjects( |
| 64 | PacketRouter* packet_router); |
| 65 | virtual void ResetCongestionControlObjects(); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 66 | virtual CallStatistics GetRTCPStatistics() const; |
| 67 | virtual std::vector<ReportBlock> GetRemoteRTCPReportBlocks() const; |
| 68 | virtual NetworkStatistics GetNetworkStatistics() const; |
| 69 | virtual AudioDecodingCallStats GetDecodingCallStatistics() const; |
| 70 | virtual int32_t GetSpeechOutputLevelFullRange() const; |
| 71 | virtual uint32_t GetDelayEstimate() const; |
solenberg | ffbbcac | 2016-11-17 05:25:37 -0800 | [diff] [blame] | 72 | virtual bool SetSendTelephoneEventPayloadType(int payload_type, |
| 73 | int payload_frequency); |
solenberg | 8842c3e | 2016-03-11 03:06:41 -0800 | [diff] [blame] | 74 | virtual bool SendTelephoneEventOutband(int event, int duration_ms); |
minyue | 78b4d56 | 2016-11-30 04:47:39 -0800 | [diff] [blame^] | 75 | virtual void SetBitrate(int bitrate_bps, int64_t probing_interval_ms); |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 76 | virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink); |
solenberg | 9421853 | 2016-06-16 10:53:22 -0700 | [diff] [blame] | 77 | virtual void SetInputMute(bool muted); |
mflodman | 3d7db26 | 2016-04-29 00:57:13 -0700 | [diff] [blame] | 78 | virtual void RegisterExternalTransport(Transport* transport); |
| 79 | virtual void DeRegisterExternalTransport(); |
| 80 | virtual bool ReceivedRTPPacket(const uint8_t* packet, |
| 81 | size_t length, |
| 82 | const PacketTime& packet_time); |
| 83 | virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length); |
ossu | 29b1a8d | 2016-06-13 07:34:51 -0700 | [diff] [blame] | 84 | virtual const rtc::scoped_refptr<AudioDecoderFactory>& |
solenberg | 217fb66 | 2016-06-17 08:30:54 -0700 | [diff] [blame] | 85 | GetAudioDecoderFactory() const; |
solenberg | 217fb66 | 2016-06-17 08:30:54 -0700 | [diff] [blame] | 86 | virtual void SetChannelOutputVolumeScaling(float scaling); |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 87 | virtual void SetRtcEventLog(RtcEventLog* event_log); |
minyue | 6b825df | 2016-10-31 04:08:32 -0700 | [diff] [blame] | 88 | virtual void EnableAudioNetworkAdaptor(const std::string& config_string); |
| 89 | virtual void DisableAudioNetworkAdaptor(); |
| 90 | virtual void SetReceiverFrameLengthRange(int min_frame_length_ms, |
| 91 | int max_frame_length_ms); |
aleloi | 6c27849 | 2016-10-20 14:24:39 -0700 | [diff] [blame] | 92 | virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo( |
| 93 | int sample_rate_hz, |
| 94 | AudioFrame* audio_frame); |
aleloi | 051f678 | 2016-10-31 03:26:40 -0700 | [diff] [blame] | 95 | virtual int NeededFrequency() const; |
michaelt | 79e0588 | 2016-11-08 02:50:09 -0800 | [diff] [blame] | 96 | virtual void SetTransportOverhead(int transport_overhead_per_packet); |
solenberg | 7602aab | 2016-11-14 11:30:07 -0800 | [diff] [blame] | 97 | virtual void AssociateSendChannel(const ChannelProxy& send_channel_proxy); |
| 98 | virtual void DisassociateSendChannel(); |
michaelt | 79e0588 | 2016-11-08 02:50:09 -0800 | [diff] [blame] | 99 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 100 | private: |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 101 | Channel* channel() const; |
| 102 | |
| 103 | rtc::ThreadChecker thread_checker_; |
aleloi | aed581a | 2016-10-20 06:32:39 -0700 | [diff] [blame] | 104 | rtc::RaceChecker race_checker_; |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 105 | ChannelOwner channel_owner_; |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 106 | |
| 107 | RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy); |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 108 | }; |
| 109 | } // namespace voe |
| 110 | } // namespace webrtc |
| 111 | |
| 112 | #endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ |