blob: 44b25fd06779e14bf25aa22a10b8794b80f92b95 [file] [log] [blame]
solenberg5bbf7f92015-11-25 16:16:521/*
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
aleloib4ac6b02016-10-20 13:32:3914#include "webrtc/api/audio/audio_mixer.h"
solenbergd25cdbb2016-03-31 06:28:5115#include "webrtc/base/constructormagic.h"
aleloib4ac6b02016-10-20 13:32:3916#include "webrtc/base/race_checker.h"
solenberg21ca0a42015-11-27 18:46:4217#include "webrtc/base/thread_checker.h"
solenberg5bbf7f92015-11-25 16:16:5218#include "webrtc/voice_engine/channel_manager.h"
solenberg21ca0a42015-11-27 18:46:4219#include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
solenberg5bbf7f92015-11-25 16:16:5220
kwiberg484e0cd2016-02-17 18:04:1821#include <memory>
solenberg5bbf7f92015-11-25 16:16:5222#include <string>
solenberg21ca0a42015-11-27 18:46:4223#include <vector>
solenberg5bbf7f92015-11-25 16:16:5224
25namespace webrtc {
Stefan Holmerf95302f2015-12-07 09:26:1826
Tommi387e90b2015-12-12 00:37:0127class AudioSinkInterface;
Stefan Holmerf95302f2015-12-07 09:26:1828class PacketRouter;
ivoc23ea12e2016-07-04 14:06:5529class RtcEventLog;
Stefan Holmerf95302f2015-12-07 09:26:1830class RtpPacketSender;
mflodman823f9082016-04-29 07:57:1331class Transport;
Stefan Holmerf95302f2015-12-07 09:26:1832class TransportFeedbackObserver;
33
solenberg5bbf7f92015-11-25 16:16:5234namespace voe {
35
solenberg21ca0a42015-11-27 18:46:4236class Channel;
37
solenberg5bbf7f92015-11-25 16:16:5238// 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.
45class ChannelProxy {
46 public:
47 ChannelProxy();
48 explicit ChannelProxy(const ChannelOwner& channel_owner);
Tommi387e90b2015-12-12 00:37:0149 virtual ~ChannelProxy();
solenberg5bbf7f92015-11-25 16:16:5250
51 virtual void SetRTCPStatus(bool enable);
52 virtual void SetLocalSSRC(uint32_t ssrc);
53 virtual void SetRTCP_CNAME(const std::string& c_name);
solenberg5a37e3e2016-06-14 17:02:4154 virtual void SetNACKStatus(bool enable, int max_packets);
solenberg21ca0a42015-11-27 18:46:4255 virtual void SetSendAudioLevelIndicationStatus(bool enable, int id);
solenberg21ca0a42015-11-27 18:46:4256 virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id);
stefan9b910232016-01-21 14:32:4357 virtual void EnableSendTransportSequenceNumber(int id);
58 virtual void EnableReceiveTransportSequenceNumber(int id);
stefan3dad57b2016-02-01 12:39:5559 virtual void RegisterSenderCongestionControlObjects(
Stefan Holmerf95302f2015-12-07 09:26:1860 RtpPacketSender* rtp_packet_sender,
61 TransportFeedbackObserver* transport_feedback_observer,
62 PacketRouter* packet_router);
stefan3dad57b2016-02-01 12:39:5563 virtual void RegisterReceiverCongestionControlObjects(
64 PacketRouter* packet_router);
65 virtual void ResetCongestionControlObjects();
solenberg21ca0a42015-11-27 18:46:4266 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;
Fredrik Solenbergae4b1f02015-12-04 14:22:1972 virtual bool SetSendTelephoneEventPayloadType(int payload_type);
solenbergf2e33152016-03-11 11:06:4173 virtual bool SendTelephoneEventOutband(int event, int duration_ms);
mflodmanf29ccf62016-07-26 11:44:0674 virtual void SetBitrate(int bitrate_bps);
kwiberg484e0cd2016-02-17 18:04:1875 virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink);
solenbergd9cd8882016-06-16 17:53:2276 virtual void SetInputMute(bool muted);
mflodman823f9082016-04-29 07:57:1377 virtual void RegisterExternalTransport(Transport* transport);
78 virtual void DeRegisterExternalTransport();
79 virtual bool ReceivedRTPPacket(const uint8_t* packet,
80 size_t length,
81 const PacketTime& packet_time);
82 virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length);
ossue8407772016-06-13 14:34:5183 virtual const rtc::scoped_refptr<AudioDecoderFactory>&
solenberg784336a2016-06-17 15:30:5484 GetAudioDecoderFactory() const;
solenberg784336a2016-06-17 15:30:5485 virtual void SetChannelOutputVolumeScaling(float scaling);
ivoc23ea12e2016-07-04 14:06:5586 virtual void SetRtcEventLog(RtcEventLog* event_log);
minyue52066022016-10-31 11:08:3287 virtual void EnableAudioNetworkAdaptor(const std::string& config_string);
88 virtual void DisableAudioNetworkAdaptor();
89 virtual void SetReceiverFrameLengthRange(int min_frame_length_ms,
90 int max_frame_length_ms);
aleloifbd02462016-10-20 21:24:3991 virtual AudioMixer::Source::AudioFrameInfo GetAudioFrameWithInfo(
92 int sample_rate_hz,
93 AudioFrame* audio_frame);
aleloib4ac6b02016-10-20 13:32:3994
aleloib87bc5d2016-10-31 10:26:4095 virtual int NeededFrequency() const;
96
michaelt24545512016-11-08 10:50:0997 virtual void SetTransportOverhead(int transport_overhead_per_packet);
98
solenberg5bbf7f92015-11-25 16:16:5299 private:
solenberg21ca0a42015-11-27 18:46:42100 Channel* channel() const;
101
102 rtc::ThreadChecker thread_checker_;
aleloib4ac6b02016-10-20 13:32:39103 rtc::RaceChecker race_checker_;
solenberg5bbf7f92015-11-25 16:16:52104 ChannelOwner channel_owner_;
solenbergd25cdbb2016-03-31 06:28:51105
106 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy);
solenberg5bbf7f92015-11-25 16:16:52107};
108} // namespace voe
109} // namespace webrtc
110
111#endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_