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