1b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org/*
2b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *
4b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  Use of this source code is governed by a BSD-style license
5b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  that can be found in the LICENSE file in the root of the source
6b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  tree. An additional intellectual property rights grant can be found
7b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  in the file PATENTS.  All contributing project authors may
8b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org */
10b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
11b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This sub-API supports the following functionalities:
12b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Callbacks for RTP and RTCP events such as modified SSRC or CSRC.
13b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - SSRC handling.
14b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Transmission of RTCP reports.
15b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Obtaining RTCP data from incoming RTCP sender reports.
16b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - RTP and RTCP statistics (jitter, packet loss, RTT etc.).
17b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Forward Error Correction (FEC).
18b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Writing RTP and RTCP packets to binary files for off‐line analysis of the
19b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//    call quality.
20b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org//  - Inserting extra RTP packets into active audio stream.
21b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
22b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#ifndef WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_
23b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#define WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_
24b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
2516196644914f7b91ba8029c936ca2cf65e771749mikhal@webrtc.org#include "webrtc/common_types.h"
262fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
27b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
28b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgnamespace webrtc {
29b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
30b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass VideoEngine;
31d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.orgstruct ReceiveBandwidthEstimatorStats;
32b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
33b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This enumerator sets the RTCP mode.
34b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgenum ViERTCPMode {
35b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kRtcpNone = 0,
36b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kRtcpCompound_RFC4585 = 1,
37b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kRtcpNonCompound_RFC5506 = 2
38b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
39b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
40b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This enumerator describes the key frame request mode.
41b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgenum ViEKeyFrameRequestMethod {
42b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEKeyFrameRequestNone = 0,
43b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEKeyFrameRequestPliRtcp = 1,
44b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEKeyFrameRequestFirRtp = 2,
45b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEKeyFrameRequestFirRtcp = 3
46b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
47b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
48b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgenum StreamType {
49b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEStreamTypeNormal = 0,  // Normal media stream
50b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  kViEStreamTypeRtx = 1  // Retransmission media stream
51b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
52b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
53b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This class declares an abstract interface for a user defined observer. It is
54b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// up to the VideoEngine user to implement a derived class which implements the
55b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// observer class. The observer is registered using RegisterRTPObserver() and
56b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// deregistered using DeregisterRTPObserver().
57b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass WEBRTC_DLLEXPORT ViERTPObserver {
58b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org public:
59b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This method is called if SSRC of the incoming stream is changed.
60b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual void IncomingSSRCChanged(const int video_channel,
61b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                   const unsigned int SSRC) = 0;
62b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
63b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This method is called if a field in CSRC changes or if the number of
64b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // CSRCs changes.
65b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual void IncomingCSRCChanged(const int video_channel,
66b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                   const unsigned int CSRC,
67b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                   const bool added) = 0;
68b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org protected:
69b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual ~ViERTPObserver() {}
70b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
71b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
72b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// This class declares an abstract interface for a user defined observer. It is
73b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// up to the VideoEngine user to implement a derived class which implements the
74b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// observer class. The observer is registered using RegisterRTCPObserver() and
75b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org// deregistered using DeregisterRTCPObserver().
76b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
77b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass WEBRTC_DLLEXPORT ViERTCPObserver {
78b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org public:
79b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This method is called if a application-defined RTCP packet has been
80b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // received.
81b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual void OnApplicationDataReceived(
82b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const int video_channel,
83b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const unsigned char sub_type,
84b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const unsigned int name,
85b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const char* data,
86b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const unsigned short data_length_in_bytes) = 0;
87b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org protected:
88b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual ~ViERTCPObserver() {}
89b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
90b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
91b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.orgclass WEBRTC_DLLEXPORT ViERTP_RTCP {
92b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org public:
93b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  enum { KDefaultDeltaTransmitTimeSeconds = 15 };
94b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  enum { KMaxRTCPCNameLength = 256 };
95b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
96b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Factory for the ViERTP_RTCP sub‐API and increases an internal reference
97b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // counter if successful. Returns NULL if the API is not supported or if
98b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // construction fails.
99b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  static ViERTP_RTCP* GetInterface(VideoEngine* video_engine);
100b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
101b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Releases the ViERTP_RTCP sub-API and decreases an internal reference
102b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // counter. Returns the new reference count. This value should be zero
103b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // for all sub-API:s before the VideoEngine object can be safely deleted.
104b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int Release() = 0;
105b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
106b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables you to specify the RTP synchronization source
107b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // identifier (SSRC) explicitly.
108b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetLocalSSRC(const int video_channel,
109b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const unsigned int SSRC,
110b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const StreamType usage = kViEStreamTypeNormal,
111b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const unsigned char simulcast_idx = 0) = 0;
112b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
113b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the SSRC for the outgoing RTP stream for the specified
114b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // channel.
115b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetLocalSSRC(const int video_channel,
116b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           unsigned int& SSRC) const = 0;
117b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
118b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function map a incoming SSRC to a StreamType so that the engine
119b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // can know which is the normal stream and which is the RTX
120b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetRemoteSSRCType(const int video_channel,
121b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                const StreamType usage,
122b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                const unsigned int SSRC) const = 0;
123b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
124b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the SSRC for the incoming RTP stream for the specified
125b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // channel.
126b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRemoteSSRC(const int video_channel,
127b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            unsigned int& SSRC) const = 0;
128b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
129b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function returns the CSRCs of the incoming RTP packets.
130b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRemoteCSRCs(const int video_channel,
131b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                             unsigned int CSRCs[kRtpCsrcSize]) const = 0;
132b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
1337bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org  // This sets a specific payload type for the RTX stream. Note that this
1347bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org  // doesn't enable RTX, SetLocalSSRC must still be called to enable RTX.
1357bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org  virtual int SetRtxSendPayloadType(const int video_channel,
1367bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org                                    const uint8_t payload_type) = 0;
1377bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org
1386845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  // This enables sending redundant payloads when padding up the bitrate instead
1396845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  // of sending dummy padding packets. This feature is off by default and will
1406845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  // only have an effect if RTX is also enabled.
1416845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  // TODO(holmer): Remove default implementation once this has been implemented
1426845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  // in libjingle.
1436845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  virtual int SetPadWithRedundantPayloads(int video_channel, bool enable) {
1446845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org    return 0;
1456845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org  }
1466845de7e4eed28e61c3edb263fb4bbcd65ff76fbstefan@webrtc.org
1477bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org  virtual int SetRtxReceivePayloadType(const int video_channel,
1487bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org                                       const uint8_t payload_type) = 0;
1497bc7e02c4aadc8acb8fdc35a555a0cb33e566b16mflodman@webrtc.org
150b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables manual initialization of the sequence number. The
151b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // start sequence number is normally a random number.
152b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetStartSequenceNumber(const int video_channel,
153b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                     unsigned short sequence_number) = 0;
154b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
1552fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  // TODO(pbos): Remove default implementation once this has been implemented
1562fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  // in libjingle.
1572fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  virtual void SetRtpStateForSsrc(int video_channel,
1582fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org                                  uint32_t ssrc,
1592fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org                                  const RtpState& rtp_state) {}
1602fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  // TODO(pbos): Remove default implementation once this has been implemented
1612fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  // in libjingle.
1622fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  virtual RtpState GetRtpStateForSsrc(int video_channel, uint32_t ssrc) {
1632fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org    return RtpState();
1642fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org  }
1652fd91bd35094b909b4b3cce636454426fc893ac2pbos@webrtc.org
166b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function sets the RTCP status for the specified channel.
167b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Default mode is kRtcpCompound_RFC4585.
168b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetRTCPStatus(const int video_channel,
169b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            const ViERTCPMode rtcp_mode) = 0;
170b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
171b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the RTCP status for the specified channel.
172b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRTCPStatus(const int video_channel,
173b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            ViERTCPMode& rtcp_mode) const = 0;
174b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
175b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function sets the RTCP canonical name (CNAME) for the RTCP reports
176b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // on a specific channel.
177b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetRTCPCName(const int video_channel,
178b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const char rtcp_cname[KMaxRTCPCNameLength]) = 0;
179b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
18009da1a78127b1e5719daaf452f03d2012edad0dcstefan@webrtc.org  // TODO(holmer): Remove this API once it has been removed from
18109da1a78127b1e5719daaf452f03d2012edad0dcstefan@webrtc.org  // fakewebrtcvideoengine.h.
182b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRTCPCName(const int video_channel,
18309da1a78127b1e5719daaf452f03d2012edad0dcstefan@webrtc.org                           char rtcp_cname[KMaxRTCPCNameLength]) const {
18409da1a78127b1e5719daaf452f03d2012edad0dcstefan@webrtc.org    return -1;
18509da1a78127b1e5719daaf452f03d2012edad0dcstefan@webrtc.org  }
186b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
187b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the RTCP canonical name (CNAME) for the RTCP reports
188b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // received on the specified channel.
189b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRemoteRTCPCName(
190b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const int video_channel,
191b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      char rtcp_cname[KMaxRTCPCNameLength]) const = 0;
192b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
193b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function sends an RTCP APP packet on a specific channel.
194b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SendApplicationDefinedRTCPPacket(
195b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const int video_channel,
196b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const unsigned char sub_type,
197b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      unsigned int name,
198b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const char* data,
199b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      unsigned short data_length_in_bytes) = 0;
200b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
201b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables Negative Acknowledgment (NACK) using RTCP,
202b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // implemented based on RFC 4585. NACK retransmits RTP packets if lost on
203b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // the network. This creates a lossless transport at the expense of delay.
204b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // If using NACK, NACK should be enabled on both endpoints in a call.
205b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetNACKStatus(const int video_channel, const bool enable) = 0;
206b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
207b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables Forward Error Correction (FEC) using RTCP,
208b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // implemented based on RFC 5109, to improve packet loss robustness. Extra
209b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // FEC packets are sent together with the usual media packets, hence
210b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // part of the bitrate will be used for FEC packets.
211b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetFECStatus(const int video_channel,
212b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const bool enable,
213b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const unsigned char payload_typeRED,
214b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const unsigned char payload_typeFEC) = 0;
215b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
216b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables hybrid Negative Acknowledgment using RTCP
217b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // and Forward Error Correction (FEC) implemented based on RFC 5109,
218b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // to improve packet loss robustness. Extra
219b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // FEC packets are sent together with the usual media packets, hence will
220b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // part of the bitrate be used for FEC packets.
221b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // The hybrid mode will choose between nack only, fec only and both based on
222b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // network conditions. When both are applied, only packets that were not
223b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // recovered by the FEC will be nacked.
224b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetHybridNACKFECStatus(const int video_channel,
225b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                     const bool enable,
226b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                     const unsigned char payload_typeRED,
227b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                     const unsigned char payload_typeFEC) = 0;
228b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
2299d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org  // Sets send side support for delayed video buffering (actual delay will
23016196644914f7b91ba8029c936ca2cf65e771749mikhal@webrtc.org  // be exhibited on the receiver side).
23116196644914f7b91ba8029c936ca2cf65e771749mikhal@webrtc.org  // Target delay should be set to zero for real-time mode.
2329d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org  virtual int SetSenderBufferingMode(int video_channel,
2339d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org                                     int target_delay_ms) = 0;
2349d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org  // Sets receive side support for delayed video buffering. Target delay should
2359d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org  // be set to zero for real-time mode.
2369d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org  virtual int SetReceiverBufferingMode(int video_channel,
2379d6fcb37be4c9f49e1bb0b32bb01314c31f5e1ddmikhal@webrtc.org                                       int target_delay_ms) = 0;
23816196644914f7b91ba8029c936ca2cf65e771749mikhal@webrtc.org
239b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables RTCP key frame requests.
240b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetKeyFrameRequestMethod(
241b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org    const int video_channel, const ViEKeyFrameRequestMethod method) = 0;
242b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
243b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables signaling of temporary bitrate constraints using
244b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // RTCP, implemented based on RFC4585.
245b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetTMMBRStatus(const int video_channel, const bool enable) = 0;
246b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
247b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Enables and disables REMB packets for this channel. |sender| indicates
248b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // this channel is encoding, |receiver| tells the bitrate estimate for
249b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // this channel should be included in the REMB packet.
250b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetRembStatus(int video_channel,
251b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            bool sender,
252b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                            bool receiver) = 0;
253b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
254b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Enables RTP timestamp extension offset described in RFC 5450. This call
255b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // must be done before ViECodec::SetSendCodec is called.
256b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetSendTimestampOffsetStatus(int video_channel,
257b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                           bool enable,
258b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                           int id) = 0;
259b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
260b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetReceiveTimestampOffsetStatus(int video_channel,
261b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                              bool enable,
262b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                              int id) = 0;
263b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
264453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org  // Enables RTP absolute send time header extension. This call must be done
265453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org  // before ViECodec::SetSendCodec is called.
266453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org  virtual int SetSendAbsoluteSendTimeStatus(int video_channel,
267453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org                                            bool enable,
268453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org                                            int id) = 0;
269453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org
270f40e9b6ea200906facbabf507d0ef15ceae61fa3solenberg@webrtc.org  // When enabled for a channel, *all* channels on the same transport will be
271f40e9b6ea200906facbabf507d0ef15ceae61fa3solenberg@webrtc.org  // expected to include the absolute send time header extension.
272453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org  virtual int SetReceiveAbsoluteSendTimeStatus(int video_channel,
273453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org                                               bool enable,
274453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org                                               int id) = 0;
275453f9c0b3e2c0396b9e519ef37267a2056b65bd2solenberg@webrtc.org
2763dc7ff30185a2d7a597acb69183fca73bd1004d8asapersson@webrtc.org  // Enables/disables RTCP Receiver Reference Time Report Block extension/
2773dc7ff30185a2d7a597acb69183fca73bd1004d8asapersson@webrtc.org  // DLRR Report Block extension (RFC 3611).
27807dc4bec7f186dbb85d9b8abc7b8cc7df2c9684aasapersson@webrtc.org  virtual int SetRtcpXrRrtrStatus(int video_channel, bool enable) = 0;
2793dc7ff30185a2d7a597acb69183fca73bd1004d8asapersson@webrtc.org
280b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Enables transmission smoothening, i.e. packets belonging to the same frame
281b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // will be sent over a longer period of time instead of sending them
282b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // back-to-back.
283b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int SetTransmissionSmoothingStatus(int video_channel,
284b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                             bool enable) = 0;
285b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
2863f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  // Sets a minimal bitrate which will be padded to when the encoder doesn't
2873f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  // produce enough bitrate.
2883f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  // TODO(pbos): Remove default implementation when libjingle's
2893f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  // FakeWebRtcVideoEngine is updated.
2903f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  virtual int SetMinTransmitBitrate(int video_channel,
2913f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org                                    int min_transmit_bitrate_kbps) {
2923f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org    return -1;
2933f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org  };
2943f83f9cae99b605aee71b46839e902653baeb3f6pbos@webrtc.org
2952f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org  // Set a constant amount to deduct from received bitrate estimates before
2962f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org  // using it to allocate capacity among outgoing video streams.
2972f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org  virtual int SetReservedTransmitBitrate(
2982f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org      int video_channel, unsigned int reserved_transmit_bitrate_bps) {
2992f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org    return 0;
3002f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org  }
3012f0c5f796148eba014cd90b0d080ccd6a4761fd3solenberg@webrtc.org
302b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function returns our locally created statistics of the received RTP
303b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // stream.
3044673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int GetReceiveChannelRtcpStatistics(const int video_channel,
3054673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                              RtcpStatistics& basic_stats,
3064673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                              int& rtt_ms) const = 0;
307b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
308d1d198b964f5aee7459007a1512b3cf5a331af37stefan@webrtc.org  // This function returns statistics reported by the remote client in RTCP
309d1d198b964f5aee7459007a1512b3cf5a331af37stefan@webrtc.org  // report blocks. If several streams are reported, the statistics will be
310d1d198b964f5aee7459007a1512b3cf5a331af37stefan@webrtc.org  // aggregated.
311d1d198b964f5aee7459007a1512b3cf5a331af37stefan@webrtc.org  // If statistics are aggregated, extended_max_sequence_number is not reported,
312d1d198b964f5aee7459007a1512b3cf5a331af37stefan@webrtc.org  // and will always be set to 0.
3134673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int GetSendChannelRtcpStatistics(const int video_channel,
3144673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                           RtcpStatistics& basic_stats,
3154673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                           int& rtt_ms) const = 0;
3164673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3174673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // TODO(sprang): Temporary hacks to prevent libjingle build from failing,
3184673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // remove when libjingle has been lifted to support webrtc issue 2589
3194673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int GetReceivedRTCPStatistics(const int video_channel,
3204673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                unsigned short& fraction_lost,
3214673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                unsigned int& cumulative_lost,
3224673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                unsigned int& extended_max,
3234673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                unsigned int& jitter,
3244673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                int& rtt_ms) const {
3254673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    RtcpStatistics stats;
3264673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    int ret_code = GetReceiveChannelRtcpStatistics(video_channel,
3274673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                             stats,
3284673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                             rtt_ms);
3294673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    fraction_lost = stats.fraction_lost;
3304673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    cumulative_lost = stats.cumulative_lost;
3314673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    extended_max = stats.extended_max_sequence_number;
3324673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    jitter = stats.jitter;
3334673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    return ret_code;
3344673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  }
335b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetSentRTCPStatistics(const int video_channel,
3364673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                            unsigned short& fraction_lost,
3374673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                            unsigned int& cumulative_lost,
3384673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                            unsigned int& extended_max,
3394673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                            unsigned int& jitter,
3404673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                            int& rtt_ms) const {
3414673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    RtcpStatistics stats;
3424673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    int ret_code = GetSendChannelRtcpStatistics(video_channel,
3434673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                                stats,
3444673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                                                rtt_ms);
3454673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    fraction_lost = stats.fraction_lost;
3464673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    cumulative_lost = stats.cumulative_lost;
3474673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    extended_max = stats.extended_max_sequence_number;
3484673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    jitter = stats.jitter;
3494673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    return ret_code;
3504673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  }
3514673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3524673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3534673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterSendChannelRtcpStatisticsCallback(
3544ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, RtcpStatisticsCallback* callback) = 0;
3554673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3564673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterSendChannelRtcpStatisticsCallback(
3574ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, RtcpStatisticsCallback* callback) = 0;
3584673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3594673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterReceiveChannelRtcpStatisticsCallback(
3604ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, RtcpStatisticsCallback* callback) = 0;
3614673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3624673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterReceiveChannelRtcpStatisticsCallback(
3634ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, RtcpStatisticsCallback* callback) = 0;
364b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
365b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // The function gets statistics from the sent and received RTP streams.
3664673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int GetRtpStatistics(const int video_channel,
3674673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                               StreamDataCounters& sent,
3684673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                               StreamDataCounters& received) const = 0;
3694673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3704673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // TODO(sprang): Temporary hacks to prevent libjingle build from failing,
3714673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // remove when libjingle has been lifted to support webrtc issue 2589
372b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetRTPStatistics(const int video_channel,
3734673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                       unsigned int& bytes_sent,
3744673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                       unsigned int& packets_sent,
3754673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                       unsigned int& bytes_received,
3764673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org                       unsigned int& packets_received) const {
3774673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    StreamDataCounters sent;
3784673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    StreamDataCounters received;
3794673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    int ret_code = GetRtpStatistics(video_channel, sent, received);
3804673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    bytes_sent = sent.bytes;
3814673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    packets_sent = sent.packets;
3824673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    bytes_received = received.bytes;
3834673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    packets_received = received.packets;
3844673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org    return ret_code;
3854673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  }
3864673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3874673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterSendChannelRtpStatisticsCallback(
3884ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, StreamDataCountersCallback* callback) = 0;
3894673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3904673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterSendChannelRtpStatisticsCallback(
3914ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, StreamDataCountersCallback* callback) = 0;
3924673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3934673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterReceiveChannelRtpStatisticsCallback(
3944ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, StreamDataCountersCallback* callback) = 0;
3954673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
3964673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterReceiveChannelRtpStatisticsCallback(
3974ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, StreamDataCountersCallback* callback) = 0;
398b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
3994a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org
4004a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org  // Gets sent and received RTCP packet types.
4014a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org  // TODO(asapersson): Remove default implementation.
4024a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org  virtual int GetRtcpPacketTypeCounters(
4034a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org      int video_channel,
4044a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org      RtcpPacketTypeCounter* packets_sent,
4054a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org      RtcpPacketTypeCounter* packets_received) const { return -1; }
4064a1556017653ef7702585897b071872e83bd95b9asapersson@webrtc.org
407b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // The function gets bandwidth usage statistics from the sent RTP streams in
408b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // bits/s.
409b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetBandwidthUsage(const int video_channel,
410b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                unsigned int& total_bitrate_sent,
411b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                unsigned int& video_bitrate_sent,
412b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                unsigned int& fec_bitrate_sent,
413b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                unsigned int& nackBitrateSent) const = 0;
414b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
4154673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // (De)Register an observer, called whenever the send bitrate is updated
4164673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterSendBitrateObserver(
4174ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel,
4184673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org      BitrateStatisticsObserver* observer) = 0;
4194673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
4204673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterSendBitrateObserver(
4214ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel,
4224673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org      BitrateStatisticsObserver* observer) = 0;
4234673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
424b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the send-side estimated bandwidth available for video,
425b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // including overhead, in bits/s.
426b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetEstimatedSendBandwidth(
427b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const int video_channel,
428b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      unsigned int* estimated_bandwidth) const = 0;
429b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
430b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function gets the receive-side estimated bandwidth available for
431cd1ac8b77e14f5f84a0d99f732b0aff7297baa4cmflodman@webrtc.org  // video, including overhead, in bits/s. |estimated_bandwidth| is 0 if there
432cd1ac8b77e14f5f84a0d99f732b0aff7297baa4cmflodman@webrtc.org  // is no valid estimate.
433b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int GetEstimatedReceiveBandwidth(
434b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      const int video_channel,
435b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org      unsigned int* estimated_bandwidth) const = 0;
436b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
437d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org  // This function gets the receive-side bandwidth esitmator statistics.
438d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org  // TODO(jiayl): remove the default impl when libjingle's FakeWebRtcVideoEngine
439d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org  // is updated.
440d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org  virtual int GetReceiveBandwidthEstimatorStats(
441d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org      const int video_channel,
442d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org      ReceiveBandwidthEstimatorStats* output) const { return -1; }
443d1e7facca966ca4b7632940d71f62deea5094083jiayl@webrtc.org
44455a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org  // This function gets the PacedSender queuing delay for the last sent frame.
44555a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org  // TODO(jiayl): remove the default impl when libjingle is updated.
44655a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org  virtual int GetPacerQueuingDelayMs(
44755a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org      const int video_channel, int* delay_ms) const {
44855a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org    return -1;
44955a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org  }
45055a2a27d1a1aa9bf8401312a0b31250af4e3bd11jiayl@webrtc.org
451b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function enables capturing of RTP packets to a binary file on a
452b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // specific channel and for a given direction. The file can later be
453b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // replayed using e.g. RTP Tools rtpplay since the binary file format is
454b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // compatible with the rtpdump format.
455b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int StartRTPDump(const int video_channel,
456b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           const char file_nameUTF8[1024],
457b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                           RTPDirections direction) = 0;
458b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
459b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // This function disables capturing of RTP packets to a binary file on a
460b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // specific channel and for a given direction.
461b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int StopRTPDump(const int video_channel,
462b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                          RTPDirections direction) = 0;
463b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
464b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Registers an instance of a user implementation of the ViERTPObserver.
465b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int RegisterRTPObserver(const int video_channel,
466b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                  ViERTPObserver& observer) = 0;
467b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
468b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Removes a registered instance of ViERTPObserver.
469b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int DeregisterRTPObserver(const int video_channel) = 0;
470b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
471b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Registers an instance of a user implementation of the ViERTCPObserver.
472b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int RegisterRTCPObserver(const int video_channel,
473b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org                                   ViERTCPObserver& observer) = 0;
474b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
475b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  // Removes a registered instance of ViERTCPObserver.
476b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual int DeregisterRTCPObserver(const int video_channel) = 0;
477b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
4784673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // Registers and instance of a user implementation of ViEFrameCountObserver
4794673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int RegisterSendFrameCountObserver(
4804ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, FrameCountObserver* observer) = 0;
4814673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
4824673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  // Removes a registered instance of a ViEFrameCountObserver
4834673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org  virtual int DeregisterSendFrameCountObserver(
4844ee440a2e152f4a4f6b3f6b267f97738d899ab6csprang@webrtc.org      int video_channel, FrameCountObserver* observer) = 0;
4854673674e7fc7768f78bfc90f698ccf14a874fce1sprang@webrtc.org
486b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org protected:
487b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org  virtual ~ViERTP_RTCP() {}
488b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org};
489b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
490b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org}  // namespace webrtc
491b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org
492b015cbede88899f67a53fbbe581b02ce8e32794andrew@webrtc.org#endif  // WEBRTC_VIDEO_ENGINE_INCLUDE_VIE_RTP_RTCP_H_
493