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