webrtc/modules/rtp_rtcp/source/contributing_sources.h
Oleh Prypin 96a0f61917 Revert "[cleanup] Remove useless includes."
This reverts commit be8b5348c7.

Reason for revert: Breaks downstream project

Original change's description:
> [cleanup] Remove useless includes.
> 
> Manual cleanup guided by include-what-you-use diagnostic.
> 
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

TBR=phoglund@google.com,phoglund@webrtc.org,yvesg@webrtc.org

Change-Id: I7a6e1cdfef685173b76f234ad598083043dcd9a0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:8311
Reviewed-on: https://webrtc-review.googlesource.com/c/104022
Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25015}
2018-10-05 13:13:45 +00:00

51 lines
1.5 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:
// Set by the spec, see
// https://www.w3.org/TR/webrtc/#dom-rtcrtpreceiver-getcontributingsources
static constexpr int64_t kHistoryMs = 10 * rtc::kNumMillisecsPerSec;
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_