 Chromium Code Reviews
 Chromium Code Reviews Issue 2770233003:
  Implemented the GetSources() in native code.  (Closed)
    
  
    Issue 2770233003:
  Implemented the GetSources() in native code.  (Closed) 
  | Index: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h | 
| diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h | 
| index 4b5524877c77206c58eb8db145ba0f88202b75c9..2ff7efa75e179b83978b8c3aaf1ac1a85d24bf96 100644 | 
| --- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h | 
| +++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h | 
| @@ -11,7 +11,10 @@ | 
| #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ | 
| #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ | 
| +#include <list> | 
| #include <memory> | 
| +#include <unordered_map> | 
| +#include <vector> | 
| #include "webrtc/base/criticalsection.h" | 
| #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 
| @@ -56,6 +59,12 @@ class RtpReceiverImpl : public RtpReceiver { | 
| TelephoneEventHandler* GetTelephoneEventHandler() override; | 
| + std::vector<RtpSource> GetSources() const override; | 
| + | 
| + const std::vector<RtpSource>& ssrc_sources() { return ssrc_sources_; } | 
| 
the sun
2017/04/06 06:55:38
Is this for testing? Mark that with a comment, or
 
hbos
2017/04/06 08:17:16
+1. These should be for_testing because they expos
 
Zhi Huang
2017/04/06 22:30:25
Done.
 | 
| + | 
| + const std::list<RtpSource>& csrc_sources() { return csrc_sources_; } | 
| + | 
| private: | 
| bool HaveReceivedFrame() const; | 
| @@ -66,6 +75,9 @@ class RtpReceiverImpl : public RtpReceiver { | 
| bool* is_red, | 
| PayloadUnion* payload); | 
| + void UpdateSources(); | 
| + void RemoveOutdatedSources(int64_t now); | 
| + | 
| Clock* clock_; | 
| RTPPayloadRegistry* rtp_payload_registry_; | 
| std::unique_ptr<RTPReceiverStrategy> rtp_media_receiver_; | 
| @@ -84,6 +96,12 @@ class RtpReceiverImpl : public RtpReceiver { | 
| uint32_t last_received_timestamp_; | 
| int64_t last_received_frame_time_ms_; | 
| uint16_t last_received_sequence_number_; | 
| + | 
| + std::unordered_map<uint32_t, std::list<RtpSource>::iterator> | 
| + iterator_by_csrc_; | 
| + // The RtpSource objects are sorted chronologically. | 
| + std::list<RtpSource> csrc_sources_; | 
| 
philipel
2017/04/06 14:33:34
I think an std::deque might be better in this case
 
Zhi Huang
2017/04/06 22:30:25
For csrc_sources, we need to use the std::list::sp
 
philipel
2017/04/07 08:44:07
I was thinking instead of splicing, just push_fron
 | 
| + std::vector<RtpSource> ssrc_sources_; | 
| }; | 
| } // namespace webrtc | 
| #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RECEIVER_IMPL_H_ |