blob: 39285423e40666990ed78a3874d838fe3bff6f3d [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
3 * Copyright 2004 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef TALK_MEDIA_WEBRTCVIDEOENGINE_H_
29#define TALK_MEDIA_WEBRTCVIDEOENGINE_H_
30
31#include <map>
32#include <vector>
33
34#include "talk/base/scoped_ptr.h"
35#include "talk/media/base/codec.h"
36#include "talk/media/base/videocommon.h"
37#include "talk/media/webrtc/webrtccommon.h"
38#include "talk/media/webrtc/webrtcexport.h"
39#include "talk/media/webrtc/webrtcvideoencoderfactory.h"
40#include "talk/session/media/channel.h"
41#include "webrtc/video_engine/include/vie_base.h"
42
43#if !defined(LIBPEERCONNECTION_LIB) && \
44 !defined(LIBPEERCONNECTION_IMPLEMENTATION)
45#error "Bogus include."
46#endif
47
henrike@webrtc.orgf45a5502014-03-13 18:51:34 +000048
henrike@webrtc.org28e20752013-07-10 00:45:36 +000049namespace webrtc {
50class VideoCaptureModule;
51class VideoDecoder;
52class VideoEncoder;
53class VideoRender;
54class ViEExternalCapture;
55class ViERTP_RTCP;
56}
57
58namespace talk_base {
59class CpuMonitor;
60} // namespace talk_base
61
62namespace cricket {
63
mallinath@webrtc.org67ee6b92014-02-03 16:57:16 +000064class CoordinatedVideoAdapter;
65class ViETraceWrapper;
66class ViEWrapper;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000067class VideoCapturer;
68class VideoFrame;
69class VideoProcessor;
70class VideoRenderer;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000071class VoiceMediaChannel;
72class WebRtcDecoderObserver;
73class WebRtcEncoderObserver;
74class WebRtcLocalStreamInfo;
75class WebRtcRenderAdapter;
76class WebRtcVideoChannelRecvInfo;
77class WebRtcVideoChannelSendInfo;
78class WebRtcVideoDecoderFactory;
79class WebRtcVideoEncoderFactory;
80class WebRtcVideoMediaChannel;
81class WebRtcVoiceEngine;
82
83struct CapturedFrame;
84struct Device;
85
86class WebRtcVideoEngine : public sigslot::has_slots<>,
87 public webrtc::TraceCallback,
88 public WebRtcVideoEncoderFactory::Observer {
89 public:
90 // Creates the WebRtcVideoEngine with internal VideoCaptureModule.
91 WebRtcVideoEngine();
92 // For testing purposes. Allows the WebRtcVoiceEngine,
93 // ViEWrapper and CpuMonitor to be mocks.
94 // TODO(juberti): Remove the 3-arg ctor once fake tracing is implemented.
95 WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
96 ViEWrapper* vie_wrapper,
97 talk_base::CpuMonitor* cpu_monitor);
98 WebRtcVideoEngine(WebRtcVoiceEngine* voice_engine,
99 ViEWrapper* vie_wrapper,
100 ViETraceWrapper* tracing,
101 talk_base::CpuMonitor* cpu_monitor);
102 ~WebRtcVideoEngine();
103
104 // Basic video engine implementation.
105 bool Init(talk_base::Thread* worker_thread);
106 void Terminate();
107
108 int GetCapabilities();
mallinath@webrtc.orga27be8e2013-09-27 23:04:10 +0000109 bool SetOptions(const VideoOptions &options);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000110 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
wu@webrtc.org78187522013-10-07 23:32:02 +0000111 VideoEncoderConfig GetDefaultEncoderConfig() const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000112
113 WebRtcVideoMediaChannel* CreateChannel(VoiceMediaChannel* voice_channel);
114
115 const std::vector<VideoCodec>& codecs() const;
116 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
117 void SetLogging(int min_sev, const char* filter);
118
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000119 bool SetLocalRenderer(VideoRenderer* renderer);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120 sigslot::repeater2<VideoCapturer*, CaptureState> SignalCaptureStateChange;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000121
122 // Set the VoiceEngine for A/V sync. This can only be called before Init.
123 bool SetVoiceEngine(WebRtcVoiceEngine* voice_engine);
124 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does
125 // not take the ownership of |decoder_factory|. The caller needs to make sure
126 // that |decoder_factory| outlives the video engine.
127 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory);
128 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does
129 // not take the ownership of |encoder_factory|. The caller needs to make sure
130 // that |encoder_factory| outlives the video engine.
131 void SetExternalEncoderFactory(WebRtcVideoEncoderFactory* encoder_factory);
132 // Enable the render module with timing control.
133 bool EnableTimedRender();
134
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000135 // Returns an external decoder for the given codec type. The return value
136 // can be NULL if decoder factory is not given or it does not support the
137 // codec type. The caller takes the ownership of the returned object.
138 webrtc::VideoDecoder* CreateExternalDecoder(webrtc::VideoCodecType type);
139 // Releases the decoder instance created by CreateExternalDecoder().
140 void DestroyExternalDecoder(webrtc::VideoDecoder* decoder);
141
142 // Returns an external encoder for the given codec type. The return value
143 // can be NULL if encoder factory is not given or it does not support the
144 // codec type. The caller takes the ownership of the returned object.
145 webrtc::VideoEncoder* CreateExternalEncoder(webrtc::VideoCodecType type);
146 // Releases the encoder instance created by CreateExternalEncoder().
147 void DestroyExternalEncoder(webrtc::VideoEncoder* encoder);
148
149 // Returns true if the codec type is supported by the external encoder.
150 bool IsExternalEncoderCodecType(webrtc::VideoCodecType type) const;
151
152 // Functions called by WebRtcVideoMediaChannel.
153 talk_base::Thread* worker_thread() { return worker_thread_; }
154 ViEWrapper* vie() { return vie_wrapper_.get(); }
155 const VideoFormat& default_codec_format() const {
156 return default_codec_format_;
157 }
158 int GetLastEngineError();
159 bool FindCodec(const VideoCodec& in);
160 bool CanSendCodec(const VideoCodec& in, const VideoCodec& current,
161 VideoCodec* out);
162 void RegisterChannel(WebRtcVideoMediaChannel* channel);
163 void UnregisterChannel(WebRtcVideoMediaChannel* channel);
164 bool ConvertFromCricketVideoCodec(const VideoCodec& in_codec,
165 webrtc::VideoCodec* out_codec);
166 // Check whether the supplied trace should be ignored.
167 bool ShouldIgnoreTrace(const std::string& trace);
168 int GetNumOfChannels();
169
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000170 VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
171
172 talk_base::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
173
174 protected:
175 // When a video processor registers with the engine.
176 // SignalMediaFrame will be invoked for every video frame.
177 // See videoprocessor.h for param reference.
178 sigslot::signal3<uint32, VideoFrame*, bool*> SignalMediaFrame;
179
180 private:
181 typedef std::vector<WebRtcVideoMediaChannel*> VideoChannels;
182 struct VideoCodecPref {
183 const char* name;
184 int payload_type;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000185 // For RTX, this field is the payload-type that RTX applies to.
186 // For other codecs, it should be set to -1.
187 int associated_payload_type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000188 int pref;
189 };
190
191 static const VideoCodecPref kVideoCodecPrefs[];
192 static const VideoFormatPod kVideoFormats[];
193 static const VideoFormatPod kDefaultVideoFormat;
194
195 void Construct(ViEWrapper* vie_wrapper,
196 ViETraceWrapper* tracing,
197 WebRtcVoiceEngine* voice_engine,
198 talk_base::CpuMonitor* cpu_monitor);
199 bool SetDefaultCodec(const VideoCodec& codec);
200 bool RebuildCodecList(const VideoCodec& max_codec);
201 void SetTraceFilter(int filter);
202 void SetTraceOptions(const std::string& options);
203 bool InitVideoEngine();
buildbot@webrtc.orgdd4742a2014-05-07 14:50:35 +0000204 bool VerifyApt(const VideoCodec& in, int expected_apt) const;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000205
206 // webrtc::TraceCallback implementation.
207 virtual void Print(webrtc::TraceLevel level, const char* trace, int length);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000208
209 // WebRtcVideoEncoderFactory::Observer implementation.
210 virtual void OnCodecsAvailable();
211
212 talk_base::Thread* worker_thread_;
213 talk_base::scoped_ptr<ViEWrapper> vie_wrapper_;
214 bool vie_wrapper_base_initialized_;
215 talk_base::scoped_ptr<ViETraceWrapper> tracing_;
216 WebRtcVoiceEngine* voice_engine_;
217 talk_base::scoped_ptr<webrtc::VideoRender> render_module_;
218 WebRtcVideoEncoderFactory* encoder_factory_;
219 WebRtcVideoDecoderFactory* decoder_factory_;
220 std::vector<VideoCodec> video_codecs_;
221 std::vector<RtpHeaderExtension> rtp_header_extensions_;
222 VideoFormat default_codec_format_;
223
224 bool initialized_;
225 talk_base::CriticalSection channels_crit_;
226 VideoChannels channels_;
227
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000228 bool capture_started_;
229 int local_renderer_w_;
230 int local_renderer_h_;
231 VideoRenderer* local_renderer_;
232
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000233 talk_base::scoped_ptr<talk_base::CpuMonitor> cpu_monitor_;
234};
235
236class WebRtcVideoMediaChannel : public talk_base::MessageHandler,
237 public VideoMediaChannel,
238 public webrtc::Transport {
239 public:
240 WebRtcVideoMediaChannel(WebRtcVideoEngine* engine,
241 VoiceMediaChannel* voice_channel);
242 ~WebRtcVideoMediaChannel();
243 bool Init();
244
245 WebRtcVideoEngine* engine() { return engine_; }
246 VoiceMediaChannel* voice_channel() { return voice_channel_; }
247 int video_channel() const { return vie_channel_; }
248 bool sending() const { return sending_; }
249
henrike@webrtc.org6e3dbc22014-03-25 17:09:47 +0000250 // Public for testing purpose.
251 uint32 GetDefaultChannelSsrc();
252
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000253 // VideoMediaChannel implementation
254 virtual bool SetRecvCodecs(const std::vector<VideoCodec> &codecs);
255 virtual bool SetSendCodecs(const std::vector<VideoCodec> &codecs);
256 virtual bool GetSendCodec(VideoCodec* send_codec);
257 virtual bool SetSendStreamFormat(uint32 ssrc, const VideoFormat& format);
258 virtual bool SetRender(bool render);
259 virtual bool SetSend(bool send);
260
261 virtual bool AddSendStream(const StreamParams& sp);
262 virtual bool RemoveSendStream(uint32 ssrc);
263 virtual bool AddRecvStream(const StreamParams& sp);
264 virtual bool RemoveRecvStream(uint32 ssrc);
265 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer);
wu@webrtc.orgb9a088b2014-02-13 23:18:49 +0000266 virtual bool GetStats(const StatsOptions& options, VideoMediaInfo* info);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000267 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer);
268 virtual bool SendIntraFrame();
269 virtual bool RequestIntraFrame();
270
wu@webrtc.orga9890802013-12-13 00:21:03 +0000271 virtual void OnPacketReceived(talk_base::Buffer* packet,
272 const talk_base::PacketTime& packet_time);
273 virtual void OnRtcpReceived(talk_base::Buffer* packet,
274 const talk_base::PacketTime& packet_time);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000275 virtual void OnReadyToSend(bool ready);
276 virtual bool MuteStream(uint32 ssrc, bool on);
277 virtual bool SetRecvRtpHeaderExtensions(
278 const std::vector<RtpHeaderExtension>& extensions);
279 virtual bool SetSendRtpHeaderExtensions(
280 const std::vector<RtpHeaderExtension>& extensions);
mallinath@webrtc.org92fdfeb2014-02-17 18:49:41 +0000281 virtual int GetRtpSendTimeExtnId() const;
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54 +0000282 virtual bool SetStartSendBandwidth(int bps);
283 virtual bool SetMaxSendBandwidth(int bps);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000284 virtual bool SetOptions(const VideoOptions &options);
285 virtual bool GetOptions(VideoOptions *options) const {
286 *options = options_;
287 return true;
288 }
289 virtual void SetInterface(NetworkInterface* iface);
290 virtual void UpdateAspectRatio(int ratio_w, int ratio_h);
291
292 // Public functions for use by tests and other specialized code.
293 uint32 send_ssrc() const { return 0; }
294 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer);
mallinath@webrtc.org67ee6b92014-02-03 16:57:16 +0000295 bool GetVideoAdapter(uint32 ssrc, CoordinatedVideoAdapter** video_adapter);
wu@webrtc.orgf7d501d2014-03-27 23:48:25 +0000296 void SendFrame(VideoCapturer* capturer, const VideoFrame* frame);
297 bool SendFrame(WebRtcVideoChannelSendInfo* channel_info,
298 const VideoFrame* frame, bool is_screencast);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000299
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000300 // Thunk functions for use with HybridVideoEngine
301 void OnLocalFrame(VideoCapturer* capturer, const VideoFrame* frame) {
302 SendFrame(0u, frame, capturer->IsScreencast());
303 }
304 void OnLocalFrameFormat(VideoCapturer* capturer, const VideoFormat* format) {
305 }
306
307 virtual void OnMessage(talk_base::Message* msg);
308
309 protected:
310 int GetLastEngineError() { return engine()->GetLastEngineError(); }
311 virtual int SendPacket(int channel, const void* data, int len);
312 virtual int SendRTCPPacket(int channel, const void* data, int len);
313
314 private:
315 typedef std::map<uint32, WebRtcVideoChannelRecvInfo*> RecvChannelMap;
316 typedef std::map<uint32, WebRtcVideoChannelSendInfo*> SendChannelMap;
buildbot@webrtc.orgdd4742a2014-05-07 14:50:35 +0000317 typedef std::map<uint32, uint32> SsrcMap;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000318 typedef int (webrtc::ViERTP_RTCP::* ExtensionSetterFunction)(int, bool, int);
319
320 enum MediaDirection { MD_RECV, MD_SEND, MD_SENDRECV };
321
322 // Creates and initializes a ViE channel. When successful |channel_id| will
323 // contain the new channel's ID. If |receiving| is true |ssrc| is the
324 // remote ssrc. If |sending| is true the ssrc is local ssrc. If both
325 // |receiving| and |sending| is true the ssrc must be 0 and the channel will
326 // be created as a default channel. The ssrc must be different for receive
327 // channels and it must be different for send channels. If the same SSRC is
328 // being used for creating channel more than once, this function will fail
329 // returning false.
330 bool CreateChannel(uint32 ssrc_key, MediaDirection direction,
331 int* channel_id);
henrike@webrtc.org704bf9e2014-02-27 17:52:04 +0000332 bool CreateUnsignalledRecvChannel(uint32 ssrc_key, int* channel_id);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000333 bool ConfigureChannel(int channel_id, MediaDirection direction,
334 uint32 ssrc_key);
335 bool ConfigureReceiving(int channel_id, uint32 remote_ssrc_key);
336 bool ConfigureSending(int channel_id, uint32 local_ssrc_key);
337 bool SetNackFec(int channel_id, int red_payload_type, int fec_payload_type,
338 bool nack_enabled);
buildbot@webrtc.orgd1ae89f2014-05-08 19:19:26 +0000339 bool SetSendCodec(const webrtc::VideoCodec& codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000340 bool SetSendCodec(WebRtcVideoChannelSendInfo* send_channel,
buildbot@webrtc.orgd1ae89f2014-05-08 19:19:26 +0000341 const webrtc::VideoCodec& codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000342 void LogSendCodecChange(const std::string& reason);
343 // Prepares the channel with channel id |info->channel_id()| to receive all
344 // codecs in |receive_codecs_| and start receive packets.
345 bool SetReceiveCodecs(WebRtcVideoChannelRecvInfo* info);
346 // Returns the channel number that receives the stream with SSRC |ssrc|.
347 int GetRecvChannelNum(uint32 ssrc);
348 // Given captured video frame size, checks if we need to reset vie send codec.
349 // |reset| is set to whether resetting has happened on vie or not.
350 // Returns false on error.
351 bool MaybeResetVieSendCodec(WebRtcVideoChannelSendInfo* send_channel,
352 int new_width, int new_height, bool is_screencast,
353 bool* reset);
buildbot@webrtc.orgd1ae89f2014-05-08 19:19:26 +0000354 // Checks the current bitrate estimate and modifies the bitrates
355 // accordingly, including converting kAutoBandwidth to the correct defaults.
356 void MaybeChangeBitrates(int channel_id, webrtc::VideoCodec* video_codec);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000357 // Helper function for starting the sending of media on all channels or
358 // |channel_id|. Note that these two function do not change |sending_|.
359 bool StartSend();
360 bool StartSend(WebRtcVideoChannelSendInfo* send_channel);
361 // Helper function for stop the sending of media on all channels or
362 // |channel_id|. Note that these two function do not change |sending_|.
363 bool StopSend();
364 bool StopSend(WebRtcVideoChannelSendInfo* send_channel);
365 bool SendIntraFrame(int channel_id);
366
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000367 bool HasReadySendChannels();
368
369 // Send channel key returns the key corresponding to the provided local SSRC
370 // in |key|. The return value is true upon success.
371 // If the local ssrc correspond to that of the default channel the key is 0.
372 // For all other channels the returned key will be the same as the local ssrc.
373 bool GetSendChannelKey(uint32 local_ssrc, uint32* key);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000374 WebRtcVideoChannelSendInfo* GetSendChannel(uint32 local_ssrc);
375 // Creates a new unique key that can be used for inserting a new send channel
376 // into |send_channels_|
377 bool CreateSendChannelKey(uint32 local_ssrc, uint32* key);
wu@webrtc.org24301a62013-12-13 19:17:43 +0000378 // Get the number of the send channels |capturer| registered with.
379 int GetSendChannelNum(VideoCapturer* capturer);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000380
381 bool IsDefaultChannel(int channel_id) const {
382 return channel_id == vie_channel_;
383 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000384
385 bool DeleteSendChannel(uint32 ssrc_key);
386
387 bool InConferenceMode() const {
388 return options_.conference_mode.GetWithDefaultIfUnset(false);
389 }
390 bool RemoveCapturer(uint32 ssrc);
391
392
393 talk_base::MessageQueue* worker_thread() { return engine_->worker_thread(); }
394 void QueueBlackFrame(uint32 ssrc, int64 timestamp, int framerate);
395 void FlushBlackFrame(uint32 ssrc, int64 timestamp);
396
397 void SetNetworkTransmissionState(bool is_transmitting);
398
399 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
400 const RtpHeaderExtension* extension);
401 bool SetHeaderExtension(ExtensionSetterFunction setter, int channel_id,
402 const std::vector<RtpHeaderExtension>& extensions,
403 const char header_extension_uri[]);
404
wu@webrtc.orgd64719d2013-08-01 00:00:07 +0000405 // Signal when cpu adaptation has no further scope to adapt.
406 void OnCpuAdaptationUnable();
407
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000408 // Set the local (send-side) RTX SSRC corresponding to primary_ssrc.
409 bool SetLocalRtxSsrc(int channel_id, const StreamParams& send_params,
410 uint32 primary_ssrc, int stream_idx);
411
wu@webrtc.org24301a62013-12-13 19:17:43 +0000412 // Connect |capturer| to WebRtcVideoMediaChannel if it is only registered
413 // to one send channel, i.e. the first send channel.
414 void MaybeConnectCapturer(VideoCapturer* capturer);
415 // Disconnect |capturer| from WebRtcVideoMediaChannel if it is only registered
416 // to one send channel, i.e. the last send channel.
417 void MaybeDisconnectCapturer(VideoCapturer* capturer);
418
henrike@webrtc.org6e3dbc22014-03-25 17:09:47 +0000419 bool RemoveRecvStreamInternal(uint32 ssrc);
420
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000421 // Global state.
422 WebRtcVideoEngine* engine_;
423 VoiceMediaChannel* voice_channel_;
424 int vie_channel_;
425 bool nack_enabled_;
426 // Receiver Estimated Max Bitrate
427 bool remb_enabled_;
428 VideoOptions options_;
429
430 // Global recv side state.
431 // Note the default channel (vie_channel_), i.e. the send channel
432 // corresponding to all the receive channels (this must be done for REMB to
433 // work properly), resides in both recv_channels_ and send_channels_ with the
434 // ssrc key 0.
435 RecvChannelMap recv_channels_; // Contains all receive channels.
buildbot@webrtc.orgdd4742a2014-05-07 14:50:35 +0000436 // A map from the SSRCs on which RTX packets are received to the media SSRCs
437 // the RTX packets are associated with. RTX packets will be delivered to the
438 // streams matching the primary SSRC.
439 SsrcMap rtx_to_primary_ssrc_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000440 std::vector<webrtc::VideoCodec> receive_codecs_;
buildbot@webrtc.orgdd4742a2014-05-07 14:50:35 +0000441 // A map from codec payload types to their associated payload types, if any.
442 // TODO(holmer): This is a temporary solution until webrtc::VideoCodec has
443 // an associated payload type member, when it does we can rely on
444 // receive_codecs_.
445 std::map<int, int> associated_payload_types_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000446 bool render_started_;
447 uint32 first_receive_ssrc_;
448 std::vector<RtpHeaderExtension> receive_extensions_;
henrike@webrtc.org704bf9e2014-02-27 17:52:04 +0000449 int num_unsignalled_recv_channels_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000450
451 // Global send side state.
452 SendChannelMap send_channels_;
453 talk_base::scoped_ptr<webrtc::VideoCodec> send_codec_;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000454 int send_rtx_type_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000455 int send_red_type_;
456 int send_fec_type_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000457 bool sending_;
458 std::vector<RtpHeaderExtension> send_extensions_;
459
460 // The aspect ratio that the channel desires. 0 means there is no desired
461 // aspect ratio
462 int ratio_w_;
463 int ratio_h_;
464};
465
466} // namespace cricket
467
468#endif // TALK_MEDIA_WEBRTCVIDEOENGINE_H_