2012-09-06 08:19:40 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
2019-04-08 14:16:17 +02:00
|
|
|
#ifndef VIDEO_ENCODER_RTCP_FEEDBACK_H_
|
|
|
|
|
#define VIDEO_ENCODER_RTCP_FEEDBACK_H_
|
2012-09-06 08:19:40 +00:00
|
|
|
|
2015-05-05 15:16:30 +02:00
|
|
|
#include <vector>
|
2012-09-06 08:19:40 +00:00
|
|
|
|
2019-09-12 13:59:36 +02:00
|
|
|
#include "api/transport/media/media_transport_interface.h"
|
2019-01-30 16:33:45 +01:00
|
|
|
#include "api/video/video_stream_encoder_interface.h"
|
2019-04-10 16:37:07 +02:00
|
|
|
#include "call/rtp_video_sender_interface.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/critical_section.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "system_wrappers/include/clock.h"
|
2012-09-06 08:19:40 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-04-19 17:09:15 +02:00
|
|
|
class VideoStreamEncoderInterface;
|
2012-09-06 08:19:40 +00:00
|
|
|
|
2019-04-08 14:16:17 +02:00
|
|
|
// This class passes feedback (such as key frame requests or loss notifications)
|
|
|
|
|
// from either Mediatransport or the RtpRtcp module.
|
2019-01-30 16:33:45 +01:00
|
|
|
// TODO(bugs.webrtc.org/9719): Should be eliminated when RtpMediaTransport is
|
|
|
|
|
// implemented.
|
2019-04-08 14:16:17 +02:00
|
|
|
class EncoderRtcpFeedback : public RtcpIntraFrameObserver,
|
2019-04-09 11:55:13 +02:00
|
|
|
public RtcpLossNotificationObserver,
|
2019-04-08 14:16:17 +02:00
|
|
|
public MediaTransportKeyFrameRequestCallback {
|
2012-09-06 08:19:40 +00:00
|
|
|
public:
|
2019-04-08 14:16:17 +02:00
|
|
|
EncoderRtcpFeedback(Clock* clock,
|
|
|
|
|
const std::vector<uint32_t>& ssrcs,
|
|
|
|
|
VideoStreamEncoderInterface* encoder);
|
2019-04-09 11:55:13 +02:00
|
|
|
~EncoderRtcpFeedback() override = default;
|
|
|
|
|
|
2019-04-10 16:37:07 +02:00
|
|
|
void SetRtpVideoSender(const RtpVideoSenderInterface* rtp_video_sender);
|
|
|
|
|
|
2016-02-19 17:36:01 +01:00
|
|
|
void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
|
2012-09-06 08:19:40 +00:00
|
|
|
|
2019-01-30 16:33:45 +01:00
|
|
|
// Implements MediaTransportKeyFrameRequestCallback
|
|
|
|
|
void OnKeyFrameRequested(uint64_t channel_id) override;
|
|
|
|
|
|
2019-04-09 11:55:13 +02:00
|
|
|
// Implements RtcpLossNotificationObserver.
|
|
|
|
|
void OnReceivedLossNotification(uint32_t ssrc,
|
|
|
|
|
uint16_t seq_num_of_last_decodable,
|
|
|
|
|
uint16_t seq_num_of_last_received,
|
|
|
|
|
bool decodability_flag) override;
|
|
|
|
|
|
2012-09-06 08:19:40 +00:00
|
|
|
private:
|
2016-05-04 11:26:51 -07:00
|
|
|
bool HasSsrc(uint32_t ssrc);
|
|
|
|
|
|
|
|
|
|
Clock* const clock_;
|
|
|
|
|
const std::vector<uint32_t> ssrcs_;
|
2019-04-10 16:37:07 +02:00
|
|
|
const RtpVideoSenderInterface* rtp_video_sender_;
|
2018-04-19 17:09:15 +02:00
|
|
|
VideoStreamEncoderInterface* const video_stream_encoder_;
|
2012-09-06 08:19:40 +00:00
|
|
|
|
2016-05-04 11:26:51 -07:00
|
|
|
rtc::CriticalSection crit_;
|
2018-09-24 11:44:49 +02:00
|
|
|
int64_t time_last_intra_request_ms_ RTC_GUARDED_BY(crit_);
|
2019-03-21 11:46:17 +01:00
|
|
|
|
|
|
|
|
const int min_keyframe_send_interval_ms_;
|
2012-09-06 08:19:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2019-04-08 14:16:17 +02:00
|
|
|
#endif // VIDEO_ENCODER_RTCP_FEEDBACK_H_
|