encoder_rtcp_feedback.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. */
  10. #ifndef VIDEO_ENCODER_RTCP_FEEDBACK_H_
  11. #define VIDEO_ENCODER_RTCP_FEEDBACK_H_
  12. #include <vector>
  13. #include "api/video/video_stream_encoder_interface.h"
  14. #include "call/rtp_video_sender_interface.h"
  15. #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
  16. #include "rtc_base/synchronization/mutex.h"
  17. #include "system_wrappers/include/clock.h"
  18. namespace webrtc {
  19. class VideoStreamEncoderInterface;
  20. // This class passes feedback (such as key frame requests or loss notifications)
  21. // from the RtpRtcp module.
  22. class EncoderRtcpFeedback : public RtcpIntraFrameObserver,
  23. public RtcpLossNotificationObserver {
  24. public:
  25. EncoderRtcpFeedback(Clock* clock,
  26. const std::vector<uint32_t>& ssrcs,
  27. VideoStreamEncoderInterface* encoder);
  28. ~EncoderRtcpFeedback() override = default;
  29. void SetRtpVideoSender(const RtpVideoSenderInterface* rtp_video_sender);
  30. void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
  31. // Implements RtcpLossNotificationObserver.
  32. void OnReceivedLossNotification(uint32_t ssrc,
  33. uint16_t seq_num_of_last_decodable,
  34. uint16_t seq_num_of_last_received,
  35. bool decodability_flag) override;
  36. private:
  37. bool HasSsrc(uint32_t ssrc);
  38. Clock* const clock_;
  39. const std::vector<uint32_t> ssrcs_;
  40. const RtpVideoSenderInterface* rtp_video_sender_;
  41. VideoStreamEncoderInterface* const video_stream_encoder_;
  42. Mutex mutex_;
  43. int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(mutex_);
  44. const int min_keyframe_send_interval_ms_;
  45. };
  46. } // namespace webrtc
  47. #endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_