mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00

Bug: webrtc:7135 Change-Id: I7ce9afe575241542e4e3f7e2e8459ee3257eec76 Reviewed-on: https://webrtc-review.googlesource.com/93466 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24271}
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef MODULES_RTP_RTCP_SOURCE_CONTRIBUTING_SOURCES_H_
|
|
#define MODULES_RTP_RTCP_SOURCE_CONTRIBUTING_SOURCES_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
#include "absl/types/optional.h"
|
|
#include "api/array_view.h"
|
|
#include "api/rtpreceiverinterface.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class ContributingSources {
|
|
public:
|
|
ContributingSources();
|
|
~ContributingSources();
|
|
|
|
// TODO(bugs.webrtc.org/3333): Needs to be extended with audio-level, to
|
|
// support RFC6465.
|
|
void Update(int64_t now_ms, rtc::ArrayView<const uint32_t> csrcs);
|
|
|
|
// Returns contributing sources seen the last 10 s.
|
|
std::vector<RtpSource> GetSources(int64_t now_ms) const;
|
|
|
|
private:
|
|
void DeleteOldEntries(int64_t now_ms);
|
|
|
|
// Indexed by csrc.
|
|
std::map<uint32_t, int64_t> last_seen_ms_;
|
|
absl::optional<int64_t> next_pruning_ms_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_RTP_RTCP_SOURCE_CONTRIBUTING_SOURCES_H_
|