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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ |
13 | 13 |
14 #include <list> | |
15 #include <memory> | 14 #include <memory> |
16 #include <unordered_map> | |
17 #include <vector> | |
18 | 15 |
19 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 17 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" |
23 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
24 | 21 |
25 namespace webrtc { | 22 namespace webrtc { |
26 | 23 |
27 class RtpReceiverImpl : public RtpReceiver { | 24 class RtpReceiverImpl : public RtpReceiver { |
(...skipping 24 matching lines...) Expand all Loading... |
52 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override; | 49 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override; |
53 | 50 |
54 uint32_t SSRC() const override; | 51 uint32_t SSRC() const override; |
55 | 52 |
56 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override; | 53 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override; |
57 | 54 |
58 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override; | 55 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override; |
59 | 56 |
60 TelephoneEventHandler* GetTelephoneEventHandler() override; | 57 TelephoneEventHandler* GetTelephoneEventHandler() override; |
61 | 58 |
62 std::vector<RtpSource> GetSources() const override; | |
63 | |
64 const std::vector<RtpSource>& ssrc_sources_for_testing() const { | |
65 return ssrc_sources_; | |
66 } | |
67 | |
68 const std::list<RtpSource>& csrc_sources_for_testing() const { | |
69 return csrc_sources_; | |
70 } | |
71 | |
72 private: | 59 private: |
73 bool HaveReceivedFrame() const; | 60 bool HaveReceivedFrame() const; |
74 | 61 |
75 void CheckSSRCChanged(const RTPHeader& rtp_header); | 62 void CheckSSRCChanged(const RTPHeader& rtp_header); |
76 void CheckCSRC(const WebRtcRTPHeader& rtp_header); | 63 void CheckCSRC(const WebRtcRTPHeader& rtp_header); |
77 int32_t CheckPayloadChanged(const RTPHeader& rtp_header, | 64 int32_t CheckPayloadChanged(const RTPHeader& rtp_header, |
78 const int8_t first_payload_byte, | 65 const int8_t first_payload_byte, |
79 bool* is_red, | 66 bool* is_red, |
80 PayloadUnion* payload); | 67 PayloadUnion* payload); |
81 | 68 |
82 void UpdateSources(); | |
83 void RemoveOutdatedSources(int64_t now_ms); | |
84 | |
85 Clock* clock_; | 69 Clock* clock_; |
86 RTPPayloadRegistry* rtp_payload_registry_; | 70 RTPPayloadRegistry* rtp_payload_registry_; |
87 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_; | 71 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_; |
88 | 72 |
89 RtpFeedback* cb_rtp_feedback_; | 73 RtpFeedback* cb_rtp_feedback_; |
90 | 74 |
91 rtc::CriticalSection critical_section_rtp_receiver_; | 75 rtc::CriticalSection critical_section_rtp_receiver_; |
92 int64_t last_receive_time_; | 76 int64_t last_receive_time_; |
93 size_t last_received_payload_length_; | 77 size_t last_received_payload_length_; |
94 | 78 |
95 // SSRCs. | 79 // SSRCs. |
96 uint32_t ssrc_; | 80 uint32_t ssrc_; |
97 uint8_t num_csrcs_; | 81 uint8_t num_csrcs_; |
98 uint32_t current_remote_csrc_[kRtpCsrcSize]; | 82 uint32_t current_remote_csrc_[kRtpCsrcSize]; |
99 | 83 |
100 uint32_t last_received_timestamp_; | 84 uint32_t last_received_timestamp_; |
101 int64_t last_received_frame_time_ms_; | 85 int64_t last_received_frame_time_ms_; |
102 uint16_t last_received_sequence_number_; | 86 uint16_t last_received_sequence_number_; |
103 | |
104 std::unordered_map<uint32_t, std::list<RtpSource>::iterator> | |
105 iterator_by_csrc_; | |
106 // The RtpSource objects are sorted chronologically. | |
107 std::list<RtpSource> csrc_sources_; | |
108 std::vector<RtpSource> ssrc_sources_; | |
109 }; | 87 }; |
110 } // namespace webrtc | 88 } // namespace webrtc |
111 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ | 89 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ |
OLD | NEW |