blob: c7eb6a483ad44b3a97ae48773c315f89981c75e6 [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();
137 // Custom WebRtcVideoChannelFactory for testing purposes.
138 explicit WebRtcVideoEngine2(WebRtcVideoChannelFactory* channel_factory);
139 ~WebRtcVideoEngine2();
140
141 // Basic video engine implementation.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000142 bool Init(rtc::Thread* worker_thread);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000143 void Terminate();
144
145 int GetCapabilities();
146 bool SetOptions(const VideoOptions& options);
147 bool SetDefaultEncoderConfig(const VideoEncoderConfig& config);
148 VideoEncoderConfig GetDefaultEncoderConfig() const;
149
150 WebRtcVideoChannel2* CreateChannel(VoiceMediaChannel* voice_channel);
151
152 const std::vector<VideoCodec>& codecs() const;
153 const std::vector<RtpHeaderExtension>& rtp_header_extensions() const;
154 void SetLogging(int min_sev, const char* filter);
155
156 bool EnableTimedRender();
157 // No-op, never used.
158 bool SetLocalRenderer(VideoRenderer* renderer);
159 // This is currently ignored.
160 sigslot::repeater2<VideoCapturer*, CaptureState> SignalCaptureStateChange;
161
162 // Set the VoiceEngine for A/V sync. This can only be called before Init.
163 bool SetVoiceEngine(WebRtcVoiceEngine* voice_engine);
164
165 // Functions called by WebRtcVideoChannel2.
166 const VideoFormat& default_codec_format() const {
167 return default_codec_format_;
168 }
169
170 bool FindCodec(const VideoCodec& in);
171 bool CanSendCodec(const VideoCodec& in,
172 const VideoCodec& current,
173 VideoCodec* out);
174 // Check whether the supplied trace should be ignored.
175 bool ShouldIgnoreTrace(const std::string& trace);
176
177 VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
178
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000179 rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000180
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000181 virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000182
183 private:
184 void Construct(WebRtcVideoChannelFactory* channel_factory,
185 WebRtcVoiceEngine* voice_engine,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000186 rtc::CpuMonitor* cpu_monitor);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000187
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000188 rtc::Thread* worker_thread_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000189 WebRtcVoiceEngine* voice_engine_;
190 std::vector<VideoCodec> video_codecs_;
191 std::vector<RtpHeaderExtension> rtp_header_extensions_;
192 VideoFormat default_codec_format_;
193
194 bool initialized_;
195
196 bool capture_started_;
197
198 // Critical section to protect the media processor register/unregister
199 // while processing a frame
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000200 rtc::CriticalSection signal_media_critical_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000201
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000202 rtc::scoped_ptr<rtc::CpuMonitor> cpu_monitor_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000203 WebRtcVideoChannelFactory* channel_factory_;
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000204 WebRtcVideoEncoderFactory2 default_video_encoder_factory_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000205};
206
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000207class WebRtcVideoChannel2 : public rtc::MessageHandler,
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000208 public VideoMediaChannel,
209 public webrtc::newapi::Transport {
210 public:
211 WebRtcVideoChannel2(WebRtcVideoEngine2* engine,
212 VoiceMediaChannel* voice_channel,
213 WebRtcVideoEncoderFactory2* encoder_factory);
214 // For testing purposes insert a pre-constructed call to verify that
215 // WebRtcVideoChannel2 calls the correct corresponding methods.
216 WebRtcVideoChannel2(webrtc::Call* call,
217 WebRtcVideoEngine2* engine,
218 WebRtcVideoEncoderFactory2* encoder_factory);
219 ~WebRtcVideoChannel2();
220 bool Init();
221
222 // VideoMediaChannel implementation
223 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
224 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
225 virtual bool GetSendCodec(VideoCodec* send_codec) OVERRIDE;
226 virtual bool SetSendStreamFormat(uint32 ssrc,
227 const VideoFormat& format) OVERRIDE;
228 virtual bool SetRender(bool render) OVERRIDE;
229 virtual bool SetSend(bool send) OVERRIDE;
230
231 virtual bool AddSendStream(const StreamParams& sp) OVERRIDE;
232 virtual bool RemoveSendStream(uint32 ssrc) OVERRIDE;
233 virtual bool AddRecvStream(const StreamParams& sp) OVERRIDE;
234 virtual bool RemoveRecvStream(uint32 ssrc) OVERRIDE;
235 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) OVERRIDE;
236 virtual bool GetStats(const StatsOptions& options,
237 VideoMediaInfo* info) OVERRIDE;
238 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) OVERRIDE;
239 virtual bool SendIntraFrame() OVERRIDE;
240 virtual bool RequestIntraFrame() OVERRIDE;
241
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000242 virtual void OnPacketReceived(rtc::Buffer* packet,
243 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000244 OVERRIDE;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000245 virtual void OnRtcpReceived(rtc::Buffer* packet,
246 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000247 OVERRIDE;
248 virtual void OnReadyToSend(bool ready) OVERRIDE;
249 virtual bool MuteStream(uint32 ssrc, bool mute) OVERRIDE;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000250
251 // Set send/receive RTP header extensions. This must be done before creating
252 // streams as it only has effect on future streams.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000253 virtual bool SetRecvRtpHeaderExtensions(
254 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
255 virtual bool SetSendRtpHeaderExtensions(
256 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
257 virtual bool SetStartSendBandwidth(int bps) OVERRIDE;
258 virtual bool SetMaxSendBandwidth(int bps) OVERRIDE;
259 virtual bool SetOptions(const VideoOptions& options) OVERRIDE;
260 virtual bool GetOptions(VideoOptions* options) const OVERRIDE {
261 *options = options_;
262 return true;
263 }
264 virtual void SetInterface(NetworkInterface* iface) OVERRIDE;
265 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE;
266
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000267 virtual void OnMessage(rtc::Message* msg) OVERRIDE;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000268
269 // Implemented for VideoMediaChannelTest.
270 bool sending() const { return sending_; }
buildbot@webrtc.org2c0fb052014-08-13 16:47:12 +0000271 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000272 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer);
273
274 private:
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000275 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config,
276 const StreamParams& sp) const;
277
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000278 struct VideoCodecSettings {
279 VideoCodecSettings();
280
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000281 VideoCodec codec;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000282 webrtc::FecConfig fec;
283 int rtx_payload_type;
284 };
285
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000286 // Wrapper for the sender part, this is where the capturer is connected and
287 // frames are then converted from cricket frames to webrtc frames.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000288 class WebRtcVideoSendStream : public sigslot::has_slots<> {
289 public:
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000290 WebRtcVideoSendStream(
291 webrtc::Call* call,
292 WebRtcVideoEncoderFactory2* encoder_factory,
293 const VideoOptions& options,
294 const Settable<VideoCodecSettings>& codec_settings,
295 const StreamParams& sp,
296 const std::vector<webrtc::RtpExtension>& rtp_extensions);
297
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000298 ~WebRtcVideoSendStream();
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000299 void SetOptions(const VideoOptions& options);
300 void SetCodec(const VideoCodecSettings& codec);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000301 void SetRtpExtensions(
302 const std::vector<webrtc::RtpExtension>& rtp_extensions);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000303
304 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame);
305 bool SetCapturer(VideoCapturer* capturer);
306 bool SetVideoFormat(const VideoFormat& format);
pbos@webrtc.orgef8bb8d2014-08-13 21:36:18 +0000307 void MuteStream(bool mute);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000308 bool DisconnectCapturer();
309
310 void Start();
311 void Stop();
312
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000313 VideoSenderInfo GetVideoSenderInfo();
314
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000315 private:
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000316 // Parameters needed to reconstruct the underlying stream.
317 // webrtc::VideoSendStream doesn't support setting a lot of options on the
318 // fly, so when those need to be changed we tear down and reconstruct with
319 // similar parameters depending on which options changed etc.
320 struct VideoSendStreamParameters {
321 VideoSendStreamParameters(
322 const webrtc::VideoSendStream::Config& config,
323 const VideoOptions& options,
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000324 const Settable<VideoCodecSettings>& codec_settings);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000325 webrtc::VideoSendStream::Config config;
326 VideoOptions options;
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000327 Settable<VideoCodecSettings> codec_settings;
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000328 // Sent resolutions + bitrates etc. by the underlying VideoSendStream,
329 // typically changes when setting a new resolution or reconfiguring
330 // bitrates.
331 std::vector<webrtc::VideoStream> video_streams;
332 };
333
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000334 void SetCodecAndOptions(const VideoCodecSettings& codec,
335 const VideoOptions& options);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000336 void RecreateWebRtcStream();
337 void SetDimensions(int width, int height);
338
339 webrtc::Call* const call_;
340 WebRtcVideoEncoderFactory2* const encoder_factory_;
341
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000342 rtc::CriticalSection lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000343 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000344 VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
345
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000346 VideoCapturer* capturer_ GUARDED_BY(lock_);
347 bool sending_ GUARDED_BY(lock_);
348 bool muted_ GUARDED_BY(lock_);
349 VideoFormat format_ GUARDED_BY(lock_);
350
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000351 rtc::CriticalSection frame_lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000352 webrtc::I420VideoFrame video_frame_ GUARDED_BY(frame_lock_);
353 };
354
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000355 // Wrapper for the receiver part, contains configs etc. that are needed to
356 // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper
357 // between webrtc::VideoRenderer and cricket::VideoRenderer.
358 class WebRtcVideoReceiveStream : public webrtc::VideoRenderer {
359 public:
360 WebRtcVideoReceiveStream(
361 webrtc::Call*,
362 const webrtc::VideoReceiveStream::Config& config,
363 const std::vector<VideoCodecSettings>& recv_codecs);
364 ~WebRtcVideoReceiveStream();
365
366 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs);
367 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
368
369 virtual void RenderFrame(const webrtc::I420VideoFrame& frame,
370 int time_to_render_ms) OVERRIDE;
371
372 void SetRenderer(cricket::VideoRenderer* renderer);
373 cricket::VideoRenderer* GetRenderer();
374
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000375 VideoReceiverInfo GetVideoReceiverInfo();
376
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000377 private:
378 void SetSize(int width, int height);
379 void RecreateWebRtcStream();
380
381 webrtc::Call* const call_;
382
383 webrtc::VideoReceiveStream* stream_;
384 webrtc::VideoReceiveStream::Config config_;
385
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000386 rtc::CriticalSection renderer_lock_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000387 cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000388 int last_width_ GUARDED_BY(renderer_lock_);
389 int last_height_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000390 };
391
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000392 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine);
pbos@webrtc.org6f48f1b2014-07-22 16:29:54 +0000393 void SetDefaultOptions();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000394
395 virtual bool SendRtp(const uint8_t* data, size_t len) OVERRIDE;
396 virtual bool SendRtcp(const uint8_t* data, size_t len) OVERRIDE;
397
398 void StartAllSendStreams();
399 void StopAllSendStreams();
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000400
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000401 static std::vector<VideoCodecSettings> MapCodecs(
402 const std::vector<VideoCodec>& codecs);
403 std::vector<VideoCodecSettings> FilterSupportedCodecs(
404 const std::vector<VideoCodecSettings>& mapped_codecs);
405
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000406 void FillSenderStats(VideoMediaInfo* info);
407 void FillReceiverStats(VideoMediaInfo* info);
408 void FillBandwidthEstimationStats(VideoMediaInfo* info);
409
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000410 uint32_t rtcp_receiver_report_ssrc_;
411 bool sending_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000412 rtc::scoped_ptr<webrtc::Call> call_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000413 uint32_t default_send_ssrc_;
pbos@webrtc.orgafb554f42014-08-12 23:17:13 +0000414
415 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
416 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000417
418 // Using primary-ssrc (first ssrc) as key.
419 std::map<uint32, WebRtcVideoSendStream*> send_streams_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000420 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000421
422 Settable<VideoCodecSettings> send_codec_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000423 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
424
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000425 WebRtcVideoEncoderFactory2* const encoder_factory_;
426 std::vector<VideoCodecSettings> recv_codecs_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000427 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000428 VideoOptions options_;
429};
430
431} // namespace cricket
432
433#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_