Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h

Issue 2770233003: Implemented the GetSources() in native code. (Closed)
Patch Set: Add a direct dependency to the webrtc/voice_engine/BUILD.gn Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
14 #include <memory> 15 #include <memory>
16 #include <unordered_map>
17 #include <vector>
15 18
16 #include "webrtc/base/criticalsection.h" 19 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
20 #include "webrtc/typedefs.h" 23 #include "webrtc/typedefs.h"
21 24
22 namespace webrtc { 25 namespace webrtc {
23 26
24 class RtpReceiverImpl : public RtpReceiver { 27 class RtpReceiverImpl : public RtpReceiver {
(...skipping 24 matching lines...) Expand all
49 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override; 52 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override;
50 53
51 uint32_t SSRC() const override; 54 uint32_t SSRC() const override;
52 55
53 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override; 56 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override;
54 57
55 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override; 58 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
56 59
57 TelephoneEventHandler* GetTelephoneEventHandler() override; 60 TelephoneEventHandler* GetTelephoneEventHandler() override;
58 61
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
59 private: 72 private:
60 bool HaveReceivedFrame() const; 73 bool HaveReceivedFrame() const;
61 74
62 void CheckSSRCChanged(const RTPHeader& rtp_header); 75 void CheckSSRCChanged(const RTPHeader& rtp_header);
63 void CheckCSRC(const WebRtcRTPHeader& rtp_header); 76 void CheckCSRC(const WebRtcRTPHeader& rtp_header);
64 int32_t CheckPayloadChanged(const RTPHeader& rtp_header, 77 int32_t CheckPayloadChanged(const RTPHeader& rtp_header,
65 const int8_t first_payload_byte, 78 const int8_t first_payload_byte,
66 bool* is_red, 79 bool* is_red,
67 PayloadUnion* payload); 80 PayloadUnion* payload);
68 81
82 void UpdateSources();
83 void RemoveOutdatedSources(int64_t now_ms);
84
69 Clock* clock_; 85 Clock* clock_;
70 RTPPayloadRegistry* rtp_payload_registry_; 86 RTPPayloadRegistry* rtp_payload_registry_;
71 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_; 87 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_;
72 88
73 RtpFeedback* cb_rtp_feedback_; 89 RtpFeedback* cb_rtp_feedback_;
74 90
75 rtc::CriticalSection critical_section_rtp_receiver_; 91 rtc::CriticalSection critical_section_rtp_receiver_;
76 int64_t last_receive_time_; 92 int64_t last_receive_time_;
77 size_t last_received_payload_length_; 93 size_t last_received_payload_length_;
78 94
79 // SSRCs. 95 // SSRCs.
80 uint32_t ssrc_; 96 uint32_t ssrc_;
81 uint8_t num_csrcs_; 97 uint8_t num_csrcs_;
82 uint32_t current_remote_csrc_[kRtpCsrcSize]; 98 uint32_t current_remote_csrc_[kRtpCsrcSize];
83 99
84 uint32_t last_received_timestamp_; 100 uint32_t last_received_timestamp_;
85 int64_t last_received_frame_time_ms_; 101 int64_t last_received_frame_time_ms_;
86 uint16_t last_received_sequence_number_; 102 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_;
87 }; 109 };
88 } // namespace webrtc 110 } // namespace webrtc
89 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ 111 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698