OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #ifndef WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ | 11 #ifndef WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ |
12 #define WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ | 12 #define WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
16 #include <memory> | 16 #include <memory> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/criticalsection.h" | 21 #include "webrtc/base/criticalsection.h" |
| 22 #include "webrtc/call/rtp_transport_controller_receive.h" |
22 #include "webrtc/modules/include/module_common_types.h" | 23 #include "webrtc/modules/include/module_common_types.h" |
23 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
24 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" | 25 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
25 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 28 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
28 #include "webrtc/modules/video_coding/h264_sps_pps_tracker.h" | 29 #include "webrtc/modules/video_coding/h264_sps_pps_tracker.h" |
29 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 30 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
30 #include "webrtc/modules/video_coding/packet_buffer.h" | 31 #include "webrtc/modules/video_coding/packet_buffer.h" |
31 #include "webrtc/modules/video_coding/rtp_frame_reference_finder.h" | 32 #include "webrtc/modules/video_coding/rtp_frame_reference_finder.h" |
(...skipping 18 matching lines...) Expand all Loading... |
50 class Transport; | 51 class Transport; |
51 class UlpfecReceiver; | 52 class UlpfecReceiver; |
52 class VCMTiming; | 53 class VCMTiming; |
53 | 54 |
54 namespace vcm { | 55 namespace vcm { |
55 class VideoReceiver; | 56 class VideoReceiver; |
56 } // namespace vcm | 57 } // namespace vcm |
57 | 58 |
58 class RtpStreamReceiver : public RtpData, | 59 class RtpStreamReceiver : public RtpData, |
59 public RtpFeedback, | 60 public RtpFeedback, |
| 61 public RtpPacketReceiverInterface, |
60 public VCMFrameTypeCallback, | 62 public VCMFrameTypeCallback, |
61 public VCMPacketRequestCallback, | 63 public VCMPacketRequestCallback, |
62 public video_coding::OnReceivedFrameCallback, | 64 public video_coding::OnReceivedFrameCallback, |
63 public video_coding::OnCompleteFrameCallback, | 65 public video_coding::OnCompleteFrameCallback, |
64 public CallStatsObserver { | 66 public CallStatsObserver { |
65 public: | 67 public: |
66 RtpStreamReceiver( | 68 RtpStreamReceiver( |
67 Transport* transport, | 69 Transport* transport, |
68 RtcpRttStats* rtt_stats, | 70 RtcpRttStats* rtt_stats, |
69 PacketRouter* packet_router, | 71 PacketRouter* packet_router, |
(...skipping 18 matching lines...) Expand all Loading... |
88 void StopReceive(); | 90 void StopReceive(); |
89 | 91 |
90 bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length); | 92 bool DeliverRtcp(const uint8_t* rtcp_packet, size_t rtcp_packet_length); |
91 | 93 |
92 void FrameContinuous(uint16_t seq_num); | 94 void FrameContinuous(uint16_t seq_num); |
93 | 95 |
94 void FrameDecoded(uint16_t seq_num); | 96 void FrameDecoded(uint16_t seq_num); |
95 | 97 |
96 void SignalNetworkState(NetworkState state); | 98 void SignalNetworkState(NetworkState state); |
97 | 99 |
98 // TODO(nisse): Intended to be part of an RtpPacketReceiver interface. | 100 // RtpPacketReceiverInterface implementation. |
99 void OnRtpPacket(const RtpPacketReceived& packet); | 101 bool OnRtpPacketReceive(RtpPacketReceived* packet) override; |
100 | 102 |
101 // Implements RtpData. | 103 // Implements RtpData. |
102 int32_t OnReceivedPayloadData(const uint8_t* payload_data, | 104 int32_t OnReceivedPayloadData(const uint8_t* payload_data, |
103 size_t payload_size, | 105 size_t payload_size, |
104 const WebRtcRTPHeader* rtp_header) override; | 106 const WebRtcRTPHeader* rtp_header) override; |
105 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; | 107 bool OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override; |
106 | 108 |
107 // Implements RtpFeedback. | 109 // Implements RtpFeedback. |
108 int32_t OnInitializeDecoder(int8_t payload_type, | 110 int32_t OnInitializeDecoder(int8_t payload_type, |
109 const char payload_name[RTP_PAYLOAD_NAME_SIZE], | 111 const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 bool in_order); | 145 bool in_order); |
144 // Parses and handles for instance RTX and RED headers. | 146 // Parses and handles for instance RTX and RED headers. |
145 // This function assumes that it's being called from only one thread. | 147 // This function assumes that it's being called from only one thread. |
146 bool ParseAndHandleEncapsulatingHeader(const uint8_t* packet, | 148 bool ParseAndHandleEncapsulatingHeader(const uint8_t* packet, |
147 size_t packet_length, | 149 size_t packet_length, |
148 const RTPHeader& header); | 150 const RTPHeader& header); |
149 void NotifyReceiverOfFecPacket(const RTPHeader& header); | 151 void NotifyReceiverOfFecPacket(const RTPHeader& header); |
150 bool IsPacketInOrder(const RTPHeader& header) const; | 152 bool IsPacketInOrder(const RTPHeader& header) const; |
151 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; | 153 bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; |
152 void UpdateHistograms(); | 154 void UpdateHistograms(); |
153 void EnableReceiveRtpHeaderExtension(const std::string& extension, int id); | |
154 bool IsRedEnabled() const; | 155 bool IsRedEnabled() const; |
155 void InsertSpsPpsIntoTracker(uint8_t payload_type); | 156 void InsertSpsPpsIntoTracker(uint8_t payload_type); |
156 | 157 |
157 Clock* const clock_; | 158 Clock* const clock_; |
158 // Ownership of this object lies with VideoReceiveStream, which owns |this|. | 159 // Ownership of this object lies with VideoReceiveStream, which owns |this|. |
159 const VideoReceiveStream::Config& config_; | 160 const VideoReceiveStream::Config& config_; |
160 PacketRouter* const packet_router_; | 161 PacketRouter* const packet_router_; |
161 ProcessThread* const process_thread_; | 162 ProcessThread* const process_thread_; |
162 | 163 |
163 RemoteNtpTimeEstimator ntp_estimator_; | 164 RemoteNtpTimeEstimator ntp_estimator_; |
164 RTPPayloadRegistry rtp_payload_registry_; | 165 RTPPayloadRegistry rtp_payload_registry_; |
165 | 166 |
166 const std::unique_ptr<RtpHeaderParser> rtp_header_parser_; | 167 RtpHeaderExtensionMap rtp_header_extensions_; |
167 const std::unique_ptr<RtpReceiver> rtp_receiver_; | 168 const std::unique_ptr<RtpReceiver> rtp_receiver_; |
168 const std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; | 169 const std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; |
169 std::unique_ptr<UlpfecReceiver> ulpfec_receiver_; | 170 std::unique_ptr<UlpfecReceiver> ulpfec_receiver_; |
170 | 171 |
171 rtc::CriticalSection receive_cs_; | 172 rtc::CriticalSection receive_cs_; |
172 bool receiving_ GUARDED_BY(receive_cs_); | 173 bool receiving_ GUARDED_BY(receive_cs_); |
173 uint8_t restored_packet_[IP_PACKET_SIZE] GUARDED_BY(receive_cs_); | 174 uint8_t restored_packet_[IP_PACKET_SIZE] GUARDED_BY(receive_cs_); |
174 bool restored_packet_in_use_ GUARDED_BY(receive_cs_); | 175 bool restored_packet_in_use_ GUARDED_BY(receive_cs_); |
175 int64_t last_packet_log_ms_ GUARDED_BY(receive_cs_); | 176 int64_t last_packet_log_ms_ GUARDED_BY(receive_cs_); |
176 | 177 |
(...skipping 13 matching lines...) Expand all Loading... |
190 // TODO(johan): Remove pt_codec_params_ once | 191 // TODO(johan): Remove pt_codec_params_ once |
191 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved. | 192 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6883 is resolved. |
192 // Maps a payload type to a map of out-of-band supplied codec parameters. | 193 // Maps a payload type to a map of out-of-band supplied codec parameters. |
193 std::map<uint8_t, std::map<std::string, std::string>> pt_codec_params_; | 194 std::map<uint8_t, std::map<std::string, std::string>> pt_codec_params_; |
194 int16_t last_payload_type_ = -1; | 195 int16_t last_payload_type_ = -1; |
195 }; | 196 }; |
196 | 197 |
197 } // namespace webrtc | 198 } // namespace webrtc |
198 | 199 |
199 #endif // WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ | 200 #endif // WEBRTC_VIDEO_RTP_STREAM_RECEIVER_H_ |
OLD | NEW |