webrtc/modules/rtp_rtcp/source/contributing_sources.h
Yves Gerey 2e00abc98e Reland "[cleanup] Remove useless includes."
Reason for reland: Downstream project fixed.

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}

Bug: webrtc:8311
Change-Id: Id6ec4aeb798886a90ace640a190eaf16497ba31b
Reviewed-on: https://webrtc-review.googlesource.com/c/104120
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25034}
2018-10-08 07:44:19 +00:00

52 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" // For RtpSource
#include "rtc_base/timeutils.h" // For kNumMillisecsPerSec
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_