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 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 uint32_t max_padding_bitrate_bps) override; | 229 uint32_t max_padding_bitrate_bps) override; |
230 | 230 |
231 private: | 231 private: |
232 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, | 232 DeliveryStatus DeliverRtcp(MediaType media_type, const uint8_t* packet, |
233 size_t length); | 233 size_t length); |
234 DeliveryStatus DeliverRtp(MediaType media_type, | 234 DeliveryStatus DeliverRtp(MediaType media_type, |
235 const uint8_t* packet, | 235 const uint8_t* packet, |
236 size_t length, | 236 size_t length, |
237 const PacketTime& packet_time); | 237 const PacketTime& packet_time); |
238 void ConfigureSync(const std::string& sync_group) | 238 void ConfigureSync(const std::string& sync_group) |
239 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 239 RTC_EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
240 | 240 |
241 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, | 241 void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, |
242 MediaType media_type) | 242 MediaType media_type) |
243 SHARED_LOCKS_REQUIRED(receive_crit_); | 243 RTC_SHARED_LOCKS_REQUIRED(receive_crit_); |
244 | 244 |
245 rtc::Optional<RtpPacketReceived> ParseRtpPacket( | 245 rtc::Optional<RtpPacketReceived> ParseRtpPacket( |
246 const uint8_t* packet, | 246 const uint8_t* packet, |
247 size_t length, | 247 size_t length, |
248 const PacketTime* packet_time) const; | 248 const PacketTime* packet_time) const; |
249 | 249 |
250 void UpdateSendHistograms(int64_t first_sent_packet_ms) | 250 void UpdateSendHistograms(int64_t first_sent_packet_ms) |
251 EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); | 251 RTC_EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); |
252 void UpdateReceiveHistograms(); | 252 void UpdateReceiveHistograms(); |
253 void UpdateHistograms(); | 253 void UpdateHistograms(); |
254 void UpdateAggregateNetworkState(); | 254 void UpdateAggregateNetworkState(); |
255 | 255 |
256 // Applies update to the BitrateConfig cached in |config_|, restarting | 256 // Applies update to the BitrateConfig cached in |config_|, restarting |
257 // bandwidth estimation from |new_start| if set. | 257 // bandwidth estimation from |new_start| if set. |
258 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); | 258 void UpdateCurrentBitrateConfig(const rtc::Optional<int>& new_start); |
259 | 259 |
260 Clock* const clock_; | 260 Clock* const clock_; |
261 | 261 |
262 const int num_cpu_cores_; | 262 const int num_cpu_cores_; |
263 const std::unique_ptr<ProcessThread> module_process_thread_; | 263 const std::unique_ptr<ProcessThread> module_process_thread_; |
264 const std::unique_ptr<ProcessThread> pacer_thread_; | 264 const std::unique_ptr<ProcessThread> pacer_thread_; |
265 const std::unique_ptr<CallStats> call_stats_; | 265 const std::unique_ptr<CallStats> call_stats_; |
266 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; | 266 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; |
267 Call::Config config_; | 267 Call::Config config_; |
268 rtc::SequencedTaskChecker configuration_sequence_checker_; | 268 rtc::SequencedTaskChecker configuration_sequence_checker_; |
269 | 269 |
270 NetworkState audio_network_state_; | 270 NetworkState audio_network_state_; |
271 NetworkState video_network_state_; | 271 NetworkState video_network_state_; |
272 | 272 |
273 std::unique_ptr<RWLockWrapper> receive_crit_; | 273 std::unique_ptr<RWLockWrapper> receive_crit_; |
274 // Audio, Video, and FlexFEC receive streams are owned by the client that | 274 // Audio, Video, and FlexFEC receive streams are owned by the client that |
275 // creates them. | 275 // creates them. |
276 std::set<AudioReceiveStream*> audio_receive_streams_ | 276 std::set<AudioReceiveStream*> audio_receive_streams_ |
277 GUARDED_BY(receive_crit_); | 277 RTC_GUARDED_BY(receive_crit_); |
278 std::set<VideoReceiveStream*> video_receive_streams_ | 278 std::set<VideoReceiveStream*> video_receive_streams_ |
279 GUARDED_BY(receive_crit_); | 279 RTC_GUARDED_BY(receive_crit_); |
280 | 280 |
281 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ | 281 std::map<std::string, AudioReceiveStream*> sync_stream_mapping_ |
282 GUARDED_BY(receive_crit_); | 282 RTC_GUARDED_BY(receive_crit_); |
283 | 283 |
284 // TODO(nisse): Should eventually be injected at creation, | 284 // TODO(nisse): Should eventually be injected at creation, |
285 // with a single object in the bundled case. | 285 // with a single object in the bundled case. |
286 RtpStreamReceiverController audio_receiver_controller_; | 286 RtpStreamReceiverController audio_receiver_controller_; |
287 RtpStreamReceiverController video_receiver_controller_; | 287 RtpStreamReceiverController video_receiver_controller_; |
288 | 288 |
289 // This extra map is used for receive processing which is | 289 // This extra map is used for receive processing which is |
290 // independent of media type. | 290 // independent of media type. |
291 | 291 |
292 // TODO(nisse): In the RTP transport refactoring, we should have a | 292 // TODO(nisse): In the RTP transport refactoring, we should have a |
293 // single mapping from ssrc to a more abstract receive stream, with | 293 // single mapping from ssrc to a more abstract receive stream, with |
294 // accessor methods for all configuration we need at this level. | 294 // accessor methods for all configuration we need at this level. |
295 struct ReceiveRtpConfig { | 295 struct ReceiveRtpConfig { |
296 ReceiveRtpConfig() = default; // Needed by std::map | 296 ReceiveRtpConfig() = default; // Needed by std::map |
297 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, | 297 ReceiveRtpConfig(const std::vector<RtpExtension>& extensions, |
298 bool use_send_side_bwe) | 298 bool use_send_side_bwe) |
299 : extensions(extensions), use_send_side_bwe(use_send_side_bwe) {} | 299 : extensions(extensions), use_send_side_bwe(use_send_side_bwe) {} |
300 | 300 |
301 // Registered RTP header extensions for each stream. Note that RTP header | 301 // Registered RTP header extensions for each stream. Note that RTP header |
302 // extensions are negotiated per track ("m= line") in the SDP, but we have | 302 // extensions are negotiated per track ("m= line") in the SDP, but we have |
303 // no notion of tracks at the Call level. We therefore store the RTP header | 303 // no notion of tracks at the Call level. We therefore store the RTP header |
304 // extensions per SSRC instead, which leads to some storage overhead. | 304 // extensions per SSRC instead, which leads to some storage overhead. |
305 RtpHeaderExtensionMap extensions; | 305 RtpHeaderExtensionMap extensions; |
306 // Set if both RTP extension the RTCP feedback message needed for | 306 // Set if both RTP extension the RTCP feedback message needed for |
307 // send side BWE are negotiated. | 307 // send side BWE are negotiated. |
308 bool use_send_side_bwe = false; | 308 bool use_send_side_bwe = false; |
309 }; | 309 }; |
310 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_ | 310 std::map<uint32_t, ReceiveRtpConfig> receive_rtp_config_ |
311 GUARDED_BY(receive_crit_); | 311 RTC_GUARDED_BY(receive_crit_); |
312 | 312 |
313 std::unique_ptr<RWLockWrapper> send_crit_; | 313 std::unique_ptr<RWLockWrapper> send_crit_; |
314 // Audio and Video send streams are owned by the client that creates them. | 314 // Audio and Video send streams are owned by the client that creates them. |
315 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_); | 315 std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ |
316 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_); | 316 RTC_GUARDED_BY(send_crit_); |
317 std::set<VideoSendStream*> video_send_streams_ GUARDED_BY(send_crit_); | 317 std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ |
| 318 RTC_GUARDED_BY(send_crit_); |
| 319 std::set<VideoSendStream*> video_send_streams_ RTC_GUARDED_BY(send_crit_); |
318 | 320 |
319 using RtpStateMap = std::map<uint32_t, RtpState>; | 321 using RtpStateMap = std::map<uint32_t, RtpState>; |
320 RtpStateMap suspended_audio_send_ssrcs_ | 322 RtpStateMap suspended_audio_send_ssrcs_ |
321 GUARDED_BY(configuration_sequence_checker_); | 323 RTC_GUARDED_BY(configuration_sequence_checker_); |
322 RtpStateMap suspended_video_send_ssrcs_ | 324 RtpStateMap suspended_video_send_ssrcs_ |
323 GUARDED_BY(configuration_sequence_checker_); | 325 RTC_GUARDED_BY(configuration_sequence_checker_); |
324 | 326 |
325 webrtc::RtcEventLog* event_log_; | 327 webrtc::RtcEventLog* event_log_; |
326 | 328 |
327 // The following members are only accessed (exclusively) from one thread and | 329 // The following members are only accessed (exclusively) from one thread and |
328 // from the destructor, and therefore doesn't need any explicit | 330 // from the destructor, and therefore doesn't need any explicit |
329 // synchronization. | 331 // synchronization. |
330 RateCounter received_bytes_per_second_counter_; | 332 RateCounter received_bytes_per_second_counter_; |
331 RateCounter received_audio_bytes_per_second_counter_; | 333 RateCounter received_audio_bytes_per_second_counter_; |
332 RateCounter received_video_bytes_per_second_counter_; | 334 RateCounter received_video_bytes_per_second_counter_; |
333 RateCounter received_rtcp_bytes_per_second_counter_; | 335 RateCounter received_rtcp_bytes_per_second_counter_; |
334 rtc::Optional<int64_t> first_received_rtp_audio_ms_; | 336 rtc::Optional<int64_t> first_received_rtp_audio_ms_; |
335 rtc::Optional<int64_t> last_received_rtp_audio_ms_; | 337 rtc::Optional<int64_t> last_received_rtp_audio_ms_; |
336 rtc::Optional<int64_t> first_received_rtp_video_ms_; | 338 rtc::Optional<int64_t> first_received_rtp_video_ms_; |
337 rtc::Optional<int64_t> last_received_rtp_video_ms_; | 339 rtc::Optional<int64_t> last_received_rtp_video_ms_; |
338 TimeInterval sent_rtp_audio_timer_ms_; | 340 TimeInterval sent_rtp_audio_timer_ms_; |
339 | 341 |
340 // TODO(holmer): Remove this lock once BitrateController no longer calls | 342 // TODO(holmer): Remove this lock once BitrateController no longer calls |
341 // OnNetworkChanged from multiple threads. | 343 // OnNetworkChanged from multiple threads. |
342 rtc::CriticalSection bitrate_crit_; | 344 rtc::CriticalSection bitrate_crit_; |
343 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 345 uint32_t min_allocated_send_bitrate_bps_ RTC_GUARDED_BY(&bitrate_crit_); |
344 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); | 346 uint32_t configured_max_padding_bitrate_bps_ RTC_GUARDED_BY(&bitrate_crit_); |
345 AvgCounter estimated_send_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 347 AvgCounter estimated_send_bitrate_kbps_counter_ |
346 AvgCounter pacer_bitrate_kbps_counter_ GUARDED_BY(&bitrate_crit_); | 348 RTC_GUARDED_BY(&bitrate_crit_); |
| 349 AvgCounter pacer_bitrate_kbps_counter_ RTC_GUARDED_BY(&bitrate_crit_); |
347 | 350 |
348 std::map<std::string, rtc::NetworkRoute> network_routes_; | 351 std::map<std::string, rtc::NetworkRoute> network_routes_; |
349 | 352 |
350 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_; | 353 std::unique_ptr<RtpTransportControllerSendInterface> transport_send_; |
351 ReceiveSideCongestionController receive_side_cc_; | 354 ReceiveSideCongestionController receive_side_cc_; |
352 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; | 355 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; |
353 const int64_t start_ms_; | 356 const int64_t start_ms_; |
354 // TODO(perkj): |worker_queue_| is supposed to replace | 357 // TODO(perkj): |worker_queue_| is supposed to replace |
355 // |module_process_thread_|. | 358 // |module_process_thread_|. |
356 // |worker_queue| is defined last to ensure all pending tasks are cancelled | 359 // |worker_queue| is defined last to ensure all pending tasks are cancelled |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { | 1438 (use_send_side_bwe && header.extension.hasTransportSequenceNumber)) { |
1436 receive_side_cc_.OnReceivedPacket( | 1439 receive_side_cc_.OnReceivedPacket( |
1437 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), | 1440 packet.arrival_time_ms(), packet.payload_size() + packet.padding_size(), |
1438 header); | 1441 header); |
1439 } | 1442 } |
1440 } | 1443 } |
1441 | 1444 |
1442 } // namespace internal | 1445 } // namespace internal |
1443 | 1446 |
1444 } // namespace webrtc | 1447 } // namespace webrtc |
OLD | NEW |