You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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/transport/media/media_transport_interface.h"
  14. #include "api/video/video_stream_encoder_interface.h"
  15. #include "call/rtp_video_sender_interface.h"
  16. #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
  17. #include "rtc_base/critical_section.h"
  18. #include "system_wrappers/include/clock.h"
  19. namespace webrtc {
  20. class VideoStreamEncoderInterface;
  21. // This class passes feedback (such as key frame requests or loss notifications)
  22. // from either Mediatransport or the RtpRtcp module.
  23. // TODO(bugs.webrtc.org/9719): Should be eliminated when RtpMediaTransport is
  24. // implemented.
  25. class EncoderRtcpFeedback : public RtcpIntraFrameObserver,
  26. public RtcpLossNotificationObserver,
  27. public MediaTransportKeyFrameRequestCallback {
  28. public:
  29. EncoderRtcpFeedback(Clock* clock,
  30. const std::vector<uint32_t>& ssrcs,
  31. VideoStreamEncoderInterface* encoder);
  32. ~EncoderRtcpFeedback() override = default;
  33. void SetRtpVideoSender(const RtpVideoSenderInterface* rtp_video_sender);
  34. void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
  35. // Implements MediaTransportKeyFrameRequestCallback
  36. void OnKeyFrameRequested(uint64_t channel_id) override;
  37. // Implements RtcpLossNotificationObserver.
  38. void OnReceivedLossNotification(uint32_t ssrc,
  39. uint16_t seq_num_of_last_decodable,
  40. uint16_t seq_num_of_last_received,
  41. bool decodability_flag) override;
  42. private:
  43. bool HasSsrc(uint32_t ssrc);
  44. Clock* const clock_;
  45. const std::vector<uint32_t> ssrcs_;
  46. const RtpVideoSenderInterface* rtp_video_sender_;
  47. VideoStreamEncoderInterface* const video_stream_encoder_;
  48. rtc::CriticalSection crit_;
  49. int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(crit_);
  50. const int min_keyframe_send_interval_ms_;
  51. };
  52. } // namespace webrtc
  53. #endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_