1 /* 2 * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 #ifndef MODULES_CONGESTION_CONTROLLER_RTP_TRANSPORT_FEEDBACK_DEMUXER_H_ 11 #define MODULES_CONGESTION_CONTROLLER_RTP_TRANSPORT_FEEDBACK_DEMUXER_H_ 12 13 #include <map> 14 #include <utility> 15 #include <vector> 16 17 #include "modules/include/module_common_types_public.h" 18 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" 19 #include "rtc_base/synchronization/mutex.h" 20 21 namespace webrtc { 22 23 class TransportFeedbackDemuxer : public StreamFeedbackProvider { 24 public: 25 // Implements StreamFeedbackProvider interface 26 void RegisterStreamFeedbackObserver( 27 std::vector<uint32_t> ssrcs, 28 StreamFeedbackObserver* observer) override; 29 void DeRegisterStreamFeedbackObserver( 30 StreamFeedbackObserver* observer) override; 31 void AddPacket(const RtpPacketSendInfo& packet_info); 32 void OnTransportFeedback(const rtcp::TransportFeedback& feedback); 33 34 private: 35 Mutex lock_; 36 SequenceNumberUnwrapper seq_num_unwrapper_ RTC_GUARDED_BY(&lock_); 37 std::map<int64_t, StreamFeedbackObserver::StreamPacketInfo> history_ 38 RTC_GUARDED_BY(&lock_); 39 40 // Maps a set of ssrcs to corresponding observer. Vectors are used rather than 41 // set/map to ensure that the processing order is consistent independently of 42 // the randomized ssrcs. 43 Mutex observers_lock_; 44 std::vector<std::pair<std::vector<uint32_t>, StreamFeedbackObserver*>> 45 observers_ RTC_GUARDED_BY(&observers_lock_); 46 }; 47 } // namespace webrtc 48 49 #endif // MODULES_CONGESTION_CONTROLLER_RTP_TRANSPORT_FEEDBACK_DEMUXER_H_ 50