blob: a16a65d51339fafb0e8ca42766daf875abc83a0b [file] [log] [blame]
andrew@webrtc.orga7b57da2012-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.orge561f8c2013-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.orge561f8c2013-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.orga7b57da2012-10-22 18:19:23 +000029
30namespace webrtc {
31
fischman@webrtc.orgcb139b12013-02-19 22:09:36 +000032class CallStatsObserver;
mflodman@webrtc.org63187902012-11-26 12:40:15 +000033class ChannelStatsObserver;
andresp@webrtc.orgad2b3682013-05-13 10:50:50 +000034class Config;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000035class CriticalSectionWrapper;
sprang@webrtc.org4a9843f2013-11-26 11:41:59 +000036class EncodedImageCallback;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000037class Encryption;
pbos@webrtc.org3ba57eb2013-10-21 10:34:43 +000038class I420FrameCallback;
pwestin@webrtc.org32f05a72012-11-13 21:12:39 +000039class PacedSender;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000040class ProcessThread;
asapersson@webrtc.orgc2162d12013-11-20 12:46:11 +000041class RtcpRttStats;
andresp@webrtc.orgad2b3682013-05-13 10:50:50 +000042class RtpRtcp;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000043class ThreadWrapper;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000044class ViEDecoderObserver;
45class ViEEffectFilter;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000046class ViERTCPObserver;
47class ViERTPObserver;
andresp@webrtc.orgad2b3682013-05-13 10:50:50 +000048class VideoCodingModule;
49class VideoDecoder;
50class VideoRenderCallback;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000051class VoEVideoSync;
52
53class ViEChannel
54 : public VCMFrameTypeCallback,
55 public VCMReceiveCallback,
56 public VCMReceiveStatisticsCallback,
fischman@webrtc.org7af2f812013-10-23 23:59:45 +000057 public VCMDecoderTimingCallback,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000058 public VCMPacketRequestCallback,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000059 public RtcpFeedback,
60 public RtpFeedback,
61 public ViEFrameProviderBase {
62 public:
mflodman@webrtc.org63187902012-11-26 12:40:15 +000063 friend class ChannelStatsObserver;
64
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +000065 ViEChannel(int32_t channel_id,
66 int32_t engine_id,
67 uint32_t number_of_cores,
andresp@webrtc.orgad2b3682013-05-13 10:50:50 +000068 const Config& config,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000069 ProcessThread& module_process_thread,
70 RtcpIntraFrameObserver* intra_frame_observer,
71 RtcpBandwidthObserver* bandwidth_observer,
72 RemoteBitrateEstimator* remote_bitrate_estimator,
asapersson@webrtc.orgc2162d12013-11-20 12:46:11 +000073 RtcpRttStats* rtt_stats,
pwestin@webrtc.org32f05a72012-11-13 21:12:39 +000074 PacedSender* paced_sender,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000075 RtpRtcp* default_rtp_rtcp,
76 bool sender);
77 ~ViEChannel();
78
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +000079 int32_t Init();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000080
81 // Sets the encoder to use for the channel. |new_stream| indicates the encoder
82 // type has changed and we should start a new RTP stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +000083 int32_t SetSendCodec(const VideoCodec& video_codec, bool new_stream = true);
84 int32_t SetReceiveCodec(const VideoCodec& video_codec);
85 int32_t GetReceiveCodec(VideoCodec* video_codec);
86 int32_t RegisterCodecObserver(ViEDecoderObserver* observer);
pbos@webrtc.org51868ad2013-04-09 00:34:42 +000087 // Registers an external decoder. |buffered_rendering| means that the decoder
88 // will render frames after decoding according to the render timestamp
89 // provided by the video coding module. |render_delay| indicates the time
90 // needed to decode and render a frame.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +000091 int32_t RegisterExternalDecoder(const uint8_t pl_type,
92 VideoDecoder* decoder,
93 bool buffered_rendering,
94 int32_t render_delay);
95 int32_t DeRegisterExternalDecoder(const uint8_t pl_type);
96 int32_t ReceiveCodecStatistics(uint32_t* num_key_frames,
97 uint32_t* num_delta_frames);
98 uint32_t DiscardedPackets() const;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +000099
mflodman@webrtc.orgb36efe32012-12-14 14:02:10 +0000100 // Returns the estimated delay in milliseconds.
101 int ReceiveDelay() const;
102
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000103 // Only affects calls to SetReceiveCodec done after this call.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000104 int32_t WaitForKeyFrame(bool wait);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000105
106 // If enabled, a key frame request will be sent as soon as there are lost
107 // packets. If |only_key_frames| are set, requests are only sent for loss in
108 // key frames.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000109 int32_t SetSignalPacketLossStatus(bool enable, bool only_key_frames);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000110
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000111 int32_t SetRTCPMode(const RTCPMethod rtcp_mode);
112 int32_t GetRTCPMode(RTCPMethod* rtcp_mode);
113 int32_t SetNACKStatus(const bool enable);
114 int32_t SetFECStatus(const bool enable,
115 const unsigned char payload_typeRED,
116 const unsigned char payload_typeFEC);
117 int32_t SetHybridNACKFECStatus(const bool enable,
118 const unsigned char payload_typeRED,
119 const unsigned char payload_typeFEC);
mikhal@webrtc.org4db69af2013-02-15 23:22:18 +0000120 int SetSenderBufferingMode(int target_delay_ms);
121 int SetReceiverBufferingMode(int target_delay_ms);
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000122 int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000123 bool EnableRemb(bool enable);
124 int SetSendTimestampOffsetStatus(bool enable, int id);
125 int SetReceiveTimestampOffsetStatus(bool enable, int id);
solenberg@webrtc.org967320b2013-05-20 12:00:23 +0000126 int SetSendAbsoluteSendTimeStatus(bool enable, int id);
127 int SetReceiveAbsoluteSendTimeStatus(bool enable, int id);
solenberg@webrtc.org8a3b04d2013-05-27 16:02:56 +0000128 bool GetReceiveAbsoluteSendTimeStatus() const;
asapersson@webrtc.org3fe2e7f2013-11-21 08:57:04 +0000129 void SetRtcpXrRrtrStatus(bool enable);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000130 void SetTransmissionSmoothingStatus(bool enable);
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000131 int32_t EnableTMMBR(const bool enable);
132 int32_t EnableKeyFrameRequestCallback(const bool enable);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000133
134 // Sets SSRC for outgoing stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000135 int32_t SetSSRC(const uint32_t SSRC,
136 const StreamType usage,
137 const unsigned char simulcast_idx);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000138
mflodman@webrtc.orgbe86bb62012-10-25 11:30:29 +0000139 // Gets SSRC for outgoing stream number |idx|.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000140 int32_t GetLocalSSRC(uint8_t idx, unsigned int* ssrc);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000141
142 // Gets SSRC for the incoming stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000143 int32_t GetRemoteSSRC(uint32_t* ssrc);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000144
145 // Gets the CSRC for the incoming stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000146 int32_t GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000147
mflodman@webrtc.org06077c92013-04-12 14:55:46 +0000148 int SetRtxSendPayloadType(int payload_type);
149 void SetRtxReceivePayloadType(int payload_type);
150
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000151 // Sets the starting sequence number, must be called before StartSend.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000152 int32_t SetStartSequenceNumber(uint16_t sequence_number);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000153
154 // Sets the CName for the outgoing stream on the channel.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000155 int32_t SetRTCPCName(const char rtcp_cname[]);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000156
157 // Gets the CName for the outgoing stream on the channel.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000158 int32_t GetRTCPCName(char rtcp_cname[]);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000159
160 // Gets the CName of the incoming stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000161 int32_t GetRemoteRTCPCName(char rtcp_cname[]);
162 int32_t RegisterRtpObserver(ViERTPObserver* observer);
163 int32_t RegisterRtcpObserver(ViERTCPObserver* observer);
164 int32_t SendApplicationDefinedRTCPPacket(
165 const uint8_t sub_type,
166 uint32_t name,
167 const uint8_t* data,
168 uint16_t data_length_in_bytes);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000169
170 // Returns statistics reported by the remote client in an RTCP packet.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000171 int32_t GetSendRtcpStatistics(uint16_t* fraction_lost,
172 uint32_t* cumulative_lost,
173 uint32_t* extended_max,
174 uint32_t* jitter_samples,
175 int32_t* rtt_ms);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000176
177 // Returns our localy created statistics of the received RTP stream.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000178 int32_t GetReceivedRtcpStatistics(uint16_t* fraction_lost,
179 uint32_t* cumulative_lost,
180 uint32_t* extended_max,
181 uint32_t* jitter_samples,
182 int32_t* rtt_ms);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000183
184 // Gets sent/received packets statistics.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000185 int32_t GetRtpStatistics(uint32_t* bytes_sent,
186 uint32_t* packets_sent,
187 uint32_t* bytes_received,
188 uint32_t* packets_received) const;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000189 void GetBandwidthUsage(uint32_t* total_bitrate_sent,
190 uint32_t* video_bitrate_sent,
191 uint32_t* fec_bitrate_sent,
192 uint32_t* nackBitrateSent) const;
mflodman@webrtc.org89c3de32013-02-06 17:46:39 +0000193 void GetEstimatedReceiveBandwidth(uint32_t* estimated_bandwidth) const;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000194
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000195 int32_t StartRTPDump(const char file_nameUTF8[1024],
196 RTPDirections direction);
197 int32_t StopRTPDump(RTPDirections direction);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000198
199 // Implements RtcpFeedback.
200 // TODO(pwestin) Depricate this functionality.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000201 virtual void OnApplicationDataReceived(const int32_t id,
202 const uint8_t sub_type,
203 const uint32_t name,
204 const uint16_t length,
205 const uint8_t* data);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000206 // Implements RtpFeedback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000207 virtual int32_t OnInitializeDecoder(
208 const int32_t id,
209 const int8_t payload_type,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000210 const char payload_name[RTP_PAYLOAD_NAME_SIZE],
211 const int frequency,
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000212 const uint8_t channels,
213 const uint32_t rate);
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000214 virtual void OnIncomingSSRCChanged(const int32_t id,
stefan@webrtc.org6cb612c2013-08-21 20:58:21 +0000215 const uint32_t ssrc);
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000216 virtual void OnIncomingCSRCChanged(const int32_t id,
217 const uint32_t CSRC,
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000218 const bool added);
stefan@webrtc.org6cb612c2013-08-21 20:58:21 +0000219 virtual void ResetStatistics(uint32_t);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000220
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000221 int32_t SetLocalReceiver(const uint16_t rtp_port,
222 const uint16_t rtcp_port,
223 const char* ip_address);
224 int32_t GetLocalReceiver(uint16_t* rtp_port,
225 uint16_t* rtcp_port,
226 char* ip_address) const;
227 int32_t SetSendDestination(const char* ip_address,
228 const uint16_t rtp_port,
229 const uint16_t rtcp_port,
230 const uint16_t source_rtp_port,
231 const uint16_t source_rtcp_port);
232 int32_t GetSendDestination(char* ip_address,
233 uint16_t* rtp_port,
234 uint16_t* rtcp_port,
235 uint16_t* source_rtp_port,
236 uint16_t* source_rtcp_port) const;
237 int32_t GetSourceInfo(uint16_t* rtp_port,
238 uint16_t* rtcp_port,
239 char* ip_address,
240 uint32_t ip_address_length);
pwestin@webrtc.org9a7b9f72013-03-13 23:20:57 +0000241
wu@webrtc.org55055d22013-08-15 23:38:54 +0000242 int32_t SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000243
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000244 int32_t StartSend();
245 int32_t StopSend();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000246 bool Sending();
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000247 int32_t StartReceive();
248 int32_t StopReceive();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000249
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000250 int32_t RegisterSendTransport(Transport* transport);
251 int32_t DeregisterSendTransport();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000252
253 // Incoming packet from external transport.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000254 int32_t ReceivedRTPPacket(const void* rtp_packet,
255 const int32_t rtp_packet_length);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000256
257 // Incoming packet from external transport.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000258 int32_t ReceivedRTCPPacket(const void* rtcp_packet,
259 const int32_t rtcp_packet_length);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000260
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000261 // Sets the maximum transfer unit size for the network link, i.e. including
262 // IP, UDP and RTP headers.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000263 int32_t SetMTU(uint16_t mtu);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000264
265 // Returns maximum allowed payload size, i.e. the maximum allowed size of
266 // encoded data in each packet.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000267 uint16_t MaxDataPayloadLength() const;
268 int32_t SetMaxPacketBurstSize(uint16_t max_number_of_packets);
269 int32_t SetPacketBurstSpreadState(bool enable, const uint16_t frame_periodMS);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000270
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000271 int32_t EnableColorEnhancement(bool enable);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000272
273 // Gets the modules used by the channel.
274 RtpRtcp* rtp_rtcp();
275
fischman@webrtc.orgcb139b12013-02-19 22:09:36 +0000276 CallStatsObserver* GetStatsObserver();
mflodman@webrtc.org63187902012-11-26 12:40:15 +0000277
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000278 // Implements VCMReceiveCallback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000279 virtual int32_t FrameToRender(I420VideoFrame& video_frame); // NOLINT
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000280
281 // Implements VCMReceiveCallback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000282 virtual int32_t ReceivedDecodedReferenceFrame(
283 const uint64_t picture_id);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000284
wuchengli@chromium.orgb0fc85b2013-08-12 14:20:49 +0000285 // Implements VCMReceiveCallback.
286 virtual void IncomingCodecChanged(const VideoCodec& codec);
287
fischman@webrtc.org7af2f812013-10-23 23:59:45 +0000288 // Implements VCMReceiveStatisticsCallback.
wu@webrtc.org55055d22013-08-15 23:38:54 +0000289 virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bit_rate,
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000290 const uint32_t frame_rate);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000291
fischman@webrtc.org7af2f812013-10-23 23:59:45 +0000292 // Implements VCMDecoderTimingCallback.
293 virtual void OnDecoderTiming(int decode_ms,
294 int max_decode_ms,
295 int current_delay_ms,
296 int target_delay_ms,
297 int jitter_buffer_ms,
298 int min_playout_delay_ms,
299 int render_delay_ms);
300
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000301 // Implements VideoFrameTypeCallback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000302 virtual int32_t RequestKeyFrame();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000303
304 // Implements VideoFrameTypeCallback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000305 virtual int32_t SliceLossIndicationRequest(
306 const uint64_t picture_id);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000307
308 // Implements VideoPacketRequestCallback.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000309 virtual int32_t ResendPackets(const uint16_t* sequence_numbers,
310 uint16_t length);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000311
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000312 int32_t RegisterExternalEncryption(Encryption* encryption);
313 int32_t DeRegisterExternalEncryption();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000314
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000315 int32_t SetVoiceChannel(int32_t ve_channel_id,
316 VoEVideoSync* ve_sync_interface);
317 int32_t VoiceChannel();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000318
319 // Implements ViEFrameProviderBase.
320 virtual int FrameCallbackChanged() {return -1;}
321
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000322 int32_t RegisterEffectFilter(ViEEffectFilter* effect_filter);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000323
sprang@webrtc.org4a9843f2013-11-26 11:41:59 +0000324 // New-style callbacks, used by VideoReceiveStream.
pbos@webrtc.org3ba57eb2013-10-21 10:34:43 +0000325 void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback);
sprang@webrtc.org4a9843f2013-11-26 11:41:59 +0000326 void RegisterPreDecodeImageCallback(
327 EncodedImageCallback* pre_decode_callback);
pbos@webrtc.org3ba57eb2013-10-21 10:34:43 +0000328
sprang@webrtc.org9435a172013-12-04 15:09:27 +0000329 void RegisterSendFrameCountObserver(FrameCountObserver* observer);
330
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000331 protected:
332 static bool ChannelDecodeThreadFunction(void* obj);
333 bool ChannelDecodeProcess();
334
mflodman@webrtc.org63187902012-11-26 12:40:15 +0000335 void OnRttUpdate(uint32_t rtt);
336
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000337 private:
338 // Assumed to be protected.
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000339 int32_t StartDecodeThread();
340 int32_t StopDecodeThread();
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000341
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000342 int32_t ProcessNACKRequest(const bool enable);
343 int32_t ProcessFECRequest(const bool enable,
344 const unsigned char payload_typeRED,
345 const unsigned char payload_typeFEC);
mikhal@webrtc.org4db69af2013-02-15 23:22:18 +0000346 // Compute NACK list parameters for the buffering mode.
347 int GetRequiredNackListSize(int target_delay_ms);
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000348
pbos@webrtc.org2a5d2292013-04-09 13:41:51 +0000349 int32_t channel_id_;
350 int32_t engine_id_;
351 uint32_t number_of_cores_;
352 uint8_t num_socket_threads_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000353
354 // Used for all registered callbacks except rendering.
355 scoped_ptr<CriticalSectionWrapper> callback_cs_;
356 scoped_ptr<CriticalSectionWrapper> rtp_rtcp_cs_;
357
358 RtpRtcp* default_rtp_rtcp_;
359
360 // Owned modules/classes.
361 scoped_ptr<RtpRtcp> rtp_rtcp_;
362 std::list<RtpRtcp*> simulcast_rtp_rtcp_;
mflodman@webrtc.org213217c2013-02-20 16:00:27 +0000363 std::list<RtpRtcp*> removed_rtp_rtcp_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000364 VideoCodingModule& vcm_;
365 ViEReceiver vie_receiver_;
366 ViESender vie_sender_;
367 ViESyncModule vie_sync_;
368
mflodman@webrtc.org63187902012-11-26 12:40:15 +0000369 // Helper to report call statistics.
370 scoped_ptr<ChannelStatsObserver> stats_observer_;
371
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000372 // Not owned.
373 ProcessThread& module_process_thread_;
374 ViEDecoderObserver* codec_observer_;
375 bool do_key_frame_callbackRequest_;
376 ViERTPObserver* rtp_observer_;
377 ViERTCPObserver* rtcp_observer_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000378 RtcpIntraFrameObserver* intra_frame_observer_;
asapersson@webrtc.orgc2162d12013-11-20 12:46:11 +0000379 RtcpRttStats* rtt_stats_;
pwestin@webrtc.org32f05a72012-11-13 21:12:39 +0000380 PacedSender* paced_sender_;
381
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000382 scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000383 int send_timestamp_extension_id_;
solenberg@webrtc.org967320b2013-05-20 12:00:23 +0000384 int absolute_send_time_extension_id_;
solenberg@webrtc.org8a3b04d2013-05-27 16:02:56 +0000385 bool receive_absolute_send_time_enabled_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000386 bool using_packet_spread_;
387
388 Transport* external_transport_;
389
390 bool decoder_reset_;
wuchengli@chromium.orgb0fc85b2013-08-12 14:20:49 +0000391 // Current receive codec used for codec change callback.
392 VideoCodec receive_codec_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000393 bool wait_for_key_frame_;
394 ThreadWrapper* decode_thread_;
395
396 Encryption* external_encryption_;
397
398 ViEEffectFilter* effect_filter_;
399 bool color_enhancement_;
400
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000401 // User set MTU, -1 if not set.
402 uint16_t mtu_;
403 const bool sender_;
mikhal@webrtc.orgd6739c82013-02-01 19:33:21 +0000404
405 int nack_history_size_sender_;
mikhal@webrtc.org4db69af2013-02-15 23:22:18 +0000406 int max_nack_reordering_threshold_;
pbos@webrtc.org3ba57eb2013-10-21 10:34:43 +0000407 I420FrameCallback* pre_render_callback_;
stefan@webrtc.orgda3ae7c2013-12-04 10:24:26 +0000408 const Config& config_;
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +0000409};
410
411} // namespace webrtc
412
413#endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_