blob: fd7075178b49c5f6b4369e29f0fcce3263a5b5c0 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
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
11#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
12#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_
13
14#include <list>
phoglund@webrtc.org93763462013-01-16 10:27:33 +000015#include <vector>
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000016
phoglund@webrtc.org93763462013-01-16 10:27:33 +000017#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
18#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
19#include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
phoglund@webrtc.org93763462013-01-16 10:27:33 +000020#include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
21#include "webrtc/system_wrappers/interface/scoped_ptr.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000022
23#ifdef MATLAB
24class MatlabPlot;
25#endif
26
27namespace webrtc {
28
29class ModuleRtpRtcpImpl : public RtpRtcp {
30 public:
phoglund@webrtc.org93763462013-01-16 10:27:33 +000031 explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000032
phoglund@webrtc.org93763462013-01-16 10:27:33 +000033 virtual ~ModuleRtpRtcpImpl();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000034
phoglund@webrtc.org93763462013-01-16 10:27:33 +000035 // Returns the number of milliseconds until the module want a worker thread to
36 // call Process.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000037 virtual int32_t TimeUntilNextProcess();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000038
phoglund@webrtc.org93763462013-01-16 10:27:33 +000039 // Process any pending tasks such as timeouts.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000040 virtual int32_t Process();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000041
phoglund@webrtc.org93763462013-01-16 10:27:33 +000042 // Receiver part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000043
stefan@webrtc.org6696fba2013-05-29 12:12:51 +000044 // Called when we receive an RTCP packet.
45 virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet,
46 uint16_t incoming_packet_length);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000047
stefan@webrtc.orga32d18f2013-07-05 14:30:48 +000048 virtual void SetRemoteSSRC(const uint32_t ssrc);
49
phoglund@webrtc.org93763462013-01-16 10:27:33 +000050 // Sender part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000051
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000052 virtual int32_t RegisterSendPayload(const CodecInst& voice_codec);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000053
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000054 virtual int32_t RegisterSendPayload(const VideoCodec& video_codec);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000055
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000056 virtual int32_t DeRegisterSendPayload(const int8_t payload_type);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000057
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000058 virtual int8_t SendPayloadType() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000059
phoglund@webrtc.org93763462013-01-16 10:27:33 +000060 // Register RTP header extension.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000061 virtual int32_t RegisterSendRtpHeaderExtension(
phoglund@webrtc.org93763462013-01-16 10:27:33 +000062 const RTPExtensionType type,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000063 const uint8_t id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000064
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000065 virtual int32_t DeregisterSendRtpHeaderExtension(
phoglund@webrtc.org93763462013-01-16 10:27:33 +000066 const RTPExtensionType type);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000067
phoglund@webrtc.org93763462013-01-16 10:27:33 +000068 // Get start timestamp.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000069 virtual uint32_t StartTimestamp() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000070
phoglund@webrtc.org93763462013-01-16 10:27:33 +000071 // Configure start timestamp, default is a random number.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000072 virtual int32_t SetStartTimestamp(const uint32_t timestamp);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000073
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000074 virtual uint16_t SequenceNumber() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000075
phoglund@webrtc.org93763462013-01-16 10:27:33 +000076 // Set SequenceNumber, default is a random number.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000077 virtual int32_t SetSequenceNumber(const uint16_t seq);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000078
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000079 virtual uint32_t SSRC() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000080
phoglund@webrtc.org93763462013-01-16 10:27:33 +000081 // Configure SSRC, default is a random number.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000082 virtual int32_t SetSSRC(const uint32_t ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000083
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000084 virtual int32_t CSRCs(uint32_t arr_of_csrc[kRtpCsrcSize]) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000085
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000086 virtual int32_t SetCSRCs(const uint32_t arr_of_csrc[kRtpCsrcSize],
87 const uint8_t arr_length);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000088
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000089 virtual int32_t SetCSRCStatus(const bool include);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000090
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000091 virtual uint32_t PacketCountSent() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000092
phoglund@webrtc.org93763462013-01-16 10:27:33 +000093 virtual int CurrentSendFrequencyHz() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000094
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000095 virtual uint32_t ByteCountSent() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000096
pbos@webrtc.orgb57da652013-04-08 11:08:41 +000097 virtual int32_t SetRTXSendStatus(const RtxMode mode,
98 const bool set_ssrc,
99 const uint32_t ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000100
mflodman@webrtc.org7bc7e022013-04-12 14:55:46 +0000101 virtual int32_t RTXSendStatus(RtxMode* mode, uint32_t* ssrc,
102 int* payloadType) const;
103
104
105 virtual void SetRtxSendPayloadType(int payload_type);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000106
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000107 // Sends kRtcpByeCode when going from true to false.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000108 virtual int32_t SetSendingStatus(const bool sending);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000109
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000110 virtual bool Sending() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000111
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000112 // Drops or relays media packets.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000113 virtual int32_t SetSendingMediaStatus(const bool sending);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000114
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000115 virtual bool SendingMedia() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000116
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000117 // Used by the codec module to deliver a video or audio frame for
118 // packetization.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000119 virtual int32_t SendOutgoingData(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000120 const FrameType frame_type,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000121 const int8_t payload_type,
122 const uint32_t time_stamp,
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000123 int64_t capture_time_ms,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000124 const uint8_t* payload_data,
125 const uint32_t payload_size,
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000126 const RTPFragmentationHeader* fragmentation = NULL,
127 const RTPVideoHeader* rtp_video_hdr = NULL);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000128
hclam@chromium.org0f6f7cb2013-06-20 20:18:31 +0000129 virtual bool TimeToSendPacket(uint32_t ssrc, uint16_t sequence_number,
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000130 int64_t capture_time_ms);
stefan@webrtc.org69f76052013-06-17 12:53:37 +0000131 // Returns the number of padding bytes actually sent, which can be more or
132 // less than |bytes|.
133 virtual int TimeToSendPadding(int bytes);
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000134 // RTCP part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000135
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000136 // Get RTCP status.
137 virtual RTCPMethod RTCP() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000138
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000139 // Configure RTCP status i.e on/off.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000140 virtual int32_t SetRTCPStatus(const RTCPMethod method);
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000141
142 // Set RTCP CName.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000143 virtual int32_t SetCNAME(const char c_name[RTCP_CNAME_SIZE]);
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000144
145 // Get RTCP CName.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000146 virtual int32_t CNAME(char c_name[RTCP_CNAME_SIZE]);
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000147
148 // Get remote CName.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000149 virtual int32_t RemoteCNAME(const uint32_t remote_ssrc,
150 char c_name[RTCP_CNAME_SIZE]) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000151
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000152 // Get remote NTP.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000153 virtual int32_t RemoteNTP(uint32_t* received_ntp_secs,
154 uint32_t* received_ntp_frac,
155 uint32_t* rtcp_arrival_time_secs,
156 uint32_t* rtcp_arrival_time_frac,
157 uint32_t* rtcp_timestamp) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000158
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000159 virtual int32_t AddMixedCNAME(const uint32_t ssrc,
160 const char c_name[RTCP_CNAME_SIZE]);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000161
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000162 virtual int32_t RemoveMixedCNAME(const uint32_t ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000163
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000164 // Get RoundTripTime.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000165 virtual int32_t RTT(const uint32_t remote_ssrc,
166 uint16_t* rtt,
167 uint16_t* avg_rtt,
168 uint16_t* min_rtt,
169 uint16_t* max_rtt) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000170
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000171 // Reset RoundTripTime statistics.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000172 virtual int32_t ResetRTT(const uint32_t remote_ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000173
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000174 virtual void SetRtt(uint32_t rtt);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000175
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000176 // Force a send of an RTCP packet.
177 // Normal SR and RR are triggered via the process function.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000178 virtual int32_t SendRTCP(uint32_t rtcp_packet_type = kRtcpReport);
mflodman@webrtc.org78696d32012-11-26 12:40:15 +0000179
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000180 virtual int32_t ResetSendDataCountersRTP();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000181
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000182 // Statistics of the amount of data sent and received.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000183 virtual int32_t DataCountersRTP(uint32_t* bytes_sent,
stefan@webrtc.orga32d18f2013-07-05 14:30:48 +0000184 uint32_t* packets_sent) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000185
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000186 // Get received RTCP report, sender info.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000187 virtual int32_t RemoteRTCPStat(RTCPSenderInfo* sender_info);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000188
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000189 // Get received RTCP report, report block.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000190 virtual int32_t RemoteRTCPStat(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000191 std::vector<RTCPReportBlock>* receive_blocks) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000192
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000193 // Set received RTCP report block.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000194 virtual int32_t AddRTCPReportBlock(
195 const uint32_t ssrc, const RTCPReportBlock* receive_block);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000196
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000197 virtual int32_t RemoveRTCPReportBlock(const uint32_t ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000198
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000199 // (REMB) Receiver Estimated Max Bitrate.
200 virtual bool REMB() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000201
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000202 virtual int32_t SetREMBStatus(const bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000203
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000204 virtual int32_t SetREMBData(const uint32_t bitrate,
205 const uint8_t number_of_ssrc,
206 const uint32_t* ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000207
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000208 // (IJ) Extended jitter report.
209 virtual bool IJ() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000210
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000211 virtual int32_t SetIJStatus(const bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000212
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000213 // (TMMBR) Temporary Max Media Bit Rate.
214 virtual bool TMMBR() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000215
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000216 virtual int32_t SetTMMBRStatus(const bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000217
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000218 int32_t SetTMMBN(const TMMBRSet* bounding_set);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000219
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000220 virtual uint16_t MaxPayloadLength() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000221
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000222 virtual uint16_t MaxDataPayloadLength() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000223
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000224 virtual int32_t SetMaxTransferUnit(const uint16_t size);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000225
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000226 virtual int32_t SetTransportOverhead(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000227 const bool tcp,
228 const bool ipv6,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000229 const uint8_t authentication_overhead = 0);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000230
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000231 // (NACK) Negative acknowledgment part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000232
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000233 virtual int SelectiveRetransmissions() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000234
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000235 virtual int SetSelectiveRetransmissions(uint8_t settings);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000236
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000237 // Send a Negative acknowledgment packet.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000238 virtual int32_t SendNACK(const uint16_t* nack_list, const uint16_t size);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000239
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000240 // Store the sent packets, needed to answer to a negative acknowledgment
241 // requests.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000242 virtual int32_t SetStorePacketsStatus(
243 const bool enable, const uint16_t number_to_store);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000244
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000245 // (APP) Application specific data.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000246 virtual int32_t SetRTCPApplicationSpecificData(
247 const uint8_t sub_type,
248 const uint32_t name,
249 const uint8_t* data,
250 const uint16_t length);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000251
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000252 // (XR) VOIP metric.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000253 virtual int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000254
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000255 // Audio part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000256
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000257 // Set audio packet size, used to determine when it's time to send a DTMF
258 // packet in silence (CNG).
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000259 virtual int32_t SetAudioPacketSize(
260 const uint16_t packet_size_samples);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000261
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000262 virtual bool SendTelephoneEventActive(int8_t& telephone_event) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000263
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000264 // Send a TelephoneEvent tone using RFC 2833 (4733).
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000265 virtual int32_t SendTelephoneEventOutband(const uint8_t key,
266 const uint16_t time_ms,
267 const uint8_t level);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000268
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000269 // Set payload type for Redundant Audio Data RFC 2198.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000270 virtual int32_t SetSendREDPayloadType(const int8_t payload_type);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000271
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000272 // Get payload type for Redundant Audio Data RFC 2198.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000273 virtual int32_t SendREDPayloadType(int8_t& payload_type) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000274
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000275 // Set status and id for header-extension-for-audio-level-indication.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000276 virtual int32_t SetRTPAudioLevelIndicationStatus(
277 const bool enable, const uint8_t id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000278
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000279 // Get status and id for header-extension-for-audio-level-indication.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000280 virtual int32_t GetRTPAudioLevelIndicationStatus(
281 bool& enable, uint8_t& id) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000282
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000283 // Store the audio level in d_bov for header-extension-for-audio-level-
284 // indication.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000285 virtual int32_t SetAudioLevel(const uint8_t level_d_bov);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000286
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000287 // Video part.
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000288
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000289 virtual RtpVideoCodecTypes SendVideoCodec() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000290
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000291 virtual int32_t SendRTCPSliceLossIndication(
292 const uint8_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000293
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000294 // Set method for requestion a new key frame.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000295 virtual int32_t SetKeyFrameRequestMethod(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000296 const KeyFrameRequestMethod method);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000297
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000298 // Send a request for a keyframe.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000299 virtual int32_t RequestKeyFrame();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000300
stefan@webrtc.org73ebe672013-04-09 14:56:29 +0000301 virtual int32_t SetCameraDelay(const int32_t delay_ms);
302
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000303 virtual void SetTargetSendBitrate(const uint32_t bitrate);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000304
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000305 virtual int32_t SetGenericFECStatus(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000306 const bool enable,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000307 const uint8_t payload_type_red,
308 const uint8_t payload_type_fec);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000309
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000310 virtual int32_t GenericFECStatus(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000311 bool& enable,
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000312 uint8_t& payload_type_red,
313 uint8_t& payload_type_fec);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000314
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000315 virtual int32_t SetFecParameters(
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000316 const FecProtectionParams* delta_params,
317 const FecProtectionParams* key_params);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000318
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000319 virtual int32_t LastReceivedNTP(uint32_t& NTPsecs,
320 uint32_t& NTPfrac,
321 uint32_t& remote_sr);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000322
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000323 virtual int32_t BoundingSet(bool& tmmbr_owner, TMMBRSet*& bounding_set_rec);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000324
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000325 virtual void BitrateSent(uint32_t* total_rate,
326 uint32_t* video_rate,
327 uint32_t* fec_rate,
328 uint32_t* nackRate) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000329
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000330 virtual uint32_t SendTimeOfSendReport(const uint32_t send_report);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000331
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000332 // Good state of RTP receiver inform sender.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000333 virtual int32_t SendRTCPReferencePictureSelection(
334 const uint64_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000335
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000336 void OnReceivedTMMBR();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000337
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000338 // Bad state of RTP receiver request a keyframe.
339 void OnRequestIntraFrame();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000340
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000341 // Received a request for a new SLI.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000342 void OnReceivedSliceLossIndication(const uint8_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000343
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000344 // Received a new reference frame.
345 void OnReceivedReferencePictureSelectionIndication(
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000346 const uint64_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000347
stefan@webrtc.org7fff32c2013-02-01 15:09:57 +0000348 void OnReceivedNACK(const std::list<uint16_t>& nack_sequence_numbers);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000349
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000350 void OnRequestSendReport();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000351
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000352 protected:
353 void RegisterChildModule(RtpRtcp* module);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000354
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000355 void DeRegisterChildModule(RtpRtcp* module);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000356
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000357 bool UpdateRTCPReceiveInformationTimers();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000358
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000359 uint32_t BitrateReceivedNow() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000360
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000361 // Get remote SequenceNumber.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000362 uint16_t RemoteSequenceNumber() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000363
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000364 // Only for internal testing.
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000365 uint32_t LastSendReport(uint32_t& last_rtcptime);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000366
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000367 RTPSender rtp_sender_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000368
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000369 RTCPSender rtcp_sender_;
370 RTCPReceiver rtcp_receiver_;
mflodman@webrtc.org8e9767d2013-01-09 13:54:43 +0000371
stefan@webrtc.org1bb21462013-01-21 07:42:11 +0000372 Clock* clock_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000373
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000374 private:
375 int64_t RtcpReportInterval();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000376
elham@webrtc.orgb89eed32013-07-15 21:08:27 +0000377 ReceiveStatistics* receive_statistics_;
378
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000379 int32_t id_;
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000380 const bool audio_;
381 bool collision_detected_;
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000382 int64_t last_process_time_;
383 int64_t last_bitrate_process_time_;
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000384 int64_t last_rtt_process_time_;
385 uint16_t packet_overhead_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000386
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000387 scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_;
388 scoped_ptr<CriticalSectionWrapper> critical_section_module_ptrs_feedback_;
389 ModuleRtpRtcpImpl* default_module_;
390 std::list<ModuleRtpRtcpImpl*> child_modules_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000391
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000392 // Send side
393 NACKMethod nack_method_;
pbos@webrtc.orgb57da652013-04-08 11:08:41 +0000394 uint32_t nack_last_time_sent_full_;
395 uint16_t nack_last_seq_number_sent_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000396
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000397 bool simulcast_;
398 VideoCodec send_video_codec_;
399 KeyFrameRequestMethod key_frame_req_method_;
400
401 RemoteBitrateEstimator* remote_bitrate_;
402
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000403#ifdef MATLAB
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000404 MatlabPlot* plot1_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000405#endif
phoglund@webrtc.org7b1b2582013-01-25 10:53:38 +0000406
407 RtcpRttObserver* rtt_observer_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000408};
phoglund@webrtc.org93763462013-01-16 10:27:33 +0000409
410} // namespace webrtc
411
412#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_RTCP_IMPL_H_