andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 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.org | e561f8c | 2013-04-02 20:37:14 +0000 | [diff] [blame] | 16 | #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.org | e561f8c | 2013-04-02 20:37:14 +0000 | [diff] [blame] | 25 | #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.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 29 | |
| 30 | namespace webrtc { |
| 31 | |
fischman@webrtc.org | cb139b1 | 2013-02-19 22:09:36 +0000 | [diff] [blame] | 32 | class CallStatsObserver; |
mflodman@webrtc.org | 6318790 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 33 | class ChannelStatsObserver; |
andresp@webrtc.org | ad2b368 | 2013-05-13 10:50:50 +0000 | [diff] [blame] | 34 | class Config; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 35 | class CriticalSectionWrapper; |
sprang@webrtc.org | 4a9843f | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 36 | class EncodedImageCallback; |
pbos@webrtc.org | 3ba57eb | 2013-10-21 10:34:43 +0000 | [diff] [blame] | 37 | class I420FrameCallback; |
pwestin@webrtc.org | 32f05a7 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 38 | class PacedSender; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 39 | class ProcessThread; |
asapersson@webrtc.org | c2162d1 | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 40 | class RtcpRttStats; |
andresp@webrtc.org | ad2b368 | 2013-05-13 10:50:50 +0000 | [diff] [blame] | 41 | class RtpRtcp; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 42 | class ThreadWrapper; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 43 | class ViEDecoderObserver; |
| 44 | class ViEEffectFilter; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 45 | class ViERTCPObserver; |
| 46 | class ViERTPObserver; |
andresp@webrtc.org | ad2b368 | 2013-05-13 10:50:50 +0000 | [diff] [blame] | 47 | class VideoCodingModule; |
| 48 | class VideoDecoder; |
| 49 | class VideoRenderCallback; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 50 | class VoEVideoSync; |
| 51 | |
| 52 | class ViEChannel |
| 53 | : public VCMFrameTypeCallback, |
| 54 | public VCMReceiveCallback, |
| 55 | public VCMReceiveStatisticsCallback, |
fischman@webrtc.org | 7af2f81 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 56 | public VCMDecoderTimingCallback, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 57 | public VCMPacketRequestCallback, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 58 | public RtcpFeedback, |
| 59 | public RtpFeedback, |
| 60 | public ViEFrameProviderBase { |
| 61 | public: |
mflodman@webrtc.org | 6318790 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 62 | friend class ChannelStatsObserver; |
| 63 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 64 | ViEChannel(int32_t channel_id, |
| 65 | int32_t engine_id, |
| 66 | uint32_t number_of_cores, |
andresp@webrtc.org | ad2b368 | 2013-05-13 10:50:50 +0000 | [diff] [blame] | 67 | const Config& config, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 68 | ProcessThread& module_process_thread, |
| 69 | RtcpIntraFrameObserver* intra_frame_observer, |
| 70 | RtcpBandwidthObserver* bandwidth_observer, |
| 71 | RemoteBitrateEstimator* remote_bitrate_estimator, |
asapersson@webrtc.org | c2162d1 | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 72 | RtcpRttStats* rtt_stats, |
pwestin@webrtc.org | 32f05a7 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 73 | PacedSender* paced_sender, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 74 | RtpRtcp* default_rtp_rtcp, |
| 75 | bool sender); |
| 76 | ~ViEChannel(); |
| 77 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 78 | int32_t Init(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 79 | |
| 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.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 82 | 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.org | 51868ad | 2013-04-09 00:34:42 +0000 | [diff] [blame] | 86 | // 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.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 90 | 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.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 98 | |
mflodman@webrtc.org | b36efe3 | 2012-12-14 14:02:10 +0000 | [diff] [blame] | 99 | // Returns the estimated delay in milliseconds. |
| 100 | int ReceiveDelay() const; |
| 101 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 102 | // Only affects calls to SetReceiveCodec done after this call. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 103 | int32_t WaitForKeyFrame(bool wait); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 104 | |
| 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.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 108 | int32_t SetSignalPacketLossStatus(bool enable, bool only_key_frames); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 109 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 110 | 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.org | 4db69af | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 119 | int SetSenderBufferingMode(int target_delay_ms); |
| 120 | int SetReceiverBufferingMode(int target_delay_ms); |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 121 | int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 122 | bool EnableRemb(bool enable); |
| 123 | int SetSendTimestampOffsetStatus(bool enable, int id); |
| 124 | int SetReceiveTimestampOffsetStatus(bool enable, int id); |
solenberg@webrtc.org | 967320b | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 125 | int SetSendAbsoluteSendTimeStatus(bool enable, int id); |
| 126 | int SetReceiveAbsoluteSendTimeStatus(bool enable, int id); |
solenberg@webrtc.org | 8a3b04d | 2013-05-27 16:02:56 +0000 | [diff] [blame] | 127 | bool GetReceiveAbsoluteSendTimeStatus() const; |
asapersson@webrtc.org | 3fe2e7f | 2013-11-21 08:57:04 +0000 | [diff] [blame] | 128 | void SetRtcpXrRrtrStatus(bool enable); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 129 | void SetTransmissionSmoothingStatus(bool enable); |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 130 | int32_t EnableTMMBR(const bool enable); |
| 131 | int32_t EnableKeyFrameRequestCallback(const bool enable); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 132 | |
| 133 | // Sets SSRC for outgoing stream. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 134 | int32_t SetSSRC(const uint32_t SSRC, |
| 135 | const StreamType usage, |
| 136 | const unsigned char simulcast_idx); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 137 | |
mflodman@webrtc.org | be86bb6 | 2012-10-25 11:30:29 +0000 | [diff] [blame] | 138 | // Gets SSRC for outgoing stream number |idx|. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 139 | int32_t GetLocalSSRC(uint8_t idx, unsigned int* ssrc); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 140 | |
| 141 | // Gets SSRC for the incoming stream. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 142 | int32_t GetRemoteSSRC(uint32_t* ssrc); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 143 | |
| 144 | // Gets the CSRC for the incoming stream. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 145 | int32_t GetRemoteCSRC(uint32_t CSRCs[kRtpCsrcSize]); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 146 | |
mflodman@webrtc.org | 06077c9 | 2013-04-12 14:55:46 +0000 | [diff] [blame] | 147 | int SetRtxSendPayloadType(int payload_type); |
| 148 | void SetRtxReceivePayloadType(int payload_type); |
| 149 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 150 | // Sets the starting sequence number, must be called before StartSend. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 151 | int32_t SetStartSequenceNumber(uint16_t sequence_number); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 152 | |
| 153 | // Sets the CName for the outgoing stream on the channel. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 154 | int32_t SetRTCPCName(const char rtcp_cname[]); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 155 | |
| 156 | // Gets the CName for the outgoing stream on the channel. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 157 | int32_t GetRTCPCName(char rtcp_cname[]); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 158 | |
| 159 | // Gets the CName of the incoming stream. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 160 | int32_t GetRemoteRTCPCName(char rtcp_cname[]); |
| 161 | int32_t RegisterRtpObserver(ViERTPObserver* observer); |
| 162 | int32_t RegisterRtcpObserver(ViERTCPObserver* observer); |
| 163 | int32_t SendApplicationDefinedRTCPPacket( |
| 164 | const uint8_t sub_type, |
| 165 | uint32_t name, |
| 166 | const uint8_t* data, |
| 167 | uint16_t data_length_in_bytes); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 168 | |
| 169 | // Returns statistics reported by the remote client in an RTCP packet. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 170 | int32_t GetSendRtcpStatistics(uint16_t* fraction_lost, |
| 171 | uint32_t* cumulative_lost, |
| 172 | uint32_t* extended_max, |
| 173 | uint32_t* jitter_samples, |
| 174 | int32_t* rtt_ms); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 175 | |
sprang@webrtc.org | 8911937 | 2013-12-05 09:48:44 +0000 | [diff] [blame] | 176 | // Called on receipt of RTCP report block from remote side. |
| 177 | void RegisterSendChannelRtcpStatisticsCallback( |
| 178 | RtcpStatisticsCallback* callback); |
| 179 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 180 | // Returns our localy created statistics of the received RTP stream. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 181 | int32_t GetReceivedRtcpStatistics(uint16_t* fraction_lost, |
| 182 | uint32_t* cumulative_lost, |
| 183 | uint32_t* extended_max, |
| 184 | uint32_t* jitter_samples, |
| 185 | int32_t* rtt_ms); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 186 | |
sprang@webrtc.org | acc2e43 | 2013-12-19 13:26:02 +0000 | [diff] [blame] | 187 | // Called on generation of RTCP stats |
| 188 | void RegisterReceiveChannelRtcpStatisticsCallback( |
| 189 | RtcpStatisticsCallback* callback); |
| 190 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 191 | // Gets sent/received packets statistics. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 192 | int32_t GetRtpStatistics(uint32_t* bytes_sent, |
| 193 | uint32_t* packets_sent, |
| 194 | uint32_t* bytes_received, |
| 195 | uint32_t* packets_received) const; |
sprang@webrtc.org | cf5c552 | 2013-12-05 14:29:02 +0000 | [diff] [blame] | 196 | |
| 197 | // Called on update of RTP statistics. |
| 198 | void RegisterSendChannelRtpStatisticsCallback( |
| 199 | StreamDataCountersCallback* callback); |
| 200 | |
sprang@webrtc.org | 224933c | 2014-01-23 10:00:39 +0000 | [diff] [blame] | 201 | // Called on update of RTP statistics. |
| 202 | void RegisterReceiveChannelRtpStatisticsCallback( |
| 203 | StreamDataCountersCallback* callback); |
| 204 | |
asapersson@webrtc.org | 2fa9f7e | 2014-02-19 11:59:02 +0000 | [diff] [blame] | 205 | void GetRtcpPacketTypeCounters(RtcpPacketTypeCounter* packets_sent, |
| 206 | RtcpPacketTypeCounter* packets_received) const; |
| 207 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 208 | void GetBandwidthUsage(uint32_t* total_bitrate_sent, |
| 209 | uint32_t* video_bitrate_sent, |
| 210 | uint32_t* fec_bitrate_sent, |
| 211 | uint32_t* nackBitrateSent) const; |
stefan@webrtc.org | 8db148e | 2013-12-05 14:05:07 +0000 | [diff] [blame] | 212 | bool GetSendSideDelay(int* avg_send_delay, int* max_send_delay) const; |
jiayl@webrtc.org | a68379b | 2014-02-10 19:12:14 +0000 | [diff] [blame] | 213 | void GetReceiveBandwidthEstimatorStats( |
| 214 | ReceiveBandwidthEstimatorStats* output) const; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 215 | |
sprang@webrtc.org | 0e4512b | 2013-12-13 09:46:59 +0000 | [diff] [blame] | 216 | // Called on any new send bitrate estimate. |
| 217 | void RegisterSendBitrateObserver(BitrateStatisticsObserver* observer); |
| 218 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 219 | int32_t StartRTPDump(const char file_nameUTF8[1024], |
| 220 | RTPDirections direction); |
| 221 | int32_t StopRTPDump(RTPDirections direction); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 222 | |
| 223 | // Implements RtcpFeedback. |
| 224 | // TODO(pwestin) Depricate this functionality. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 225 | virtual void OnApplicationDataReceived(const int32_t id, |
| 226 | const uint8_t sub_type, |
| 227 | const uint32_t name, |
| 228 | const uint16_t length, |
| 229 | const uint8_t* data); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 230 | // Implements RtpFeedback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 231 | virtual int32_t OnInitializeDecoder( |
| 232 | const int32_t id, |
| 233 | const int8_t payload_type, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 234 | const char payload_name[RTP_PAYLOAD_NAME_SIZE], |
| 235 | const int frequency, |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 236 | const uint8_t channels, |
| 237 | const uint32_t rate); |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 238 | virtual void OnIncomingSSRCChanged(const int32_t id, |
stefan@webrtc.org | 6cb612c | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 239 | const uint32_t ssrc); |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 240 | virtual void OnIncomingCSRCChanged(const int32_t id, |
| 241 | const uint32_t CSRC, |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 242 | const bool added); |
stefan@webrtc.org | 6cb612c | 2013-08-21 20:58:21 +0000 | [diff] [blame] | 243 | virtual void ResetStatistics(uint32_t); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 244 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 245 | int32_t SetLocalReceiver(const uint16_t rtp_port, |
| 246 | const uint16_t rtcp_port, |
| 247 | const char* ip_address); |
| 248 | int32_t GetLocalReceiver(uint16_t* rtp_port, |
| 249 | uint16_t* rtcp_port, |
| 250 | char* ip_address) const; |
| 251 | int32_t SetSendDestination(const char* ip_address, |
| 252 | const uint16_t rtp_port, |
| 253 | const uint16_t rtcp_port, |
| 254 | const uint16_t source_rtp_port, |
| 255 | const uint16_t source_rtcp_port); |
| 256 | int32_t GetSendDestination(char* ip_address, |
| 257 | uint16_t* rtp_port, |
| 258 | uint16_t* rtcp_port, |
| 259 | uint16_t* source_rtp_port, |
| 260 | uint16_t* source_rtcp_port) const; |
| 261 | int32_t GetSourceInfo(uint16_t* rtp_port, |
| 262 | uint16_t* rtcp_port, |
| 263 | char* ip_address, |
| 264 | uint32_t ip_address_length); |
pwestin@webrtc.org | 9a7b9f7 | 2013-03-13 23:20:57 +0000 | [diff] [blame] | 265 | |
wu@webrtc.org | 55055d2 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 266 | int32_t SetRemoteSSRCType(const StreamType usage, const uint32_t SSRC); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 267 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 268 | int32_t StartSend(); |
| 269 | int32_t StopSend(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 270 | bool Sending(); |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 271 | int32_t StartReceive(); |
| 272 | int32_t StopReceive(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 273 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 274 | int32_t RegisterSendTransport(Transport* transport); |
| 275 | int32_t DeregisterSendTransport(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 276 | |
| 277 | // Incoming packet from external transport. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 278 | int32_t ReceivedRTPPacket(const void* rtp_packet, |
wu@webrtc.org | 3a4fc4b | 2013-12-13 00:21:03 +0000 | [diff] [blame] | 279 | const int32_t rtp_packet_length, |
| 280 | const PacketTime& packet_time); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 281 | |
| 282 | // Incoming packet from external transport. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 283 | int32_t ReceivedRTCPPacket(const void* rtcp_packet, |
| 284 | const int32_t rtcp_packet_length); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 285 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 286 | // Sets the maximum transfer unit size for the network link, i.e. including |
| 287 | // IP, UDP and RTP headers. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 288 | int32_t SetMTU(uint16_t mtu); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 289 | |
| 290 | // Returns maximum allowed payload size, i.e. the maximum allowed size of |
| 291 | // encoded data in each packet. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 292 | uint16_t MaxDataPayloadLength() const; |
| 293 | int32_t SetMaxPacketBurstSize(uint16_t max_number_of_packets); |
| 294 | int32_t SetPacketBurstSpreadState(bool enable, const uint16_t frame_periodMS); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 295 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 296 | int32_t EnableColorEnhancement(bool enable); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 297 | |
| 298 | // Gets the modules used by the channel. |
| 299 | RtpRtcp* rtp_rtcp(); |
| 300 | |
fischman@webrtc.org | cb139b1 | 2013-02-19 22:09:36 +0000 | [diff] [blame] | 301 | CallStatsObserver* GetStatsObserver(); |
mflodman@webrtc.org | 6318790 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 302 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 303 | // Implements VCMReceiveCallback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 304 | virtual int32_t FrameToRender(I420VideoFrame& video_frame); // NOLINT |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 305 | |
| 306 | // Implements VCMReceiveCallback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 307 | virtual int32_t ReceivedDecodedReferenceFrame( |
| 308 | const uint64_t picture_id); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 309 | |
wuchengli@chromium.org | b0fc85b | 2013-08-12 14:20:49 +0000 | [diff] [blame] | 310 | // Implements VCMReceiveCallback. |
| 311 | virtual void IncomingCodecChanged(const VideoCodec& codec); |
| 312 | |
fischman@webrtc.org | 7af2f81 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 313 | // Implements VCMReceiveStatisticsCallback. |
wu@webrtc.org | 55055d2 | 2013-08-15 23:38:54 +0000 | [diff] [blame] | 314 | virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bit_rate, |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 315 | const uint32_t frame_rate); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 316 | |
fischman@webrtc.org | 7af2f81 | 2013-10-23 23:59:45 +0000 | [diff] [blame] | 317 | // Implements VCMDecoderTimingCallback. |
| 318 | virtual void OnDecoderTiming(int decode_ms, |
| 319 | int max_decode_ms, |
| 320 | int current_delay_ms, |
| 321 | int target_delay_ms, |
| 322 | int jitter_buffer_ms, |
| 323 | int min_playout_delay_ms, |
| 324 | int render_delay_ms); |
| 325 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 326 | // Implements VideoFrameTypeCallback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 327 | virtual int32_t RequestKeyFrame(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 328 | |
| 329 | // Implements VideoFrameTypeCallback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 330 | virtual int32_t SliceLossIndicationRequest( |
| 331 | const uint64_t picture_id); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 332 | |
| 333 | // Implements VideoPacketRequestCallback. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 334 | virtual int32_t ResendPackets(const uint16_t* sequence_numbers, |
| 335 | uint16_t length); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 336 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 337 | int32_t SetVoiceChannel(int32_t ve_channel_id, |
| 338 | VoEVideoSync* ve_sync_interface); |
| 339 | int32_t VoiceChannel(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 340 | |
| 341 | // Implements ViEFrameProviderBase. |
| 342 | virtual int FrameCallbackChanged() {return -1;} |
| 343 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 344 | int32_t RegisterEffectFilter(ViEEffectFilter* effect_filter); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 345 | |
sprang@webrtc.org | 4a9843f | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 346 | // New-style callbacks, used by VideoReceiveStream. |
pbos@webrtc.org | 3ba57eb | 2013-10-21 10:34:43 +0000 | [diff] [blame] | 347 | void RegisterPreRenderCallback(I420FrameCallback* pre_render_callback); |
sprang@webrtc.org | 4a9843f | 2013-11-26 11:41:59 +0000 | [diff] [blame] | 348 | void RegisterPreDecodeImageCallback( |
| 349 | EncodedImageCallback* pre_decode_callback); |
pbos@webrtc.org | 3ba57eb | 2013-10-21 10:34:43 +0000 | [diff] [blame] | 350 | |
sprang@webrtc.org | 9435a17 | 2013-12-04 15:09:27 +0000 | [diff] [blame] | 351 | void RegisterSendFrameCountObserver(FrameCountObserver* observer); |
| 352 | |
solenberg@webrtc.org | 50ac4d6 | 2014-03-24 20:28:11 +0000 | [diff] [blame] | 353 | void ReceivedBWEPacket(int64_t arrival_time_ms, int payload_size, |
| 354 | const RTPHeader& header); |
| 355 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 356 | protected: |
| 357 | static bool ChannelDecodeThreadFunction(void* obj); |
| 358 | bool ChannelDecodeProcess(); |
| 359 | |
mflodman@webrtc.org | 6318790 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 360 | void OnRttUpdate(uint32_t rtt); |
| 361 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 362 | private: |
| 363 | // Assumed to be protected. |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 364 | int32_t StartDecodeThread(); |
| 365 | int32_t StopDecodeThread(); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 366 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 367 | int32_t ProcessNACKRequest(const bool enable); |
| 368 | int32_t ProcessFECRequest(const bool enable, |
| 369 | const unsigned char payload_typeRED, |
| 370 | const unsigned char payload_typeFEC); |
mikhal@webrtc.org | 4db69af | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 371 | // Compute NACK list parameters for the buffering mode. |
| 372 | int GetRequiredNackListSize(int target_delay_ms); |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 373 | |
pbos@webrtc.org | 2a5d229 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 374 | int32_t channel_id_; |
| 375 | int32_t engine_id_; |
| 376 | uint32_t number_of_cores_; |
| 377 | uint8_t num_socket_threads_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 378 | |
| 379 | // Used for all registered callbacks except rendering. |
| 380 | scoped_ptr<CriticalSectionWrapper> callback_cs_; |
| 381 | scoped_ptr<CriticalSectionWrapper> rtp_rtcp_cs_; |
| 382 | |
| 383 | RtpRtcp* default_rtp_rtcp_; |
| 384 | |
| 385 | // Owned modules/classes. |
| 386 | scoped_ptr<RtpRtcp> rtp_rtcp_; |
| 387 | std::list<RtpRtcp*> simulcast_rtp_rtcp_; |
mflodman@webrtc.org | 213217c | 2013-02-20 16:00:27 +0000 | [diff] [blame] | 388 | std::list<RtpRtcp*> removed_rtp_rtcp_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 389 | VideoCodingModule& vcm_; |
| 390 | ViEReceiver vie_receiver_; |
| 391 | ViESender vie_sender_; |
| 392 | ViESyncModule vie_sync_; |
| 393 | |
mflodman@webrtc.org | 6318790 | 2012-11-26 12:40:15 +0000 | [diff] [blame] | 394 | // Helper to report call statistics. |
| 395 | scoped_ptr<ChannelStatsObserver> stats_observer_; |
| 396 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 397 | // Not owned. |
| 398 | ProcessThread& module_process_thread_; |
| 399 | ViEDecoderObserver* codec_observer_; |
| 400 | bool do_key_frame_callbackRequest_; |
| 401 | ViERTPObserver* rtp_observer_; |
| 402 | ViERTCPObserver* rtcp_observer_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 403 | RtcpIntraFrameObserver* intra_frame_observer_; |
asapersson@webrtc.org | c2162d1 | 2013-11-20 12:46:11 +0000 | [diff] [blame] | 404 | RtcpRttStats* rtt_stats_; |
pwestin@webrtc.org | 32f05a7 | 2012-11-13 21:12:39 +0000 | [diff] [blame] | 405 | PacedSender* paced_sender_; |
| 406 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 407 | scoped_ptr<RtcpBandwidthObserver> bandwidth_observer_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 408 | int send_timestamp_extension_id_; |
solenberg@webrtc.org | 967320b | 2013-05-20 12:00:23 +0000 | [diff] [blame] | 409 | int absolute_send_time_extension_id_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 410 | |
| 411 | Transport* external_transport_; |
| 412 | |
| 413 | bool decoder_reset_; |
wuchengli@chromium.org | b0fc85b | 2013-08-12 14:20:49 +0000 | [diff] [blame] | 414 | // Current receive codec used for codec change callback. |
| 415 | VideoCodec receive_codec_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 416 | bool wait_for_key_frame_; |
| 417 | ThreadWrapper* decode_thread_; |
| 418 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 419 | ViEEffectFilter* effect_filter_; |
| 420 | bool color_enhancement_; |
| 421 | |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 422 | // User set MTU, -1 if not set. |
| 423 | uint16_t mtu_; |
| 424 | const bool sender_; |
mikhal@webrtc.org | d6739c8 | 2013-02-01 19:33:21 +0000 | [diff] [blame] | 425 | |
| 426 | int nack_history_size_sender_; |
mikhal@webrtc.org | 4db69af | 2013-02-15 23:22:18 +0000 | [diff] [blame] | 427 | int max_nack_reordering_threshold_; |
pbos@webrtc.org | 3ba57eb | 2013-10-21 10:34:43 +0000 | [diff] [blame] | 428 | I420FrameCallback* pre_render_callback_; |
stefan@webrtc.org | da3ae7c | 2013-12-04 10:24:26 +0000 | [diff] [blame] | 429 | const Config& config_; |
andrew@webrtc.org | a7b57da | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 430 | }; |
| 431 | |
| 432 | } // namespace webrtc |
| 433 | |
| 434 | #endif // WEBRTC_VIDEO_ENGINE_VIE_CHANNEL_H_ |