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 | |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 14 | #include "webrtc/base/constructormagic.h" |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 15 | #include "webrtc/base/thread_checker.h" |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 16 | #include "webrtc/voice_engine/channel_manager.h" |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 17 | #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 18 | |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 19 | #include <memory> |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 20 | #include <string> |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 21 | #include <vector> |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 24 | |
Tommi | f888bb5 | 2015-12-12 01:37:01 +0100 | [diff] [blame] | 25 | class AudioSinkInterface; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 26 | class PacketRouter; |
| 27 | class RtpPacketSender; |
mflodman | 3d7db26 | 2016-04-29 00:57:13 -0700 | [diff] [blame] | 28 | class Transport; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 29 | class TransportFeedbackObserver; |
| 30 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 31 | namespace voe { |
| 32 | |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 33 | class Channel; |
| 34 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 35 | // This class provides the "view" of a voe::Channel that we need to implement |
| 36 | // webrtc::AudioSendStream and webrtc::AudioReceiveStream. It serves two |
| 37 | // purposes: |
| 38 | // 1. Allow mocking just the interfaces used, instead of the entire |
| 39 | // voe::Channel class. |
| 40 | // 2. Provide a refined interface for the stream classes, including assumptions |
| 41 | // on return values and input adaptation. |
| 42 | class ChannelProxy { |
| 43 | public: |
| 44 | ChannelProxy(); |
| 45 | explicit ChannelProxy(const ChannelOwner& channel_owner); |
Tommi | f888bb5 | 2015-12-12 01:37:01 +0100 | [diff] [blame] | 46 | virtual ~ChannelProxy(); |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 47 | |
| 48 | virtual void SetRTCPStatus(bool enable); |
| 49 | virtual void SetLocalSSRC(uint32_t ssrc); |
| 50 | virtual void SetRTCP_CNAME(const std::string& c_name); |
solenberg | 971cab0 | 2016-06-14 10:02:41 -0700 | [diff] [blame] | 51 | virtual void SetNACKStatus(bool enable, int max_packets); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 52 | virtual void SetSendAbsoluteSenderTimeStatus(bool enable, int id); |
| 53 | virtual void SetSendAudioLevelIndicationStatus(bool enable, int id); |
| 54 | virtual void SetReceiveAbsoluteSenderTimeStatus(bool enable, int id); |
| 55 | virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id); |
stefan | 3313ec9 | 2016-01-21 06:32:43 -0800 | [diff] [blame] | 56 | virtual void EnableSendTransportSequenceNumber(int id); |
| 57 | virtual void EnableReceiveTransportSequenceNumber(int id); |
stefan | bba9dec | 2016-02-01 04:39:55 -0800 | [diff] [blame] | 58 | virtual void RegisterSenderCongestionControlObjects( |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 59 | RtpPacketSender* rtp_packet_sender, |
| 60 | TransportFeedbackObserver* transport_feedback_observer, |
| 61 | PacketRouter* packet_router); |
stefan | bba9dec | 2016-02-01 04:39:55 -0800 | [diff] [blame] | 62 | virtual void RegisterReceiverCongestionControlObjects( |
| 63 | PacketRouter* packet_router); |
| 64 | virtual void ResetCongestionControlObjects(); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 65 | |
| 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 | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 72 | |
Fredrik Solenberg | b572768 | 2015-12-04 15:22:19 +0100 | [diff] [blame] | 73 | virtual bool SetSendTelephoneEventPayloadType(int payload_type); |
solenberg | 8842c3e | 2016-03-11 03:06:41 -0800 | [diff] [blame] | 74 | virtual bool SendTelephoneEventOutband(int event, int duration_ms); |
kwiberg | b7f89d6 | 2016-02-17 10:04:18 -0800 | [diff] [blame] | 75 | virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink); |
solenberg | 9421853 | 2016-06-16 10:53:22 -0700 | [diff] [blame] | 76 | virtual void SetInputMute(bool muted); |
Tommi | f888bb5 | 2015-12-12 01:37:01 +0100 | [diff] [blame] | 77 | |
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); |
| 84 | |
ossu | 29b1a8d | 2016-06-13 07:34:51 -0700 | [diff] [blame] | 85 | virtual const rtc::scoped_refptr<AudioDecoderFactory>& |
solenberg | 217fb66 | 2016-06-17 08:30:54 -0700 | [diff] [blame^] | 86 | GetAudioDecoderFactory() const; |
| 87 | |
| 88 | virtual void SetChannelOutputVolumeScaling(float scaling); |
ossu | 29b1a8d | 2016-06-13 07:34:51 -0700 | [diff] [blame] | 89 | |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 90 | private: |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 91 | Channel* channel() const; |
| 92 | |
| 93 | rtc::ThreadChecker thread_checker_; |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 94 | ChannelOwner channel_owner_; |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 95 | |
| 96 | RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy); |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 97 | }; |
| 98 | } // namespace voe |
| 99 | } // namespace webrtc |
| 100 | |
| 101 | #endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_ |