blob: 8159606ec5c7244f38c1f414e497b4e911d5c3d9 [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
solenbergff976312016-03-30 23:28:51 -070014#include "webrtc/base/constructormagic.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
kwibergb7f89d62016-02-17 10:04:18 -080019#include <memory>
solenberg13725082015-11-25 08:16:52 -080020#include <string>
solenberg358057b2015-11-27 10:46:42 -080021#include <vector>
solenberg13725082015-11-25 08:16:52 -080022
23namespace webrtc {
Stefan Holmerb86d4e42015-12-07 10:26:18 +010024
Tommif888bb52015-12-12 01:37:01 +010025class AudioSinkInterface;
Stefan Holmerb86d4e42015-12-07 10:26:18 +010026class PacketRouter;
27class RtpPacketSender;
mflodman3d7db262016-04-29 00:57:13 -070028class Transport;
Stefan Holmerb86d4e42015-12-07 10:26:18 +010029class TransportFeedbackObserver;
30
solenberg13725082015-11-25 08:16:52 -080031namespace voe {
32
solenberg358057b2015-11-27 10:46:42 -080033class Channel;
34
solenberg13725082015-11-25 08:16:52 -080035// 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.
42class ChannelProxy {
43 public:
44 ChannelProxy();
45 explicit ChannelProxy(const ChannelOwner& channel_owner);
Tommif888bb52015-12-12 01:37:01 +010046 virtual ~ChannelProxy();
solenberg13725082015-11-25 08:16:52 -080047
48 virtual void SetRTCPStatus(bool enable);
49 virtual void SetLocalSSRC(uint32_t ssrc);
50 virtual void SetRTCP_CNAME(const std::string& c_name);
solenberg358057b2015-11-27 10:46:42 -080051 virtual void SetSendAbsoluteSenderTimeStatus(bool enable, int id);
52 virtual void SetSendAudioLevelIndicationStatus(bool enable, int id);
53 virtual void SetReceiveAbsoluteSenderTimeStatus(bool enable, int id);
54 virtual void SetReceiveAudioLevelIndicationStatus(bool enable, int id);
stefan3313ec92016-01-21 06:32:43 -080055 virtual void EnableSendTransportSequenceNumber(int id);
56 virtual void EnableReceiveTransportSequenceNumber(int id);
stefanbba9dec2016-02-01 04:39:55 -080057 virtual void RegisterSenderCongestionControlObjects(
Stefan Holmerb86d4e42015-12-07 10:26:18 +010058 RtpPacketSender* rtp_packet_sender,
59 TransportFeedbackObserver* transport_feedback_observer,
60 PacketRouter* packet_router);
stefanbba9dec2016-02-01 04:39:55 -080061 virtual void RegisterReceiverCongestionControlObjects(
62 PacketRouter* packet_router);
63 virtual void ResetCongestionControlObjects();
solenberg358057b2015-11-27 10:46:42 -080064
65 virtual CallStatistics GetRTCPStatistics() const;
66 virtual std::vector<ReportBlock> GetRemoteRTCPReportBlocks() const;
67 virtual NetworkStatistics GetNetworkStatistics() const;
68 virtual AudioDecodingCallStats GetDecodingCallStatistics() const;
69 virtual int32_t GetSpeechOutputLevelFullRange() const;
70 virtual uint32_t GetDelayEstimate() const;
solenberg13725082015-11-25 08:16:52 -080071
Fredrik Solenbergb5727682015-12-04 15:22:19 +010072 virtual bool SetSendTelephoneEventPayloadType(int payload_type);
solenberg8842c3e2016-03-11 03:06:41 -080073 virtual bool SendTelephoneEventOutband(int event, int duration_ms);
kwibergb7f89d62016-02-17 10:04:18 -080074 virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink);
Tommif888bb52015-12-12 01:37:01 +010075
mflodman3d7db262016-04-29 00:57:13 -070076 virtual void RegisterExternalTransport(Transport* transport);
77 virtual void DeRegisterExternalTransport();
78 virtual bool ReceivedRTPPacket(const uint8_t* packet,
79 size_t length,
80 const PacketTime& packet_time);
81 virtual bool ReceivedRTCPPacket(const uint8_t* packet, size_t length);
82
ossu29b1a8d2016-06-13 07:34:51 -070083 virtual const rtc::scoped_refptr<AudioDecoderFactory>&
84 GetAudioDecoderFactory() const;
85
solenberg13725082015-11-25 08:16:52 -080086 private:
solenberg358057b2015-11-27 10:46:42 -080087 Channel* channel() const;
88
89 rtc::ThreadChecker thread_checker_;
solenberg13725082015-11-25 08:16:52 -080090 ChannelOwner channel_owner_;
solenbergff976312016-03-30 23:28:51 -070091
92 RTC_DISALLOW_COPY_AND_ASSIGN(ChannelProxy);
solenberg13725082015-11-25 08:16:52 -080093};
94} // namespace voe
95} // namespace webrtc
96
97#endif // WEBRTC_VOICE_ENGINE_CHANNEL_PROXY_H_