blob: ba206cb8bc3446be73c0d60fd6d519a8dc79beb2 [file] [log] [blame]
solenberg13725082015-11-25 08:16:52 -08001/*
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
deadbeefe591f932016-01-12 16:44:59 -080014#include "webrtc/base/scoped_ref_ptr.h"
solenberg358057b2015-11-27 10:46:42 -080015#include "webrtc/base/thread_checker.h"
solenberg13725082015-11-25 08:16:52 -080016#include "webrtc/voice_engine/channel_manager.h"
solenberg358057b2015-11-27 10:46:42 -080017#include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
solenberg13725082015-11-25 08:16:52 -080018
19#include <string>
solenberg358057b2015-11-27 10:46:42 -080020#include <vector>
solenberg13725082015-11-25 08:16:52 -080021
22namespace webrtc {
Stefan Holmerb86d4e42015-12-07 10:26:18 +010023
Tommif888bb52015-12-12 01:37:01 +010024class AudioSinkInterface;
Stefan Holmerb86d4e42015-12-07 10:26:18 +010025class PacketRouter;
26class RtpPacketSender;
27class TransportFeedbackObserver;
28
solenberg13725082015-11-25 08:16:52 -080029namespace voe {
30
solenberg358057b2015-11-27 10:46:42 -080031class Channel;
32
solenberg13725082015-11-25 08:16:52 -080033// This class provides the "view" of a voe::Channel that we need to implement
34// webrtc::AudioSendStream and webrtc::AudioReceiveStream. It serves two
35// purposes:
36// 1. Allow mocking just the interfaces used, instead of the entire
37// voe::Channel class.
38// 2. Provide a refined interface for the stream classes, including assumptions
39// on return values and input adaptation.
40class ChannelProxy {
41 public:
42 ChannelProxy();
43 explicit ChannelProxy(const ChannelOwner& channel_owner);
Tommif888bb52015-12-12 01:37:01 +010044 virtual ~ChannelProxy();
solenberg13725082015-11-25 08:16:52 -080045
46 virtual void SetRTCPStatus(bool enable);
47 virtual void SetLocalSSRC(uint32_t ssrc);
48 virtual void SetRTCP_CNAME(const std::string& c_name);
solenberg358057b2015-11-27 10:46:42 -080049 virtual void SetSendAbsoluteSenderTimeStatus(bool enable, int id);
50 virtual void SetSendAudioLevelIndicationStatus(bool enable, int id);
Stefan Holmerb86d4e42015-12-07 10:26:18 +010051 virtual void EnableSendTransportSequenceNumber(int id);
solenberg358057b2015-11-27 10:46:42 -080052 virtual void SetReceiveAbsoluteSenderTimeStatus(bool enable, int id);
53 virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id);
Stefan Holmerb86d4e42015-12-07 10:26:18 +010054 virtual void SetCongestionControlObjects(
55 RtpPacketSender* rtp_packet_sender,
56 TransportFeedbackObserver* transport_feedback_observer,
57 PacketRouter* packet_router);
solenberg358057b2015-11-27 10:46:42 -080058
59 virtual CallStatistics GetRTCPStatistics() const;
60 virtual std::vector<ReportBlock> GetRemoteRTCPReportBlocks() const;
61 virtual NetworkStatistics GetNetworkStatistics() const;
62 virtual AudioDecodingCallStats GetDecodingCallStatistics() const;
63 virtual int32_t GetSpeechOutputLevelFullRange() const;
64 virtual uint32_t GetDelayEstimate() const;
solenberg13725082015-11-25 08:16:52 -080065
Fredrik Solenbergb5727682015-12-04 15:22:19 +010066 virtual bool SetSendTelephoneEventPayloadType(int payload_type);
67 virtual bool SendTelephoneEventOutband(uint8_t event, uint32_t duration_ms);
68
deadbeefe591f932016-01-12 16:44:59 -080069 virtual void SetSink(const rtc::scoped_refptr<AudioSinkInterface>& sink);
Tommif888bb52015-12-12 01:37:01 +010070
solenberg13725082015-11-25 08:16:52 -080071 private:
solenberg358057b2015-11-27 10:46:42 -080072 Channel* channel() const;
73
74 rtc::ThreadChecker thread_checker_;
solenberg13725082015-11-25 08:16:52 -080075 ChannelOwner channel_owner_;
76};
77} // namespace voe
78} // namespace webrtc
79
80#endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_