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 <string> | 14 #include <string> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
| 17 #include "webrtc/api/rtcerror.h" |
16 #include "webrtc/base/networkroute.h" | 18 #include "webrtc/base/networkroute.h" |
17 #include "webrtc/base/platform_file.h" | 19 #include "webrtc/base/platform_file.h" |
18 #include "webrtc/base/socket.h" | 20 #include "webrtc/base/socket.h" |
19 #include "webrtc/call/audio_receive_stream.h" | 21 #include "webrtc/call/audio_receive_stream.h" |
20 #include "webrtc/call/audio_send_stream.h" | 22 #include "webrtc/call/audio_send_stream.h" |
21 #include "webrtc/call/audio_state.h" | 23 #include "webrtc/call/audio_state.h" |
22 #include "webrtc/call/flexfec_receive_stream.h" | 24 #include "webrtc/call/flexfec_receive_stream.h" |
| 25 #include "webrtc/call/rtp_transport_controller_send.h" |
23 #include "webrtc/common_types.h" | 26 #include "webrtc/common_types.h" |
24 #include "webrtc/video_receive_stream.h" | 27 #include "webrtc/video_receive_stream.h" |
25 #include "webrtc/video_send_stream.h" | 28 #include "webrtc/video_send_stream.h" |
26 | 29 |
27 namespace webrtc { | 30 namespace webrtc { |
28 | 31 |
29 class AudioProcessing; | 32 class AudioProcessing; |
30 class RtcEventLog; | 33 class RtcEventLog; |
31 | 34 |
32 enum class MediaType { | 35 enum class MediaType { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 static const int kDefaultStartBitrateBps; | 69 static const int kDefaultStartBitrateBps; |
67 | 70 |
68 // Bitrate config used until valid bitrate estimates are calculated. Also | 71 // Bitrate config used until valid bitrate estimates are calculated. Also |
69 // used to cap total bitrate used. | 72 // used to cap total bitrate used. |
70 struct BitrateConfig { | 73 struct BitrateConfig { |
71 int min_bitrate_bps = 0; | 74 int min_bitrate_bps = 0; |
72 int start_bitrate_bps = kDefaultStartBitrateBps; | 75 int start_bitrate_bps = kDefaultStartBitrateBps; |
73 int max_bitrate_bps = -1; | 76 int max_bitrate_bps = -1; |
74 } bitrate_config; | 77 } bitrate_config; |
75 | 78 |
| 79 // TODO(zstein): Consider using PeerConnectionInterface::BitrateParameters |
| 80 // instead (and move BitrateParameters to its own file in api/). |
| 81 struct BitrateConfigMask { |
| 82 rtc::Optional<int> min_bitrate_bps; |
| 83 rtc::Optional<int> start_bitrate_bps; |
| 84 rtc::Optional<int> max_bitrate_bps; |
| 85 }; |
| 86 |
76 // AudioState which is possibly shared between multiple calls. | 87 // AudioState which is possibly shared between multiple calls. |
77 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 88 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. |
78 rtc::scoped_refptr<AudioState> audio_state; | 89 rtc::scoped_refptr<AudioState> audio_state; |
79 | 90 |
80 // Audio Processing Module to be used in this call. | 91 // Audio Processing Module to be used in this call. |
81 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 92 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. |
82 AudioProcessing* audio_processing = nullptr; | 93 AudioProcessing* audio_processing = nullptr; |
83 | 94 |
84 // RtcEventLog to use for this call. Required. | 95 // RtcEventLog to use for this call. Required. |
85 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. | 96 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. |
86 RtcEventLog* event_log = nullptr; | 97 RtcEventLog* event_log = nullptr; |
87 }; | 98 }; |
88 | 99 |
89 struct Stats { | 100 struct Stats { |
90 std::string ToString(int64_t time_ms) const; | 101 std::string ToString(int64_t time_ms) const; |
91 | 102 |
92 int send_bandwidth_bps = 0; // Estimated available send bandwidth. | 103 int send_bandwidth_bps = 0; // Estimated available send bandwidth. |
93 int max_padding_bitrate_bps = 0; // Cumulative configured max padding. | 104 int max_padding_bitrate_bps = 0; // Cumulative configured max padding. |
94 int recv_bandwidth_bps = 0; // Estimated available receive bandwidth. | 105 int recv_bandwidth_bps = 0; // Estimated available receive bandwidth. |
95 int64_t pacer_delay_ms = 0; | 106 int64_t pacer_delay_ms = 0; |
96 int64_t rtt_ms = -1; | 107 int64_t rtt_ms = -1; |
97 }; | 108 }; |
98 | 109 |
99 static Call* Create(const Call::Config& config); | 110 static Call* Create(const Call::Config& config); |
100 | 111 |
| 112 // Allows mocking |transport_send| for testing. |
| 113 static Call* Create( |
| 114 const Call::Config& config, |
| 115 std::unique_ptr<RtpTransportControllerSendInterface> transport_send); |
| 116 |
101 virtual AudioSendStream* CreateAudioSendStream( | 117 virtual AudioSendStream* CreateAudioSendStream( |
102 const AudioSendStream::Config& config) = 0; | 118 const AudioSendStream::Config& config) = 0; |
103 virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0; | 119 virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0; |
104 | 120 |
105 virtual AudioReceiveStream* CreateAudioReceiveStream( | 121 virtual AudioReceiveStream* CreateAudioReceiveStream( |
106 const AudioReceiveStream::Config& config) = 0; | 122 const AudioReceiveStream::Config& config) = 0; |
107 virtual void DestroyAudioReceiveStream( | 123 virtual void DestroyAudioReceiveStream( |
108 AudioReceiveStream* receive_stream) = 0; | 124 AudioReceiveStream* receive_stream) = 0; |
109 | 125 |
110 virtual VideoSendStream* CreateVideoSendStream( | 126 virtual VideoSendStream* CreateVideoSendStream( |
(...skipping 16 matching lines...) Expand all Loading... |
127 | 143 |
128 // All received RTP and RTCP packets for the call should be inserted to this | 144 // All received RTP and RTCP packets for the call should be inserted to this |
129 // PacketReceiver. The PacketReceiver pointer is valid as long as the | 145 // PacketReceiver. The PacketReceiver pointer is valid as long as the |
130 // Call instance exists. | 146 // Call instance exists. |
131 virtual PacketReceiver* Receiver() = 0; | 147 virtual PacketReceiver* Receiver() = 0; |
132 | 148 |
133 // Returns the call statistics, such as estimated send and receive bandwidth, | 149 // Returns the call statistics, such as estimated send and receive bandwidth, |
134 // pacing delay, etc. | 150 // pacing delay, etc. |
135 virtual Stats GetStats() const = 0; | 151 virtual Stats GetStats() const = 0; |
136 | 152 |
137 // TODO(pbos): Like BitrateConfig above this is currently per-stream instead | 153 // The min and start values will only be used if they are not set by |
138 // of maximum for entire Call. This should be fixed along with the above. | 154 // SetBitrateConfigMask. The minimum max set by the two calls will be used. |
139 // Specifying a start bitrate (>0) will currently reset the current bitrate | 155 // Specifying a start bitrate (>0) will reset the current bitrate estimate. |
140 // estimate. This is due to how the 'x-google-start-bitrate' flag is currently | 156 // This is due to how the 'x-google-start-bitrate' flag is currently |
141 // implemented. | 157 // implemented. |
142 virtual void SetBitrateConfig( | 158 virtual void SetBitrateConfig( |
143 const Config::BitrateConfig& bitrate_config) = 0; | 159 const Config::BitrateConfig& bitrate_config) = 0; |
144 | 160 |
| 161 // The min and start values set here are preferred to values set by |
| 162 // SetBitrateConfig. The minimum of the max set by the two calls will be used. |
| 163 // Assumes 0 <= min <= start <= max holds for set parameters. |
| 164 virtual RTCError SetBitrateConfigMask( |
| 165 const Config::BitrateConfigMask& bitrate_mask) = 0; |
| 166 |
145 // TODO(skvlad): When the unbundled case with multiple streams for the same | 167 // TODO(skvlad): When the unbundled case with multiple streams for the same |
146 // media type going over different networks is supported, track the state | 168 // media type going over different networks is supported, track the state |
147 // for each stream separately. Right now it's global per media type. | 169 // for each stream separately. Right now it's global per media type. |
148 virtual void SignalChannelNetworkState(MediaType media, | 170 virtual void SignalChannelNetworkState(MediaType media, |
149 NetworkState state) = 0; | 171 NetworkState state) = 0; |
150 | 172 |
151 virtual void OnTransportOverheadChanged( | 173 virtual void OnTransportOverheadChanged( |
152 MediaType media, | 174 MediaType media, |
153 int transport_overhead_per_packet) = 0; | 175 int transport_overhead_per_packet) = 0; |
154 | 176 |
155 virtual void OnNetworkRouteChanged( | 177 virtual void OnNetworkRouteChanged( |
156 const std::string& transport_name, | 178 const std::string& transport_name, |
157 const rtc::NetworkRoute& network_route) = 0; | 179 const rtc::NetworkRoute& network_route) = 0; |
158 | 180 |
159 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; | 181 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; |
160 | 182 |
161 virtual ~Call() {} | 183 virtual ~Call() {} |
162 }; | 184 }; |
163 | 185 |
164 } // namespace webrtc | 186 } // namespace webrtc |
165 | 187 |
166 #endif // WEBRTC_CALL_CALL_H_ | 188 #endif // WEBRTC_CALL_CALL_H_ |
OLD | NEW |