Add Incoming packet handler to RtcpTransceiver

Bug: webrtc:8239
Change-Id: Iebe1b6a2649f01e4f6e3780ac96cb05611d8671c
Reviewed-on: https://webrtc-review.googlesource.com/17560
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20624}
This commit is contained in:
Danil Chapovalov
2017-11-09 15:42:28 +01:00
committed by Commit Bot
parent 7501b1c3d1
commit d2f37d85bd
4 changed files with 184 additions and 14 deletions

View File

@ -11,13 +11,18 @@
#ifndef MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_IMPL_H_
#define MODULES_RTP_RTCP_SOURCE_RTCP_TRANSCEIVER_IMPL_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/source/rtcp_transceiver_config.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/weak_ptr.h"
#include "system_wrappers/include/ntp_time.h"
namespace webrtc {
//
@ -29,16 +34,29 @@ class RtcpTransceiverImpl {
explicit RtcpTransceiverImpl(const RtcpTransceiverConfig& config);
~RtcpTransceiverImpl();
// Handles incoming rtcp packets.
void ReceivePacket(rtc::ArrayView<const uint8_t> packet);
// Sends RTCP packets starting with a sender or receiver report.
void SendCompoundPacket();
private:
struct SenderReportTimes {
int64_t local_received_time_us;
NtpTime remote_sent_time;
};
void HandleReceivedPacket(const rtcp::CommonHeader& rtcp_packet_header);
void ReschedulePeriodicCompoundPackets(int64_t delay_ms);
// Sends RTCP packets.
void SendPacket();
// Generate Report Blocks to be send in Sender or Receiver Report.
std::vector<rtcp::ReportBlock> CreateReportBlocks();
const RtcpTransceiverConfig config_;
std::map<uint32_t, SenderReportTimes> last_received_sender_reports_;
rtc::WeakPtrFactory<RtcpTransceiverImpl> ptr_factory_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcpTransceiverImpl);