| 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 |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <map> | 13 #include <map> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "webrtc/audio/audio_receive_stream.h" | 17 #include "webrtc/audio/audio_receive_stream.h" |
| 18 #include "webrtc/audio/audio_send_stream.h" | 18 #include "webrtc/audio/audio_send_stream.h" |
| 19 #include "webrtc/audio/audio_state.h" | 19 #include "webrtc/audio/audio_state.h" |
| 20 #include "webrtc/audio/scoped_voe_interface.h" | 20 #include "webrtc/audio/scoped_voe_interface.h" |
| 21 #include "webrtc/base/basictypes.h" | |
| 22 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
| 23 #include "webrtc/base/constructormagic.h" | 22 #include "webrtc/base/constructormagic.h" |
| 24 #include "webrtc/base/logging.h" | 23 #include "webrtc/base/logging.h" |
| 25 #include "webrtc/base/task_queue.h" | 24 #include "webrtc/base/task_queue.h" |
| 26 #include "webrtc/base/thread_annotations.h" | 25 #include "webrtc/base/thread_annotations.h" |
| 27 #include "webrtc/base/thread_checker.h" | 26 #include "webrtc/base/thread_checker.h" |
| 28 #include "webrtc/base/trace_event.h" | 27 #include "webrtc/base/trace_event.h" |
| 29 #include "webrtc/call.h" | 28 #include "webrtc/call.h" |
| 30 #include "webrtc/call/bitrate_allocator.h" | 29 #include "webrtc/call/bitrate_allocator.h" |
| 31 #include "webrtc/config.h" | 30 #include "webrtc/config.h" |
| 32 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 31 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 33 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 32 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
| 34 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 33 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 35 #include "webrtc/modules/pacing/paced_sender.h" | 34 #include "webrtc/modules/pacing/paced_sender.h" |
| 36 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" | |
| 37 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 35 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 38 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 36 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 39 #include "webrtc/modules/utility/include/process_thread.h" | 37 #include "webrtc/modules/utility/include/process_thread.h" |
| 40 #include "webrtc/system_wrappers/include/clock.h" | 38 #include "webrtc/system_wrappers/include/clock.h" |
| 41 #include "webrtc/system_wrappers/include/cpu_info.h" | 39 #include "webrtc/system_wrappers/include/cpu_info.h" |
| 42 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 40 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 43 #include "webrtc/system_wrappers/include/metrics.h" | 41 #include "webrtc/system_wrappers/include/metrics.h" |
| 44 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" | 42 #include "webrtc/system_wrappers/include/rw_lock_wrapper.h" |
| 45 #include "webrtc/system_wrappers/include/trace.h" | 43 #include "webrtc/system_wrappers/include/trace.h" |
| 46 #include "webrtc/video/call_stats.h" | 44 #include "webrtc/video/call_stats.h" |
| 47 #include "webrtc/video/send_delay_stats.h" | 45 #include "webrtc/video/send_delay_stats.h" |
| 48 #include "webrtc/video/stats_counter.h" | 46 #include "webrtc/video/stats_counter.h" |
| 49 #include "webrtc/video/video_receive_stream.h" | 47 #include "webrtc/video/video_receive_stream.h" |
| 50 #include "webrtc/video/video_send_stream.h" | 48 #include "webrtc/video/video_send_stream.h" |
| 51 #include "webrtc/video/vie_remb.h" | 49 #include "webrtc/video/vie_remb.h" |
| 52 #include "webrtc/voice_engine/include/voe_codec.h" | 50 #include "webrtc/voice_engine/include/voe_codec.h" |
| 53 | 51 |
| 54 namespace webrtc { | 52 namespace webrtc { |
| 55 | 53 |
| 56 const int Call::Config::kDefaultStartBitrateBps = 300000; | 54 const int Call::Config::kDefaultStartBitrateBps = 300000; |
| 57 | 55 |
| 58 namespace internal { | 56 namespace internal { |
| 59 | 57 |
| 60 class Call : public webrtc::Call, | 58 class Call : public webrtc::Call, |
| 61 public PacketReceiver, | 59 public PacketReceiver, |
| 62 public RecoveredPacketReceiver, | |
| 63 public CongestionController::Observer, | 60 public CongestionController::Observer, |
| 64 public BitrateAllocator::LimitObserver { | 61 public BitrateAllocator::LimitObserver { |
| 65 public: | 62 public: |
| 66 explicit Call(const Call::Config& config); | 63 explicit Call(const Call::Config& config); |
| 67 virtual ~Call(); | 64 virtual ~Call(); |
| 68 | 65 |
| 69 PacketReceiver* Receiver() override; | 66 PacketReceiver* Receiver() override; |
| 70 | 67 |
| 71 webrtc::AudioSendStream* CreateAudioSendStream( | 68 webrtc::AudioSendStream* CreateAudioSendStream( |
| 72 const webrtc::AudioSendStream::Config& config) override; | 69 const webrtc::AudioSendStream::Config& config) override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 void DestroyVideoReceiveStream( | 84 void DestroyVideoReceiveStream( |
| 88 webrtc::VideoReceiveStream* receive_stream) override; | 85 webrtc::VideoReceiveStream* receive_stream) override; |
| 89 | 86 |
| 90 Stats GetStats() const override; | 87 Stats GetStats() const override; |
| 91 | 88 |
| 92 DeliveryStatus DeliverPacket(MediaType media_type, | 89 DeliveryStatus DeliverPacket(MediaType media_type, |
| 93 const uint8_t* packet, | 90 const uint8_t* packet, |
| 94 size_t length, | 91 size_t length, |
| 95 const PacketTime& packet_time) override; | 92 const PacketTime& packet_time) override; |
| 96 | 93 |
| 97 // Implements RecoveredPacketReceiver. | |
| 98 bool OnRecoveredPacket(const uint8_t* packet, size_t length) override; | |
| 99 | |
| 100 void SetBitrateConfig( | 94 void SetBitrateConfig( |
| 101 const webrtc::Call::Config::BitrateConfig& bitrate_config) override; | 95 const webrtc::Call::Config::BitrateConfig& bitrate_config) override; |
| 102 | 96 |
| 103 void SignalChannelNetworkState(MediaType media, NetworkState state) override; | 97 void SignalChannelNetworkState(MediaType media, NetworkState state) override; |
| 104 | 98 |
| 105 void OnNetworkRouteChanged(const std::string& transport_name, | 99 void OnNetworkRouteChanged(const std::string& transport_name, |
| 106 const rtc::NetworkRoute& network_route) override; | 100 const rtc::NetworkRoute& network_route) override; |
| 107 | 101 |
| 108 void OnSentPacket(const rtc::SentPacket& sent_packet) override; | 102 void OnSentPacket(const rtc::SentPacket& sent_packet) override; |
| 109 | 103 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 // TODO(solenberg): Tests call this function on a network thread, libjingle | 941 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 948 // calls on the worker thread. We should move towards always using a network | 942 // calls on the worker thread. We should move towards always using a network |
| 949 // thread. Then this check can be enabled. | 943 // thread. Then this check can be enabled. |
| 950 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 944 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 951 if (RtpHeaderParser::IsRtcp(packet, length)) | 945 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 952 return DeliverRtcp(media_type, packet, length); | 946 return DeliverRtcp(media_type, packet, length); |
| 953 | 947 |
| 954 return DeliverRtp(media_type, packet, length, packet_time); | 948 return DeliverRtp(media_type, packet, length, packet_time); |
| 955 } | 949 } |
| 956 | 950 |
| 957 // TODO(brandtr): Update this member function when we support protecting | |
| 958 // audio packets with FlexFEC. | |
| 959 bool Call::OnRecoveredPacket(const uint8_t* packet, size_t length) { | |
| 960 uint32_t ssrc = ByteReader<uint32_t>::ReadBigEndian(&packet[8]); | |
| 961 ReadLockScoped read_lock(*receive_crit_); | |
| 962 auto it = video_receive_ssrcs_.find(ssrc); | |
| 963 if (it == video_receive_ssrcs_.end()) | |
| 964 return false; | |
| 965 return it->second->OnRecoveredPacket(packet, length); | |
| 966 } | |
| 967 | |
| 968 } // namespace internal | 951 } // namespace internal |
| 969 } // namespace webrtc | 952 } // namespace webrtc |
| OLD | NEW |