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

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

Issue 2770233003: Implemented the GetSources() in native code. (Closed)
Patch Set: Merge and add the tests. 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 <memory> 14 #include <memory>
15 #include <vector>
15 16
16 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 18 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
19 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h" 20 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
20 #include "webrtc/typedefs.h" 21 #include "webrtc/typedefs.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
25 // The maximum size of the ring buffer of the RtpContributingSource objects.
26 static const size_t kContributingSourcesBufferSize = 500;
hbos 2017/03/30 09:51:54 What is the reason for choosing 500? Is this arbit
Zhi Huang 2017/03/31 06:44:04 I'm not sure what is right size of this. It is exp
27
24 class RtpReceiverImpl : public RtpReceiver { 28 class RtpReceiverImpl : public RtpReceiver {
25 public: 29 public:
26 // Callbacks passed in here may not be NULL (use Null Object callbacks if you 30 // Callbacks passed in here may not be NULL (use Null Object callbacks if you
27 // want callbacks to do nothing). This class takes ownership of the media 31 // want callbacks to do nothing). This class takes ownership of the media
28 // receiver but nothing else. 32 // receiver but nothing else.
29 RtpReceiverImpl(Clock* clock, 33 RtpReceiverImpl(Clock* clock,
30 RtpFeedback* incoming_messages_callback, 34 RtpFeedback* incoming_messages_callback,
31 RTPPayloadRegistry* rtp_payload_registry, 35 RTPPayloadRegistry* rtp_payload_registry,
32 RTPReceiverStrategy* rtp_media_receiver); 36 RTPReceiverStrategy* rtp_media_receiver);
33 37
(...skipping 15 matching lines...) Expand all
49 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override; 53 bool LastReceivedTimeMs(int64_t* receive_time_ms) const override;
50 54
51 uint32_t SSRC() const override; 55 uint32_t SSRC() const override;
52 56
53 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override; 57 int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override;
54 58
55 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override; 59 int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
56 60
57 TelephoneEventHandler* GetTelephoneEventHandler() override; 61 TelephoneEventHandler* GetTelephoneEventHandler() override;
58 62
63 const std::vector<RtpContributingSource*>& GetContributingSources() override;
64
59 private: 65 private:
60 bool HaveReceivedFrame() const; 66 bool HaveReceivedFrame() const;
61 67
62 void CheckSSRCChanged(const RTPHeader& rtp_header); 68 void CheckSSRCChanged(const RTPHeader& rtp_header);
63 void CheckCSRC(const WebRtcRTPHeader& rtp_header); 69 void CheckCSRC(const WebRtcRTPHeader& rtp_header);
64 int32_t CheckPayloadChanged(const RTPHeader& rtp_header, 70 int32_t CheckPayloadChanged(const RTPHeader& rtp_header,
65 const int8_t first_payload_byte, 71 const int8_t first_payload_byte,
66 bool* is_red, 72 bool* is_red,
67 PayloadUnion* payload); 73 PayloadUnion* payload);
68 74
75 void UpdateContributingSource();
76
69 Clock* clock_; 77 Clock* clock_;
70 RTPPayloadRegistry* rtp_payload_registry_; 78 RTPPayloadRegistry* rtp_payload_registry_;
71 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_; 79 std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_;
72 80
73 RtpFeedback* cb_rtp_feedback_; 81 RtpFeedback* cb_rtp_feedback_;
74 82
75 rtc::CriticalSection critical_section_rtp_receiver_; 83 rtc::CriticalSection critical_section_rtp_receiver_;
76 int64_t last_receive_time_; 84 int64_t last_receive_time_;
77 size_t last_received_payload_length_; 85 size_t last_received_payload_length_;
78 86
79 // SSRCs. 87 // SSRCs.
80 uint32_t ssrc_; 88 uint32_t ssrc_;
81 uint8_t num_csrcs_; 89 uint8_t num_csrcs_;
82 uint32_t current_remote_csrc_[kRtpCsrcSize]; 90 uint32_t current_remote_csrc_[kRtpCsrcSize];
83 91
84 uint32_t last_received_timestamp_; 92 uint32_t last_received_timestamp_;
85 int64_t last_received_frame_time_ms_; 93 int64_t last_received_frame_time_ms_;
86 uint16_t last_received_sequence_number_; 94 uint16_t last_received_sequence_number_;
95
96 // Contributing Sources.
97 std::vector<RtpContributingSource*> contributing_sources_;
98 RtpContributingSource
99 contributing_sources_buffer_[kContributingSourcesBufferSize];
100 // The contribuing source that uses the |ssrc_|.
101 std::unique_ptr<RtpContributingSource> ssrc_source_;
102
103 size_t current_buffer_index_;
104 size_t current_buffer_size_;
87 }; 105 };
88 } // namespace webrtc 106 } // namespace webrtc
89 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ 107 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698