blob: 29832dbd6d96e686638c27e32589ac94dcf6b166 [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
Tommi28e96532021-06-03 09:52:1513#include <functional>
Niels Möllerfa89d842019-01-30 15:33:4514#include <vector>
15
Danil Chapovalovb57178b2024-05-02 14:48:1616#include "api/environment/environment.h"
Tommi28e96532021-06-03 09:52:1517#include "api/sequence_checker.h"
18#include "api/units/time_delta.h"
19#include "api/units/timestamp.h"
Elad Alonb6ef99b2019-04-10 14:37:0720#include "call/rtp_video_sender_interface.h"
Niels Möllerfa89d842019-01-30 15:33:4521#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
Tommi28e96532021-06-03 09:52:1522#include "rtc_base/system/no_unique_address.h"
Jonas Oreland6c2dae22022-09-29 08:28:2423#include "video/video_stream_encoder_interface.h"
Niels Möllerfa89d842019-01-30 15:33:4524
25namespace webrtc {
26
27class VideoStreamEncoderInterface;
28
Elad Alon14d1c9d2019-04-08 12:16:1729// This class passes feedback (such as key frame requests or loss notifications)
Bjorn A Mellem7a9a0922019-11-26 17:19:4030// from the RtpRtcp module.
Elad Alon14d1c9d2019-04-08 12:16:1731class EncoderRtcpFeedback : public RtcpIntraFrameObserver,
Bjorn A Mellem7a9a0922019-11-26 17:19:4032 public RtcpLossNotificationObserver {
Niels Möllerfa89d842019-01-30 15:33:4533 public:
Tommi28e96532021-06-03 09:52:1534 EncoderRtcpFeedback(
Danil Chapovalovb57178b2024-05-02 14:48:1635 const Environment& env,
Philipp Hancke7c5f9cf2024-02-20 14:28:1436 bool per_layer_keyframes,
Tommi28e96532021-06-03 09:52:1537 const std::vector<uint32_t>& ssrcs,
38 VideoStreamEncoderInterface* encoder,
39 std::function<std::vector<RtpSequenceNumberMap::Info>(
40 uint32_t ssrc,
41 const std::vector<uint16_t>& seq_nums)> get_packet_infos);
Elad Alon0a8562e2019-04-09 09:55:1342 ~EncoderRtcpFeedback() override = default;
43
Niels Möllerfa89d842019-01-30 15:33:4544 void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
45
Elad Alon0a8562e2019-04-09 09:55:1346 // Implements RtcpLossNotificationObserver.
47 void OnReceivedLossNotification(uint32_t ssrc,
48 uint16_t seq_num_of_last_decodable,
49 uint16_t seq_num_of_last_received,
50 bool decodability_flag) override;
51
Niels Möllerfa89d842019-01-30 15:33:4552 private:
Danil Chapovalovb57178b2024-05-02 14:48:1653 const Environment env_;
Niels Möllerfa89d842019-01-30 15:33:4554 const std::vector<uint32_t> ssrcs_;
Philipp Hancke7c5f9cf2024-02-20 14:28:1455 const bool per_layer_keyframes_;
Tommi28e96532021-06-03 09:52:1556 const std::function<std::vector<RtpSequenceNumberMap::Info>(
57 uint32_t ssrc,
58 const std::vector<uint16_t>& seq_nums)>
59 get_packet_infos_;
Niels Möllerfa89d842019-01-30 15:33:4560 VideoStreamEncoderInterface* const video_stream_encoder_;
61
Tommi28e96532021-06-03 09:52:1562 RTC_NO_UNIQUE_ADDRESS SequenceChecker packet_delivery_queue_;
Philipp Hancke7c5f9cf2024-02-20 14:28:1463 std::vector<Timestamp> time_last_packet_delivery_queue_
Tommi28e96532021-06-03 09:52:1564 RTC_GUARDED_BY(packet_delivery_queue_);
Rasmus Brandt3dde4502019-03-21 10:46:1765
Tommi28e96532021-06-03 09:52:1566 const TimeDelta min_keyframe_send_interval_;
Niels Möllerfa89d842019-01-30 15:33:4567};
68
69} // namespace webrtc
70
Elad Alon14d1c9d2019-04-08 12:16:1771#endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_