1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_CALL_H_
#define CALL_CALL_H_
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/adaptation/resource.h"
#include "api/media_types.h"
#include "api/task_queue/task_queue_base.h"
#include "call/audio_receive_stream.h"
#include "call/audio_send_stream.h"
#include "call/call_basic_stats.h"
#include "call/call_config.h"
#include "call/flexfec_receive_stream.h"
#include "call/packet_receiver.h"
#include "call/rtp_transport_controller_send_interface.h"
#include "call/video_receive_stream.h"
#include "call/video_send_stream.h"
#include "rtc_base/copy_on_write_buffer.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/network_route.h"
namespace webrtc {
// A Call represents a two-way connection carrying zero or more outgoing
// and incoming media streams, transported over one or more RTP transports.
// A Call instance can contain several send and/or receive streams. All streams
// are assumed to have the same remote endpoint and will share bitrate estimates
// etc.
// When using the PeerConnection API, there is an one to one relationship
// between the PeerConnection and the Call.
class Call {
public:
using Config = CallConfig;
using Stats = CallBasicStats;
static Call* Create(const Call::Config& config);
static Call* Create(const Call::Config& config,
Clock* clock,
std::unique_ptr<RtpTransportControllerSendInterface>
transportControllerSend);
virtual AudioSendStream* CreateAudioSendStream(
const AudioSendStream::Config& config) = 0;
virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0;
virtual AudioReceiveStreamInterface* CreateAudioReceiveStream(
const AudioReceiveStreamInterface::Config& config) = 0;
virtual void DestroyAudioReceiveStream(
AudioReceiveStreamInterface* receive_stream) = 0;
virtual VideoSendStream* CreateVideoSendStream(
VideoSendStream::Config config,
VideoEncoderConfig encoder_config) = 0;
virtual VideoSendStream* CreateVideoSendStream(
VideoSendStream::Config config,
VideoEncoderConfig encoder_config,
std::unique_ptr<FecController> fec_controller);
virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0;
virtual VideoReceiveStreamInterface* CreateVideoReceiveStream(
VideoReceiveStreamInterface::Config configuration) = 0;
virtual void DestroyVideoReceiveStream(
VideoReceiveStreamInterface* receive_stream) = 0;
// In order for a created VideoReceiveStreamInterface to be aware that it is
// protected by a FlexfecReceiveStream, the latter should be created before
// the former.
virtual FlexfecReceiveStream* CreateFlexfecReceiveStream(
const FlexfecReceiveStream::Config config) = 0;
virtual void DestroyFlexfecReceiveStream(
FlexfecReceiveStream* receive_stream) = 0;
// When a resource is overused, the Call will try to reduce the load on the
// sysem, for example by reducing the resolution or frame rate of encoded
// streams.
virtual void AddAdaptationResource(rtc::scoped_refptr<Resource> resource) = 0;
// All received RTP and RTCP packets for the call should be inserted to this
// PacketReceiver. The PacketReceiver pointer is valid as long as the
// Call instance exists.
virtual PacketReceiver* Receiver() = 0;
// This is used to access the transport controller send instance owned by
// Call. The send transport controller is currently owned by Call for legacy
// reasons. (for instance variants of call tests are built on this assumtion)
// TODO(srte): Move ownership of transport controller send out of Call and
// remove this method interface.
virtual RtpTransportControllerSendInterface* GetTransportControllerSend() = 0;
// Returns the call statistics, such as estimated send and receive bandwidth,
// pacing delay, etc.
virtual Stats GetStats() const = 0;
// TODO(skvlad): When the unbundled case with multiple streams for the same
// media type going over different networks is supported, track the state
// for each stream separately. Right now it's global per media type.
virtual void SignalChannelNetworkState(MediaType media,
NetworkState state) = 0;
virtual void OnAudioTransportOverheadChanged(
int transport_overhead_per_packet) = 0;
// Called when a receive stream's local ssrc has changed and association with
// send streams needs to be updated.
virtual void OnLocalSsrcUpdated(AudioReceiveStreamInterface& stream,
uint32_t local_ssrc) = 0;
virtual void OnLocalSsrcUpdated(VideoReceiveStreamInterface& stream,
uint32_t local_ssrc) = 0;
virtual void OnLocalSsrcUpdated(FlexfecReceiveStream& stream,
uint32_t local_ssrc) = 0;
virtual void OnUpdateSyncGroup(AudioReceiveStreamInterface& stream,
absl::string_view sync_group) = 0;
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
virtual void SetClientBitratePreferences(
const BitrateSettings& preferences) = 0;
virtual const FieldTrialsView& trials() const = 0;
virtual TaskQueueBase* network_thread() const = 0;
virtual TaskQueueBase* worker_thread() const = 0;
virtual ~Call() {}
};
} // namespace webrtc
#endif // CALL_CALL_H_
|