blob: 23b7e5e592336d927ca0cfbfd4fe88b7b10694ad [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_VIDEO_ENGINE_VIE_CHANNEL_H_
12#define WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_
13
14#include <list>
15
pwestin@webrtc.org065b64d2013-04-02 20:37:14 +000016#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
17#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
18#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
19#include "webrtc/system_wrappers/interface/scoped_ptr.h"
20#include "webrtc/system_wrappers/interface/tick_util.h"
21#include "webrtc/typedefs.h"
22#include "webrtc/video_engine/include/vie_network.h"
23#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
24#include "webrtc/video_engine/vie_defines.h"
pwestin@webrtc.org065b64d2013-04-02 20:37:14 +000025#include "webrtc/video_engine/vie_frame_provider_base.h"
26#include "webrtc/video_engine/vie_receiver.h"
27#include "webrtc/video_engine/vie_sender.h"
28#include "webrtc/video_engine/vie_sync_module.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000029
30namespace webrtc {
31
fischman@webrtc.org0329e592013-02-19 22:09:36 +000032class CallStatsObserver;
mflodman@webrtc.org78696d32012-11-26 12:40:15 +000033class ChannelStatsObserver;
andresp@webrtc.orgac6d9192013-05-13 10:50:50 +000034class Config;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000035class CriticalSectionWrapper;
sprang@webrtc.org2e98d452013-11-26 11:41:59 +000036class EncodedImageCallback;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +000037class I420FrameCallback;
pwestin@webrtc.org5e87b5f2012-11-13 21:12:39 +000038class PacedSender;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000039class ProcessThread;
asapersson@webrtc.orgc4af4cf2013-11-20 12:46:11 +000040class RtcpRttStats;
andresp@webrtc.orgac6d9192013-05-13 10:50:50 +000041class RtpRtcp;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000042class ThreadWrapper;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000043class ViEDecoderObserver;
44class ViEEffectFilter;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000045class ViERTCPObserver;
46class ViERTPObserver;
andresp@webrtc.orgac6d9192013-05-13 10:50:50 +000047class VideoCodingModule;
48class VideoDecoder;
49class VideoRenderCallback;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000050class VoEVideoSync;
51
52class ViEChannel
53 : public VCMFrameTypeCallback,
54 public VCMReceiveCallback,
55 public VCMReceiveStatisticsCallback,
fischman@webrtc.orgecfef192013-10-23 23:59:45 +000056 public VCMDecoderTimingCallback,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000057 public VCMPacketRequestCallback,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000058 public RtcpFeedback,
59 public RtpFeedback,
60 public ViEFrameProviderBase {
61 public:
mflodman@webrtc.org78696d32012-11-26 12:40:15 +000062 friend class ChannelStatsObserver;
63
pbos@webrtc.org67879bc2013-04-09 13:41:51 +000064 ViEChannel(int32_t channel_id,
65 int32_t engine_id,
66 uint32_t number_of_cores,
andresp@webrtc.orgac6d9192013-05-13 10:50:50 +000067 const Config& config,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000068 ProcessThread& module_process_thread,
69 RtcpIntraFrameObserver* intra_frame_observer,
70 RtcpBandwidthObserver* bandwidth_observer,
71 RemoteBitrateEstimator* remote_bitrate_estimator,
asapersson@webrtc.orgc4af4cf2013-11-20 12:46:11 +000072 RtcpRttStats* rtt_stats,
pwestin@webrtc.org5e87b5f2012-11-13 21:12:39 +000073 PacedSender* paced_sender,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000074 RtpRtcp* default_rtp_rtcp,
75 bool sender);
76 ~ViEChannel();
77
pbos@webrtc.org67879bc2013-04-09 13:41:51 +000078 int32_t Init();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000079
80 // Sets the encoder to use for the channel. |new_stream| indicates the encoder
81 // type has changed and we should start a new RTP stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +000082 int32_t SetSendCodec(const VideoCodec& video_codec, bool new_stream = true);
83 int32_t SetReceiveCodec(const VideoCodec& video_codec);
84 int32_t GetReceiveCodec(VideoCodec* video_codec);
85 int32_t RegisterCodecObserver(ViEDecoderObserver* observer);
pbos@webrtc.org208a6482013-04-09 00:34:42 +000086 // Registers an external decoder. |buffered_rendering| means that the decoder
87 // will render frames after decoding according to the render timestamp
88 // provided by the video coding module. |render_delay| indicates the time
89 // needed to decode and render a frame.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +000090 int32_t RegisterExternalDecoder(const uint8_t pl_type,
91 VideoDecoder* decoder,
92 bool buffered_rendering,
93 int32_t render_delay);
94 int32_t DeRegisterExternalDecoder(const uint8_t pl_type);
95 int32_t ReceiveCodecStatistics(uint32_t* num_key_frames,
96 uint32_t* num_delta_frames);
97 uint32_t DiscardedPackets() const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000098
mflodman@webrtc.orgf314c802012-12-14 14:02:10 +000099 // Returns the estimated delay in milliseconds.
100 int ReceiveDelay() const;
101
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000102 // Only affects calls to SetReceiveCodec done after this call.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000103 int32_t WaitForKeyFrame(bool wait);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000104
105 // If enabled, a key frame request will be sent as soon as there are lost
106 // packets. If |only_key_frames| are set, requests are only sent for loss in
107 // key frames.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000108 int32_t SetSignalPacketLossStatus(bool enable, bool only_key_frames);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000109
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000110 int32_t SetRTCPMode(const RTCPMethod rtcp_mode);
111 int32_t GetRTCPMode(RTCPMethod* rtcp_mode);
112 int32_t SetNACKStatus(const bool enable);
113 int32_t SetFECStatus(const bool enable,
114 const unsigned char payload_typeRED,
115 const unsigned char payload_typeFEC);
116 int32_t SetHybridNACKFECStatus(const bool enable,
117 const unsigned char payload_typeRED,
118 const unsigned char payload_typeFEC);
mikhal@webrtc.org9d6fcb32013-02-15 23:22:18 +0000119 int SetSenderBufferingMode(int target_delay_ms);
120 int SetReceiverBufferingMode(int target_delay_ms);
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000121 int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000122 bool EnableRemb(bool enable);
123 int SetSendTimestampOffsetStatus(bool enable, int id);
124 int SetReceiveTimestampOffsetStatus(bool enable, int id);
solenberg@webrtc.org453f9c02013-05-20 12:00:23 +0000125 int SetSendAbsoluteSendTimeStatus(bool enable, int id);
126 int SetReceiveAbsoluteSendTimeStatus(bool enable, int id);
solenberg@webrtc.orgf40e9b62013-05-27 16:02:56 +0000127 bool GetReceiveAbsoluteSendTimeStatus() const;
asapersson@webrtc.org3dc7ff32013-11-21 08:57:04 +0000128 void SetRtcpXrRrtrStatus(bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000129 void SetTransmissionSmoothingStatus(bool enable);
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000130 int32_t EnableTMMBR(const bool enable);
131 int32_t EnableKeyFrameRequestCallback(const bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000132
133 // Sets SSRC for outgoing stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000134 int32_t SetSSRC(const uint32_t SSRC,
135 const StreamType usage,
136 const unsigned char simulcast_idx);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000137
mflodman@webrtc.orgb6d9cfc2012-10-25 11:30:29 +0000138 // Gets SSRC for outgoing stream number |idx|.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000139 int32_t GetLocalSSRC(uint8_t idx, unsigned int* ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000140
141 // Gets SSRC for the incoming stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000142 int32_t GetRemoteSSRC(uint32_t* ssrc);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000143
144 // Gets the CSRC for the incoming stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000145 int32_t GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000146
mflodman@webrtc.org7bc7e022013-04-12 14:55:46 +0000147 int SetRtxSendPayloadType(int payload_type);
stefan@webrtc.org6845de72014-06-11 13:41:36 +0000148 // Only has an effect once RTX is enabled.
149 void SetPadWithRedundantPayloads(bool enable);
mflodman@webrtc.org7bc7e022013-04-12 14:55:46 +0000150 void SetRtxReceivePayloadType(int payload_type);
151
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000152 // Sets the starting sequence number, must be called before StartSend.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000153 int32_t SetStartSequenceNumber(uint16_t sequence_number);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000154
155 // Sets the CName for the outgoing stream on the channel.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000156 int32_t SetRTCPCName(const char rtcp_cname[]);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000157
158 // Gets the CName for the outgoing stream on the channel.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000159 int32_t GetRTCPCName(char rtcp_cname[]);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000160
161 // Gets the CName of the incoming stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000162 int32_t GetRemoteRTCPCName(char rtcp_cname[]);
163 int32_t RegisterRtpObserver(ViERTPObserver* observer);
164 int32_t RegisterRtcpObserver(ViERTCPObserver* observer);
165 int32_t SendApplicationDefinedRTCPPacket(
166 const uint8_t sub_type,
167 uint32_t name,
168 const uint8_t* data,
169 uint16_t data_length_in_bytes);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000170
171 // Returns statistics reported by the remote client in an RTCP packet.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000172 int32_t GetSendRtcpStatistics(uint16_t* fraction_lost,
173 uint32_t* cumulative_lost,
174 uint32_t* extended_max,
175 uint32_t* jitter_samples,
176 int32_t* rtt_ms);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000177
sprang@webrtc.org9b30fd32013-12-05 09:48:44 +0000178 // Called on receipt of RTCP report block from remote side.
179 void RegisterSendChannelRtcpStatisticsCallback(
180 RtcpStatisticsCallback* callback);
181
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000182 // Returns our localy created statistics of the received RTP stream.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000183 int32_t GetReceivedRtcpStatistics(uint16_t* fraction_lost,
184 uint32_t* cumulative_lost,
185 uint32_t* extended_max,
186 uint32_t* jitter_samples,
187 int32_t* rtt_ms);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000188
sprang@webrtc.org4f1f5fa2013-12-19 13:26:02 +0000189 // Called on generation of RTCP stats
190 void RegisterReceiveChannelRtcpStatisticsCallback(
191 RtcpStatisticsCallback* callback);
192
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000193 // Gets sent/received packets statistics.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000194 int32_t GetRtpStatistics(uint32_t* bytes_sent,
195 uint32_t* packets_sent,
196 uint32_t* bytes_received,
197 uint32_t* packets_received) const;
sprang@webrtc.orgb1139812013-12-05 14:29:02 +0000198
199 // Called on update of RTP statistics.
200 void RegisterSendChannelRtpStatisticsCallback(
201 StreamDataCountersCallback* callback);
202
sprang@webrtc.org7d99cd42014-01-23 10:00:39 +0000203 // Called on update of RTP statistics.
204 void RegisterReceiveChannelRtpStatisticsCallback(
205 StreamDataCountersCallback* callback);
206
asapersson@webrtc.org4a155602014-02-19 11:59:02 +0000207 void GetRtcpPacketTypeCounters(RtcpPacketTypeCounter* packets_sent,
208 RtcpPacketTypeCounter* packets_received) const;
209
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000210 void GetBandwidthUsage(uint32_t* total_bitrate_sent,
211 uint32_t* video_bitrate_sent,
212 uint32_t* fec_bitrate_sent,
213 uint32_t* nackBitrateSent) const;
stefan@webrtc.orgee234be2013-12-05 14:05:07 +0000214 bool GetSendSideDelay(int* avg_send_delay, int* max_send_delay) const;
jiayl@webrtc.orgd1e7fac2014-02-10 19:12:14 +0000215 void GetReceiveBandwidthEstimatorStats(
216 ReceiveBandwidthEstimatorStats* output) const;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000217
sprang@webrtc.orgb70db6d2013-12-13 09:46:59 +0000218 // Called on any new send bitrate estimate.
219 void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer);
220
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000221 int32_t StartRTPDump(const char file_nameUTF8[1024],
222 RTPDirections direction);
223 int32_t StopRTPDump(RTPDirections direction);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000224
225 // Implements RtcpFeedback.
226 // TODO(pwestin) Depricate this functionality.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000227 virtual void OnApplicationDataReceived(const int32_t id,
228 const uint8_t sub_type,
229 const uint32_t name,
230 const uint16_t length,
231 const uint8_t* data);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000232 // Implements RtpFeedback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000233 virtual int32_t OnInitializeDecoder(
234 const int32_t id,
235 const int8_t payload_type,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000236 const char payload_name[RTP_PAYLOAD_NAME_SIZE],
237 const int frequency,
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000238 const uint8_t channels,
239 const uint32_t rate);
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000240 virtual void OnIncomingSSRCChanged(const int32_t id,
stefan@webrtc.orga20e2d42013-08-21 20:58:21 +0000241 const uint32_t ssrc);
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000242 virtual void OnIncomingCSRCChanged(const int32_t id,
243 const uint32_t CSRC,
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000244 const bool added);
stefan@webrtc.orga20e2d42013-08-21 20:58:21 +0000245 virtual void ResetStatistics(uint32_t);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000246
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000247 int32_t SetLocalReceiver(const uint16_t rtp_port,
248 const uint16_t rtcp_port,
249 const char* ip_address);
250 int32_t GetLocalReceiver(uint16_t* rtp_port,
251 uint16_t* rtcp_port,
252 char* ip_address) const;
253 int32_t SetSendDestination(const char* ip_address,
254 const uint16_t rtp_port,
255 const uint16_t rtcp_port,
256 const uint16_t source_rtp_port,
257 const uint16_t source_rtcp_port);
258 int32_t GetSendDestination(char* ip_address,
259 uint16_t* rtp_port,
260 uint16_t* rtcp_port,
261 uint16_t* source_rtp_port,
262 uint16_t* source_rtcp_port) const;
263 int32_t GetSourceInfo(uint16_t* rtp_port,
264 uint16_t* rtcp_port,
265 char* ip_address,
266 uint32_t ip_address_length);
pwestin@webrtc.org912b7f72013-03-13 23:20:57 +0000267
wu@webrtc.org7fc75bb2013-08-15 23:38:54 +0000268 int32_t SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000269
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000270 int32_t StartSend();
271 int32_t StopSend();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000272 bool Sending();
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000273 int32_t StartReceive();
274 int32_t StopReceive();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000275
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000276 int32_t RegisterSendTransport(Transport* transport);
277 int32_t DeregisterSendTransport();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000278
279 // Incoming packet from external transport.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000280 int32_t ReceivedRTPPacket(const void* rtp_packet,
wu@webrtc.orgefeb8ce2013-12-13 00:21:03 +0000281 const int32_t rtp_packet_length,
282 const PacketTime& packet_time);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000283
284 // Incoming packet from external transport.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000285 int32_t ReceivedRTCPPacket(const void* rtcp_packet,
286 const int32_t rtcp_packet_length);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000287
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000288 // Sets the maximum transfer unit size for the network link, i.e. including
289 // IP, UDP and RTP headers.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000290 int32_t SetMTU(uint16_t mtu);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000291
292 // Returns maximum allowed payload size, i.e. the maximum allowed size of
293 // encoded data in each packet.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000294 uint16_t MaxDataPayloadLength() const;
295 int32_t SetMaxPacketBurstSize(uint16_t max_number_of_packets);
296 int32_t SetPacketBurstSpreadState(bool enable, const uint16_t frame_periodMS);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000297
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000298 int32_t EnableColorEnhancement(bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000299
300 // Gets the modules used by the channel.
301 RtpRtcp* rtp_rtcp();
302
fischman@webrtc.org0329e592013-02-19 22:09:36 +0000303 CallStatsObserver* GetStatsObserver();
mflodman@webrtc.org78696d32012-11-26 12:40:15 +0000304
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000305 // Implements VCMReceiveCallback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000306 virtual int32_t FrameToRender(I420VideoFrame& video_frame); // NOLINT
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000307
308 // Implements VCMReceiveCallback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000309 virtual int32_t ReceivedDecodedReferenceFrame(
310 const uint64_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000311
wuchengli@chromium.orgd893b3f2013-08-12 14:20:49 +0000312 // Implements VCMReceiveCallback.
313 virtual void IncomingCodecChanged(const VideoCodec& codec);
314
fischman@webrtc.orgecfef192013-10-23 23:59:45 +0000315 // Implements VCMReceiveStatisticsCallback.
wu@webrtc.org7fc75bb2013-08-15 23:38:54 +0000316 virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bit_rate,
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000317 const uint32_t frame_rate);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000318
fischman@webrtc.orgecfef192013-10-23 23:59:45 +0000319 // Implements VCMDecoderTimingCallback.
320 virtual void OnDecoderTiming(int decode_ms,
321 int max_decode_ms,
322 int current_delay_ms,
323 int target_delay_ms,
324 int jitter_buffer_ms,
325 int min_playout_delay_ms,
326 int render_delay_ms);
327
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000328 // Implements VideoFrameTypeCallback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000329 virtual int32_t RequestKeyFrame();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000330
331 // Implements VideoFrameTypeCallback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000332 virtual int32_t SliceLossIndicationRequest(
333 const uint64_t picture_id);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000334
335 // Implements VideoPacketRequestCallback.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000336 virtual int32_t ResendPackets(const uint16_t* sequence_numbers,
337 uint16_t length);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000338
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000339 int32_t SetVoiceChannel(int32_t ve_channel_id,
340 VoEVideoSync* ve_sync_interface);
341 int32_t VoiceChannel();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000342
343 // Implements ViEFrameProviderBase.
344 virtual int FrameCallbackChanged() {return -1;}
345
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000346 int32_t RegisterEffectFilter(ViEEffectFilter* effect_filter);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000347
sprang@webrtc.org2e98d452013-11-26 11:41:59 +0000348 // New-style callbacks, used by VideoReceiveStream.
pbos@webrtc.org63301bd2013-10-21 10:34:43 +0000349 void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback);
sprang@webrtc.org2e98d452013-11-26 11:41:59 +0000350 void RegisterPreDecodeImageCallback(
351 EncodedImageCallback* pre_decode_callback);
pbos@webrtc.org63301bd2013-10-21 10:34:43 +0000352
sprang@webrtc.org5fdd10a2013-12-04 15:09:27 +0000353 void RegisterSendFrameCountObserver(FrameCountObserver* observer);
354
solenberg@webrtc.org2d3624c2014-03-24 20:28:11 +0000355 void ReceivedBWEPacket(int64_t arrival_time_ms, int payload_size,
356 const RTPHeader& header);
357
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000358 protected:
359 static bool ChannelDecodeThreadFunction(void* obj);
360 bool ChannelDecodeProcess();
361
mflodman@webrtc.org78696d32012-11-26 12:40:15 +0000362 void OnRttUpdate(uint32_t rtt);
363
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000364 private:
365 // Assumed to be protected.
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000366 int32_t StartDecodeThread();
367 int32_t StopDecodeThread();
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000368
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000369 int32_t ProcessNACKRequest(const bool enable);
370 int32_t ProcessFECRequest(const bool enable,
371 const unsigned char payload_typeRED,
372 const unsigned char payload_typeFEC);
mikhal@webrtc.org9d6fcb32013-02-15 23:22:18 +0000373 // Compute NACK list parameters for the buffering mode.
374 int GetRequiredNackListSize(int target_delay_ms);
stefan@webrtc.org6845de72014-06-11 13:41:36 +0000375 void SetRtxSendStatus(bool enable);
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000376
pbos@webrtc.org67879bc2013-04-09 13:41:51 +0000377 int32_t channel_id_;
378 int32_t engine_id_;
379 uint32_t number_of_cores_;
380 uint8_t num_socket_threads_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000381
382 // Used for all registered callbacks except rendering.
383 scoped_ptr<CriticalSectionWrapper> callback_cs_;
384 scoped_ptr<CriticalSectionWrapper> rtp_rtcp_cs_;
385
386 RtpRtcp* default_rtp_rtcp_;
387
388 // Owned modules/classes.
389 scoped_ptr<RtpRtcp> rtp_rtcp_;
390 std::list<RtpRtcp*> simulcast_rtp_rtcp_;
mflodman@webrtc.org55e6f582013-02-20 16:00:27 +0000391 std::list<RtpRtcp*> removed_rtp_rtcp_;
pbos@webrtc.org7f545612014-05-23 09:41:07 +0000392 VideoCodingModule* const vcm_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000393 ViEReceiver vie_receiver_;
394 ViESender vie_sender_;
395 ViESyncModule vie_sync_;
396
mflodman@webrtc.org78696d32012-11-26 12:40:15 +0000397 // Helper to report call statistics.
398 scoped_ptr<ChannelStatsObserver> stats_observer_;
399
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000400 // Not owned.
401 ProcessThread& module_process_thread_;
402 ViEDecoderObserver* codec_observer_;
403 bool do_key_frame_callbackRequest_;
404 ViERTPObserver* rtp_observer_;
405 ViERTCPObserver* rtcp_observer_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000406 RtcpIntraFrameObserver* intra_frame_observer_;
asapersson@webrtc.orgc4af4cf2013-11-20 12:46:11 +0000407 RtcpRttStats* rtt_stats_;
pwestin@webrtc.org5e87b5f2012-11-13 21:12:39 +0000408 PacedSender* paced_sender_;
stefan@webrtc.org6845de72014-06-11 13:41:36 +0000409 bool pad_with_redundant_payloads_;
pwestin@webrtc.org5e87b5f2012-11-13 21:12:39 +0000410
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000411 scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000412 int send_timestamp_extension_id_;
solenberg@webrtc.org453f9c02013-05-20 12:00:23 +0000413 int absolute_send_time_extension_id_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000414
415 Transport* external_transport_;
416
417 bool decoder_reset_;
wuchengli@chromium.orgd893b3f2013-08-12 14:20:49 +0000418 // Current receive codec used for codec change callback.
419 VideoCodec receive_codec_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000420 bool wait_for_key_frame_;
421 ThreadWrapper* decode_thread_;
422
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000423 ViEEffectFilter* effect_filter_;
424 bool color_enhancement_;
425
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000426 // User set MTU, -1 if not set.
427 uint16_t mtu_;
428 const bool sender_;
mikhal@webrtc.org16196642013-02-01 19:33:21 +0000429
430 int nack_history_size_sender_;
mikhal@webrtc.org9d6fcb32013-02-15 23:22:18 +0000431 int max_nack_reordering_threshold_;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +0000432 I420FrameCallback* pre_render_callback_;
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +0000433};
434
435} // namespace webrtc
436
437#endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_