Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 1 | /* |
| 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 Alon | 14d1c9d | 2019-04-08 12:16:17 | [diff] [blame] | 10 | #ifndef VIDEO_ENCODER_RTCP_FEEDBACK_H_ |
| 11 | #define VIDEO_ENCODER_RTCP_FEEDBACK_H_ |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 12 | |
| 13 | #include <vector> |
| 14 | |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 15 | #include "api/video/video_stream_encoder_interface.h" |
Elad Alon | b6ef99b | 2019-04-10 14:37:07 | [diff] [blame] | 16 | #include "call/rtp_video_sender_interface.h" |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 17 | #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
Markus Handell | a376518 | 2020-07-08 11:13:32 | [diff] [blame] | 18 | #include "rtc_base/synchronization/mutex.h" |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 19 | #include "system_wrappers/include/clock.h" |
| 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | class VideoStreamEncoderInterface; |
| 24 | |
Elad Alon | 14d1c9d | 2019-04-08 12:16:17 | [diff] [blame] | 25 | // This class passes feedback (such as key frame requests or loss notifications) |
Bjorn A Mellem | 7a9a092 | 2019-11-26 17:19:40 | [diff] [blame] | 26 | // from the RtpRtcp module. |
Elad Alon | 14d1c9d | 2019-04-08 12:16:17 | [diff] [blame] | 27 | class EncoderRtcpFeedback : public RtcpIntraFrameObserver, |
Bjorn A Mellem | 7a9a092 | 2019-11-26 17:19:40 | [diff] [blame] | 28 | public RtcpLossNotificationObserver { |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 29 | public: |
Elad Alon | 14d1c9d | 2019-04-08 12:16:17 | [diff] [blame] | 30 | EncoderRtcpFeedback(Clock* clock, |
| 31 | const std::vector<uint32_t>& ssrcs, |
| 32 | VideoStreamEncoderInterface* encoder); |
Elad Alon | 0a8562e | 2019-04-09 09:55:13 | [diff] [blame] | 33 | ~EncoderRtcpFeedback() override = default; |
| 34 | |
Elad Alon | b6ef99b | 2019-04-10 14:37:07 | [diff] [blame] | 35 | void SetRtpVideoSender(const RtpVideoSenderInterface* rtp_video_sender); |
| 36 | |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 37 | void OnReceivedIntraFrameRequest(uint32_t ssrc) override; |
| 38 | |
Elad Alon | 0a8562e | 2019-04-09 09:55:13 | [diff] [blame] | 39 | // 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öller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 45 | private: |
| 46 | bool HasSsrc(uint32_t ssrc); |
| 47 | |
| 48 | Clock* const clock_; |
| 49 | const std::vector<uint32_t> ssrcs_; |
Elad Alon | b6ef99b | 2019-04-10 14:37:07 | [diff] [blame] | 50 | const RtpVideoSenderInterface* rtp_video_sender_; |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 51 | VideoStreamEncoderInterface* const video_stream_encoder_; |
| 52 | |
Markus Handell | a376518 | 2020-07-08 11:13:32 | [diff] [blame] | 53 | Mutex mutex_; |
| 54 | int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(mutex_); |
Rasmus Brandt | 3dde450 | 2019-03-21 10:46:17 | [diff] [blame] | 55 | |
| 56 | const int min_keyframe_send_interval_ms_; |
Niels Möller | fa89d84 | 2019-01-30 15:33:45 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | } // namespace webrtc |
| 60 | |
Elad Alon | 14d1c9d | 2019-04-08 12:16:17 | [diff] [blame] | 61 | #endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_ |