blob: 0e5b13b3e8c3f26d459d9a8fb4a6320c875b21e3 [file] [log] [blame]
mflodman@webrtc.org3be58632012-09-06 08:19:40 +00001/*
2 * Copyright (c) 2012 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 */
mflodman15d83572016-10-06 08:35:11 -070010#ifndef WEBRTC_VIDEO_ENCODER_RTCP_FEEDBACK_H_
11#define WEBRTC_VIDEO_ENCODER_RTCP_FEEDBACK_H_
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000012
Peter Boström5cb9ce42015-05-05 15:16:30 +020013#include <vector>
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000014
Peter Boström45c44f02016-02-19 17:36:01 +010015#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020016#include "webrtc/rtc_base/criticalsection.h"
perkj600246e2016-05-04 11:26:51 -070017#include "webrtc/system_wrappers/include/clock.h"
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000018#include "webrtc/typedefs.h"
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000019
20namespace webrtc {
21
mflodmancc3d4422017-08-03 08:27:51 -070022class VideoStreamEncoder;
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000023
mflodman15d83572016-10-06 08:35:11 -070024class EncoderRtcpFeedback : public RtcpIntraFrameObserver {
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000025 public:
mflodman15d83572016-10-06 08:35:11 -070026 EncoderRtcpFeedback(Clock* clock,
perkj600246e2016-05-04 11:26:51 -070027 const std::vector<uint32_t>& ssrcs,
mflodmancc3d4422017-08-03 08:27:51 -070028 VideoStreamEncoder* encoder);
Peter Boström45c44f02016-02-19 17:36:01 +010029 void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000030
31 private:
perkj600246e2016-05-04 11:26:51 -070032 bool HasSsrc(uint32_t ssrc);
33 size_t GetStreamIndex(uint32_t ssrc);
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000034
perkj600246e2016-05-04 11:26:51 -070035 Clock* const clock_;
36 const std::vector<uint32_t> ssrcs_;
mflodmancc3d4422017-08-03 08:27:51 -070037 VideoStreamEncoder* const video_stream_encoder_;
perkj600246e2016-05-04 11:26:51 -070038
39 rtc::CriticalSection crit_;
danilchapa37de392017-09-09 04:17:22 -070040 std::vector<int64_t> time_last_intra_request_ms_ RTC_GUARDED_BY(crit_);
mflodman@webrtc.org3be58632012-09-06 08:19:40 +000041};
42
43} // namespace webrtc
44
mflodman15d83572016-10-06 08:35:11 -070045#endif // WEBRTC_VIDEO_ENCODER_RTCP_FEEDBACK_H_