OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_CALL_CALL_H_ | 10 #ifndef WEBRTC_CALL_CALL_H_ |
11 #define WEBRTC_CALL_CALL_H_ | 11 #define WEBRTC_CALL_CALL_H_ |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/api/rtcerror.h" | |
18 #include "webrtc/base/networkroute.h" | 17 #include "webrtc/base/networkroute.h" |
19 #include "webrtc/base/platform_file.h" | 18 #include "webrtc/base/platform_file.h" |
20 #include "webrtc/base/socket.h" | 19 #include "webrtc/base/socket.h" |
21 #include "webrtc/call/audio_receive_stream.h" | 20 #include "webrtc/call/audio_receive_stream.h" |
22 #include "webrtc/call/audio_send_stream.h" | 21 #include "webrtc/call/audio_send_stream.h" |
23 #include "webrtc/call/audio_state.h" | 22 #include "webrtc/call/audio_state.h" |
24 #include "webrtc/call/flexfec_receive_stream.h" | 23 #include "webrtc/call/flexfec_receive_stream.h" |
25 #include "webrtc/call/rtp_transport_controller_send_interface.h" | 24 #include "webrtc/call/rtp_transport_controller_send_interface.h" |
26 #include "webrtc/common_types.h" | 25 #include "webrtc/common_types.h" |
27 #include "webrtc/video_receive_stream.h" | 26 #include "webrtc/video_receive_stream.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class Call { | 61 class Call { |
63 public: | 62 public: |
64 struct Config { | 63 struct Config { |
65 explicit Config(RtcEventLog* event_log) : event_log(event_log) { | 64 explicit Config(RtcEventLog* event_log) : event_log(event_log) { |
66 RTC_DCHECK(event_log); | 65 RTC_DCHECK(event_log); |
67 } | 66 } |
68 | 67 |
69 static const int kDefaultStartBitrateBps; | 68 static const int kDefaultStartBitrateBps; |
70 | 69 |
71 // Bitrate config used until valid bitrate estimates are calculated. Also | 70 // Bitrate config used until valid bitrate estimates are calculated. Also |
72 // used to cap total bitrate used. This comes from the remote connection. | 71 // used to cap total bitrate used. |
73 struct BitrateConfig { | 72 struct BitrateConfig { |
74 int min_bitrate_bps = 0; | 73 int min_bitrate_bps = 0; |
75 int start_bitrate_bps = kDefaultStartBitrateBps; | 74 int start_bitrate_bps = kDefaultStartBitrateBps; |
76 int max_bitrate_bps = -1; | 75 int max_bitrate_bps = -1; |
77 } bitrate_config; | 76 } bitrate_config; |
78 | 77 |
79 // The local client's bitrate preferences. The actual configuration used | |
80 // is a combination of this and |bitrate_config|. The combination is | |
81 // currently more complicated than a simple mask operation (see | |
82 // SetBitrateConfig and SetBitrateConfigMask). Assumes that 0 <= min <= | |
83 // start <= max holds for set parameters. | |
84 struct BitrateConfigMask { | |
85 rtc::Optional<int> min_bitrate_bps; | |
86 rtc::Optional<int> start_bitrate_bps; | |
87 rtc::Optional<int> max_bitrate_bps; | |
88 }; | |
89 | |
90 // AudioState which is possibly shared between multiple calls. | 78 // AudioState which is possibly shared between multiple calls. |
91 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 79 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. |
92 rtc::scoped_refptr<AudioState> audio_state; | 80 rtc::scoped_refptr<AudioState> audio_state; |
93 | 81 |
94 // Audio Processing Module to be used in this call. | 82 // Audio Processing Module to be used in this call. |
95 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 83 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. |
96 AudioProcessing* audio_processing = nullptr; | 84 AudioProcessing* audio_processing = nullptr; |
97 | 85 |
98 // RtcEventLog to use for this call. Required. | 86 // RtcEventLog to use for this call. Required. |
99 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. | 87 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 134 |
147 // All received RTP and RTCP packets for the call should be inserted to this | 135 // All received RTP and RTCP packets for the call should be inserted to this |
148 // PacketReceiver. The PacketReceiver pointer is valid as long as the | 136 // PacketReceiver. The PacketReceiver pointer is valid as long as the |
149 // Call instance exists. | 137 // Call instance exists. |
150 virtual PacketReceiver* Receiver() = 0; | 138 virtual PacketReceiver* Receiver() = 0; |
151 | 139 |
152 // Returns the call statistics, such as estimated send and receive bandwidth, | 140 // Returns the call statistics, such as estimated send and receive bandwidth, |
153 // pacing delay, etc. | 141 // pacing delay, etc. |
154 virtual Stats GetStats() const = 0; | 142 virtual Stats GetStats() const = 0; |
155 | 143 |
156 // The greater min and smaller max set by this and SetBitrateConfigMask will | 144 // TODO(pbos): Like BitrateConfig above this is currently per-stream instead |
157 // be used. The latest non-negative start value from either call will be used. | 145 // of maximum for entire Call. This should be fixed along with the above. |
158 // Specifying a start bitrate (>0) will reset the current bitrate estimate. | 146 // Specifying a start bitrate (>0) will currently reset the current bitrate |
159 // This is due to how the 'x-google-start-bitrate' flag is currently | 147 // estimate. This is due to how the 'x-google-start-bitrate' flag is currently |
160 // implemented. Passing -1 leaves the start bitrate unchanged. Behavior is not | 148 // implemented. |
161 // guaranteed for other negative values or 0. | |
162 virtual void SetBitrateConfig( | 149 virtual void SetBitrateConfig( |
163 const Config::BitrateConfig& bitrate_config) = 0; | 150 const Config::BitrateConfig& bitrate_config) = 0; |
164 | 151 |
165 // The greater min and smaller max set by this and SetBitrateConfig will be | |
166 // used. The latest non-negative start value form either call will be used. | |
167 // Specifying a start bitrate will reset the current bitrate estimate. | |
168 // Assumes 0 <= min <= start <= max holds for set parameters. | |
169 virtual void SetBitrateConfigMask( | |
170 const Config::BitrateConfigMask& bitrate_mask) = 0; | |
171 | |
172 // TODO(skvlad): When the unbundled case with multiple streams for the same | 152 // TODO(skvlad): When the unbundled case with multiple streams for the same |
173 // media type going over different networks is supported, track the state | 153 // media type going over different networks is supported, track the state |
174 // for each stream separately. Right now it's global per media type. | 154 // for each stream separately. Right now it's global per media type. |
175 virtual void SignalChannelNetworkState(MediaType media, | 155 virtual void SignalChannelNetworkState(MediaType media, |
176 NetworkState state) = 0; | 156 NetworkState state) = 0; |
177 | 157 |
178 virtual void OnTransportOverheadChanged( | 158 virtual void OnTransportOverheadChanged( |
179 MediaType media, | 159 MediaType media, |
180 int transport_overhead_per_packet) = 0; | 160 int transport_overhead_per_packet) = 0; |
181 | 161 |
182 virtual void OnNetworkRouteChanged( | 162 virtual void OnNetworkRouteChanged( |
183 const std::string& transport_name, | 163 const std::string& transport_name, |
184 const rtc::NetworkRoute& network_route) = 0; | 164 const rtc::NetworkRoute& network_route) = 0; |
185 | 165 |
186 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; | 166 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; |
187 | 167 |
188 virtual ~Call() {} | 168 virtual ~Call() {} |
189 }; | 169 }; |
190 | 170 |
191 } // namespace webrtc | 171 } // namespace webrtc |
192 | 172 |
193 #endif // WEBRTC_CALL_CALL_H_ | 173 #endif // WEBRTC_CALL_CALL_H_ |
OLD | NEW |