blob: 3bd1cb91f02a829800b031a841fa4e8458a97dfa [file] [log] [blame]
Niels Möllerfa89d842019-01-30 15:33:451/*
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 */
Elad Alon14d1c9d2019-04-08 12:16:1710#ifndef VIDEO_ENCODER_RTCP_FEEDBACK_H_
11#define VIDEO_ENCODER_RTCP_FEEDBACK_H_
Niels Möllerfa89d842019-01-30 15:33:4512
13#include <vector>
14
Niels Möllerfa89d842019-01-30 15:33:4515#include "api/video/video_stream_encoder_interface.h"
Elad Alonb6ef99b2019-04-10 14:37:0716#include "call/rtp_video_sender_interface.h"
Niels Möllerfa89d842019-01-30 15:33:4517#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Markus Handella3765182020-07-08 11:13:3218#include "rtc_base/synchronization/mutex.h"
Niels Möllerfa89d842019-01-30 15:33:4519#include "system_wrappers/include/clock.h"
20
21namespace webrtc {
22
23class VideoStreamEncoderInterface;
24
Elad Alon14d1c9d2019-04-08 12:16:1725// This class passes feedback (such as key frame requests or loss notifications)
Bjorn A Mellem7a9a0922019-11-26 17:19:4026// from the RtpRtcp module.
Elad Alon14d1c9d2019-04-08 12:16:1727class EncoderRtcpFeedback : public RtcpIntraFrameObserver,
Bjorn A Mellem7a9a0922019-11-26 17:19:4028 public RtcpLossNotificationObserver {
Niels Möllerfa89d842019-01-30 15:33:4529 public:
Elad Alon14d1c9d2019-04-08 12:16:1730 EncoderRtcpFeedback(Clock* clock,
31 const std::vector<uint32_t>& ssrcs,
32 VideoStreamEncoderInterface* encoder);
Elad Alon0a8562e2019-04-09 09:55:1333 ~EncoderRtcpFeedback() override = default;
34
Elad Alonb6ef99b2019-04-10 14:37:0735 void SetRtpVideoSender(const RtpVideoSenderInterface* rtp_video_sender);
36
Niels Möllerfa89d842019-01-30 15:33:4537 void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
38
Elad Alon0a8562e2019-04-09 09:55:1339 // Implements RtcpLossNotificationObserver.
40 void OnReceivedLossNotification(uint32_t ssrc,
41 uint16_t seq_num_of_last_decodable,
42 uint16_t seq_num_of_last_received,
43 bool decodability_flag) override;
44
Niels Möllerfa89d842019-01-30 15:33:4545 private:
46 bool HasSsrc(uint32_t ssrc);
47
48 Clock* const clock_;
49 const std::vector<uint32_t> ssrcs_;
Elad Alonb6ef99b2019-04-10 14:37:0750 const RtpVideoSenderInterface* rtp_video_sender_;
Niels Möllerfa89d842019-01-30 15:33:4551 VideoStreamEncoderInterface* const video_stream_encoder_;
52
Markus Handella3765182020-07-08 11:13:3253 Mutex mutex_;
54 int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(mutex_);
Rasmus Brandt3dde4502019-03-21 10:46:1755
56 const int min_keyframe_send_interval_ms_;
Niels Möllerfa89d842019-01-30 15:33:4557};
58
59} // namespace webrtc
60
Elad Alon14d1c9d2019-04-08 12:16:1761#endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_