blob: c961bd52f74a005412c7c950393c9f7fad8508ce [file] [log] [blame]
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +00001/*
2 * libjingle
3 * Copyright 2014 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_WEBRTC_WEBRTCVIDEOENGINE2_H_
29#define TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_
30
31#include <map>
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000032#include <string>
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000033#include <vector>
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000034
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000035#include "talk/media/base/mediaengine.h"
36#include "talk/media/webrtc/webrtcvideochannelfactory.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000037#include "webrtc/base/cpumonitor.h"
38#include "webrtc/base/scoped_ptr.h"
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000039#include "webrtc/common_video/interface/i420_video_frame.h"
40#include "webrtc/system_wrappers/interface/thread_annotations.h"
41#include "webrtc/transport.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000042#include "webrtc/video_receive_stream.h"
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000043#include "webrtc/video_renderer.h"
44#include "webrtc/video_send_stream.h"
45
46namespace webrtc {
47class Call;
48class VideoCaptureModule;
49class VideoDecoder;
50class VideoEncoder;
51class VideoRender;
52class VideoSendStreamInput;
53class VideoReceiveStream;
54}
55
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000056namespace rtc {
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000057class CpuMonitor;
58class Thread;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000059} // namespace rtc
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000060
61namespace cricket {
62
63class VideoCapturer;
64class VideoFrame;
65class VideoProcessor;
66class VideoRenderer;
67class VoiceMediaChannel;
68class WebRtcVideoChannel2;
69class WebRtcDecoderObserver;
70class WebRtcEncoderObserver;
71class WebRtcLocalStreamInfo;
72class WebRtcRenderAdapter;
73class WebRtcVideoChannelRecvInfo;
74class WebRtcVideoChannelSendInfo;
75class WebRtcVideoDecoderFactory;
76class WebRtcVoiceEngine;
77
78struct CapturedFrame;
79struct Device;
80
81class WebRtcVideoEngine2;
82class WebRtcVideoChannel2;
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +000083class WebRtcVideoRenderer;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +000084
pbos@webrtc.orgafb554f42014-08-12 23:17:13 +000085class UnsignalledSsrcHandler {
86 public:
87 enum Action {
88 kDropPacket,
89 kDeliverPacket,
90 };
91 virtual Action OnUnsignalledSsrc(VideoMediaChannel* engine,
92 uint32_t ssrc) = 0;
93};
94
95// TODO(pbos): Remove, use external handlers only.
96class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler {
97 public:
98 DefaultUnsignalledSsrcHandler();
99 virtual Action OnUnsignalledSsrc(VideoMediaChannel* engine,
100 uint32_t ssrc) OVERRIDE;
101
102 VideoRenderer* GetDefaultRenderer() const;
103 void SetDefaultRenderer(VideoMediaChannel* channel, VideoRenderer* renderer);
104
105 private:
106 uint32_t default_recv_ssrc_;
107 VideoRenderer* default_renderer_;
108};
109
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000110class WebRtcVideoEncoderFactory2 {
111 public:
pbos@webrtc.org0d523ee2014-06-05 09:10:55 +0000112 virtual ~WebRtcVideoEncoderFactory2();
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000113 virtual std::vector<webrtc::VideoStream> CreateVideoStreams(
114 const VideoCodec& codec,
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000115 const VideoOptions& options,
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000116 size_t num_streams);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000117
118 virtual webrtc::VideoEncoder* CreateVideoEncoder(
119 const VideoCodec& codec,
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000120 const VideoOptions& options);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000121
pbos@webrtc.org6f48f1b2014-07-22 16:29:54 +0000122 virtual void* CreateVideoEncoderSettings(
123 const VideoCodec& codec,
124 const VideoOptions& options);
125
126 virtual void DestroyVideoEncoderSettings(const VideoCodec& codec,
127 void* encoder_settings);
128
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000129 virtual bool SupportsCodec(const cricket::VideoCodec& codec);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000130};
131
132// WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
133class WebRtcVideoEngine2 : public sigslot::has_slots<> {
134 public:
135 // Creates the WebRtcVideoEngine2 with internal VideoCaptureModule.
136 WebRtcVideoEngine2();
pbos@webrtc.orgb648b9d2014-08-26 11:08:06 +0000137 virtual ~WebRtcVideoEngine2();
138
139 // Use a custom WebRtcVideoChannelFactory (for testing purposes).
140 void SetChannelFactory(WebRtcVideoChannelFactory* channel_factory);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000141
142 // Basic video engine implementation.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000143 bool Init(rtc::Thread* worker_thread);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000144 void Terminate();
145
146 int GetCapabilities();
147 bool SetOptions(const VideoOptions& options);
148 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
149 VideoEncoderConfig GetDefaultEncoderConfig() const;
150
151 WebRtcVideoChannel2* CreateChannel(VoiceMediaChannel* voice_channel);
152
153 const std::vector<VideoCodec>& codecs() const;
154 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
155 void SetLogging(int min_sev, const char* filter);
156
157 bool EnableTimedRender();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000158 // This is currently ignored.
159 sigslot::repeater2<VideoCapturer*, CaptureState> SignalCaptureStateChange;
160
161 // Set the VoiceEngine for A/V sync. This can only be called before Init.
162 bool SetVoiceEngine(WebRtcVoiceEngine* voice_engine);
163
164 // Functions called by WebRtcVideoChannel2.
165 const VideoFormat& default_codec_format() const {
166 return default_codec_format_;
167 }
168
169 bool FindCodec(const VideoCodec& in);
170 bool CanSendCodec(const VideoCodec& in,
171 const VideoCodec& current,
172 VideoCodec* out);
173 // Check whether the supplied trace should be ignored.
174 bool ShouldIgnoreTrace(const std::string& trace);
175
176 VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
177
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000178 rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000179
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000180 virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000181
182 private:
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000183 rtc::Thread* worker_thread_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000184 WebRtcVoiceEngine* voice_engine_;
185 std::vector<VideoCodec> video_codecs_;
186 std::vector<RtpHeaderExtension> rtp_header_extensions_;
187 VideoFormat default_codec_format_;
188
189 bool initialized_;
190
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000191 // Critical section to protect the media processor register/unregister
192 // while processing a frame
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000193 rtc::CriticalSection signal_media_critical_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000194
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000195 rtc::scoped_ptr<rtc::CpuMonitor> cpu_monitor_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000196 WebRtcVideoChannelFactory* channel_factory_;
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000197 WebRtcVideoEncoderFactory2 default_video_encoder_factory_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000198};
199
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000200class WebRtcVideoChannel2 : public rtc::MessageHandler,
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000201 public VideoMediaChannel,
202 public webrtc::newapi::Transport {
203 public:
204 WebRtcVideoChannel2(WebRtcVideoEngine2* engine,
205 VoiceMediaChannel* voice_channel,
206 WebRtcVideoEncoderFactory2* encoder_factory);
207 // For testing purposes insert a pre-constructed call to verify that
208 // WebRtcVideoChannel2 calls the correct corresponding methods.
209 WebRtcVideoChannel2(webrtc::Call* call,
210 WebRtcVideoEngine2* engine,
211 WebRtcVideoEncoderFactory2* encoder_factory);
212 ~WebRtcVideoChannel2();
213 bool Init();
214
215 // VideoMediaChannel implementation
216 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
217 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
218 virtual bool GetSendCodec(VideoCodec* send_codec) OVERRIDE;
219 virtual bool SetSendStreamFormat(uint32 ssrc,
220 const VideoFormat& format) OVERRIDE;
221 virtual bool SetRender(bool render) OVERRIDE;
222 virtual bool SetSend(bool send) OVERRIDE;
223
224 virtual bool AddSendStream(const StreamParams& sp) OVERRIDE;
225 virtual bool RemoveSendStream(uint32 ssrc) OVERRIDE;
226 virtual bool AddRecvStream(const StreamParams& sp) OVERRIDE;
227 virtual bool RemoveRecvStream(uint32 ssrc) OVERRIDE;
228 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) OVERRIDE;
229 virtual bool GetStats(const StatsOptions& options,
230 VideoMediaInfo* info) OVERRIDE;
231 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) OVERRIDE;
232 virtual bool SendIntraFrame() OVERRIDE;
233 virtual bool RequestIntraFrame() OVERRIDE;
234
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000235 virtual void OnPacketReceived(rtc::Buffer* packet,
236 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000237 OVERRIDE;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000238 virtual void OnRtcpReceived(rtc::Buffer* packet,
239 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000240 OVERRIDE;
241 virtual void OnReadyToSend(bool ready) OVERRIDE;
242 virtual bool MuteStream(uint32 ssrc, bool mute) OVERRIDE;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000243
244 // Set send/receive RTP header extensions. This must be done before creating
245 // streams as it only has effect on future streams.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000246 virtual bool SetRecvRtpHeaderExtensions(
247 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
248 virtual bool SetSendRtpHeaderExtensions(
249 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
250 virtual bool SetStartSendBandwidth(int bps) OVERRIDE;
251 virtual bool SetMaxSendBandwidth(int bps) OVERRIDE;
252 virtual bool SetOptions(const VideoOptions& options) OVERRIDE;
253 virtual bool GetOptions(VideoOptions* options) const OVERRIDE {
254 *options = options_;
255 return true;
256 }
257 virtual void SetInterface(NetworkInterface* iface) OVERRIDE;
258 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE;
259
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000260 virtual void OnMessage(rtc::Message* msg) OVERRIDE;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000261
262 // Implemented for VideoMediaChannelTest.
263 bool sending() const { return sending_; }
buildbot@webrtc.org2c0fb052014-08-13 16:47:12 +0000264 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000265 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer);
266
267 private:
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000268 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config,
269 const StreamParams& sp) const;
270
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000271 struct VideoCodecSettings {
272 VideoCodecSettings();
273
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000274 VideoCodec codec;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000275 webrtc::FecConfig fec;
276 int rtx_payload_type;
277 };
278
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000279 // Wrapper for the sender part, this is where the capturer is connected and
280 // frames are then converted from cricket frames to webrtc frames.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000281 class WebRtcVideoSendStream : public sigslot::has_slots<> {
282 public:
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000283 WebRtcVideoSendStream(
284 webrtc::Call* call,
285 WebRtcVideoEncoderFactory2* encoder_factory,
286 const VideoOptions& options,
287 const Settable<VideoCodecSettings>& codec_settings,
288 const StreamParams& sp,
289 const std::vector<webrtc::RtpExtension>& rtp_extensions);
290
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000291 ~WebRtcVideoSendStream();
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000292 void SetOptions(const VideoOptions& options);
293 void SetCodec(const VideoCodecSettings& codec);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000294 void SetRtpExtensions(
295 const std::vector<webrtc::RtpExtension>& rtp_extensions);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000296
297 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame);
298 bool SetCapturer(VideoCapturer* capturer);
299 bool SetVideoFormat(const VideoFormat& format);
pbos@webrtc.orgef8bb8d2014-08-13 21:36:18 +0000300 void MuteStream(bool mute);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000301 bool DisconnectCapturer();
302
303 void Start();
304 void Stop();
305
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000306 VideoSenderInfo GetVideoSenderInfo();
307
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000308 private:
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000309 // Parameters needed to reconstruct the underlying stream.
310 // webrtc::VideoSendStream doesn't support setting a lot of options on the
311 // fly, so when those need to be changed we tear down and reconstruct with
312 // similar parameters depending on which options changed etc.
313 struct VideoSendStreamParameters {
314 VideoSendStreamParameters(
315 const webrtc::VideoSendStream::Config& config,
316 const VideoOptions& options,
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000317 const Settable<VideoCodecSettings>& codec_settings);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000318 webrtc::VideoSendStream::Config config;
319 VideoOptions options;
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000320 Settable<VideoCodecSettings> codec_settings;
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000321 // Sent resolutions + bitrates etc. by the underlying VideoSendStream,
322 // typically changes when setting a new resolution or reconfiguring
323 // bitrates.
324 std::vector<webrtc::VideoStream> video_streams;
325 };
326
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000327 void SetCodecAndOptions(const VideoCodecSettings& codec,
328 const VideoOptions& options);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000329 void RecreateWebRtcStream();
330 void SetDimensions(int width, int height);
331
332 webrtc::Call* const call_;
333 WebRtcVideoEncoderFactory2* const encoder_factory_;
334
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000335 rtc::CriticalSection lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000336 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000337 VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
338
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000339 VideoCapturer* capturer_ GUARDED_BY(lock_);
340 bool sending_ GUARDED_BY(lock_);
341 bool muted_ GUARDED_BY(lock_);
342 VideoFormat format_ GUARDED_BY(lock_);
343
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000344 rtc::CriticalSection frame_lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000345 webrtc::I420VideoFrame video_frame_ GUARDED_BY(frame_lock_);
346 };
347
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000348 // Wrapper for the receiver part, contains configs etc. that are needed to
349 // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper
350 // between webrtc::VideoRenderer and cricket::VideoRenderer.
351 class WebRtcVideoReceiveStream : public webrtc::VideoRenderer {
352 public:
353 WebRtcVideoReceiveStream(
354 webrtc::Call*,
355 const webrtc::VideoReceiveStream::Config& config,
356 const std::vector<VideoCodecSettings>& recv_codecs);
357 ~WebRtcVideoReceiveStream();
358
359 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs);
360 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
361
362 virtual void RenderFrame(const webrtc::I420VideoFrame& frame,
363 int time_to_render_ms) OVERRIDE;
364
365 void SetRenderer(cricket::VideoRenderer* renderer);
366 cricket::VideoRenderer* GetRenderer();
367
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000368 VideoReceiverInfo GetVideoReceiverInfo();
369
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000370 private:
371 void SetSize(int width, int height);
372 void RecreateWebRtcStream();
373
374 webrtc::Call* const call_;
375
376 webrtc::VideoReceiveStream* stream_;
377 webrtc::VideoReceiveStream::Config config_;
378
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000379 rtc::CriticalSection renderer_lock_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000380 cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000381 int last_width_ GUARDED_BY(renderer_lock_);
382 int last_height_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000383 };
384
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000385 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine);
pbos@webrtc.org6f48f1b2014-07-22 16:29:54 +0000386 void SetDefaultOptions();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000387
388 virtual bool SendRtp(const uint8_t* data, size_t len) OVERRIDE;
389 virtual bool SendRtcp(const uint8_t* data, size_t len) OVERRIDE;
390
391 void StartAllSendStreams();
392 void StopAllSendStreams();
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000393
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000394 static std::vector<VideoCodecSettings> MapCodecs(
395 const std::vector<VideoCodec>& codecs);
396 std::vector<VideoCodecSettings> FilterSupportedCodecs(
397 const std::vector<VideoCodecSettings>& mapped_codecs);
398
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000399 void FillSenderStats(VideoMediaInfo* info);
400 void FillReceiverStats(VideoMediaInfo* info);
401 void FillBandwidthEstimationStats(VideoMediaInfo* info);
402
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000403 uint32_t rtcp_receiver_report_ssrc_;
404 bool sending_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000405 rtc::scoped_ptr<webrtc::Call> call_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000406 uint32_t default_send_ssrc_;
pbos@webrtc.orgafb554f42014-08-12 23:17:13 +0000407
408 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
409 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000410
411 // Using primary-ssrc (first ssrc) as key.
412 std::map<uint32, WebRtcVideoSendStream*> send_streams_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000413 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000414
415 Settable<VideoCodecSettings> send_codec_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000416 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
417
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000418 WebRtcVideoEncoderFactory2* const encoder_factory_;
419 std::vector<VideoCodecSettings> recv_codecs_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000420 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000421 VideoOptions options_;
422};
423
424} // namespace cricket
425
426#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_