blob: d77afb9d2f41d2613949b81de440022fa8b25997 [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
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000164 bool FindCodec(const VideoCodec& in);
165 bool CanSendCodec(const VideoCodec& in,
166 const VideoCodec& current,
167 VideoCodec* out);
168 // Check whether the supplied trace should be ignored.
169 bool ShouldIgnoreTrace(const std::string& trace);
170
buildbot@webrtc.org992febb2014-09-05 16:39:08 +0000171 VideoFormat GetStartCaptureFormat() const { return default_codec_format_; }
172
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000173 rtc::CpuMonitor* cpu_monitor() { return cpu_monitor_.get(); }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000174
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000175 virtual WebRtcVideoEncoderFactory2* GetVideoEncoderFactory();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000176
177 private:
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000178 rtc::Thread* worker_thread_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000179 WebRtcVoiceEngine* voice_engine_;
180 std::vector<VideoCodec> video_codecs_;
181 std::vector<RtpHeaderExtension> rtp_header_extensions_;
buildbot@webrtc.org992febb2014-09-05 16:39:08 +0000182 VideoFormat default_codec_format_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000183
184 bool initialized_;
185
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000186 // Critical section to protect the media processor register/unregister
187 // while processing a frame
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000188 rtc::CriticalSection signal_media_critical_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000189
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000190 rtc::scoped_ptr<rtc::CpuMonitor> cpu_monitor_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000191 WebRtcVideoChannelFactory* channel_factory_;
buildbot@webrtc.orgd41eaeb2014-06-12 07:13:26 +0000192 WebRtcVideoEncoderFactory2 default_video_encoder_factory_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000193};
194
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000195class WebRtcVideoChannel2 : public rtc::MessageHandler,
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000196 public VideoMediaChannel,
197 public webrtc::newapi::Transport {
198 public:
199 WebRtcVideoChannel2(WebRtcVideoEngine2* engine,
200 VoiceMediaChannel* voice_channel,
201 WebRtcVideoEncoderFactory2* encoder_factory);
202 // For testing purposes insert a pre-constructed call to verify that
203 // WebRtcVideoChannel2 calls the correct corresponding methods.
204 WebRtcVideoChannel2(webrtc::Call* call,
205 WebRtcVideoEngine2* engine,
206 WebRtcVideoEncoderFactory2* encoder_factory);
207 ~WebRtcVideoChannel2();
208 bool Init();
209
210 // VideoMediaChannel implementation
211 virtual bool SetRecvCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
212 virtual bool SetSendCodecs(const std::vector<VideoCodec>& codecs) OVERRIDE;
213 virtual bool GetSendCodec(VideoCodec* send_codec) OVERRIDE;
214 virtual bool SetSendStreamFormat(uint32 ssrc,
215 const VideoFormat& format) OVERRIDE;
216 virtual bool SetRender(bool render) OVERRIDE;
217 virtual bool SetSend(bool send) OVERRIDE;
218
219 virtual bool AddSendStream(const StreamParams& sp) OVERRIDE;
220 virtual bool RemoveSendStream(uint32 ssrc) OVERRIDE;
221 virtual bool AddRecvStream(const StreamParams& sp) OVERRIDE;
222 virtual bool RemoveRecvStream(uint32 ssrc) OVERRIDE;
223 virtual bool SetRenderer(uint32 ssrc, VideoRenderer* renderer) OVERRIDE;
224 virtual bool GetStats(const StatsOptions& options,
225 VideoMediaInfo* info) OVERRIDE;
226 virtual bool SetCapturer(uint32 ssrc, VideoCapturer* capturer) OVERRIDE;
227 virtual bool SendIntraFrame() OVERRIDE;
228 virtual bool RequestIntraFrame() OVERRIDE;
229
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000230 virtual void OnPacketReceived(rtc::Buffer* packet,
231 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000232 OVERRIDE;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000233 virtual void OnRtcpReceived(rtc::Buffer* packet,
234 const rtc::PacketTime& packet_time)
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000235 OVERRIDE;
236 virtual void OnReadyToSend(bool ready) OVERRIDE;
237 virtual bool MuteStream(uint32 ssrc, bool mute) OVERRIDE;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000238
239 // Set send/receive RTP header extensions. This must be done before creating
240 // streams as it only has effect on future streams.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000241 virtual bool SetRecvRtpHeaderExtensions(
242 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
243 virtual bool SetSendRtpHeaderExtensions(
244 const std::vector<RtpHeaderExtension>& extensions) OVERRIDE;
245 virtual bool SetStartSendBandwidth(int bps) OVERRIDE;
246 virtual bool SetMaxSendBandwidth(int bps) OVERRIDE;
247 virtual bool SetOptions(const VideoOptions& options) OVERRIDE;
248 virtual bool GetOptions(VideoOptions* options) const OVERRIDE {
249 *options = options_;
250 return true;
251 }
252 virtual void SetInterface(NetworkInterface* iface) OVERRIDE;
253 virtual void UpdateAspectRatio(int ratio_w, int ratio_h) OVERRIDE;
254
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000255 virtual void OnMessage(rtc::Message* msg) OVERRIDE;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000256
257 // Implemented for VideoMediaChannelTest.
258 bool sending() const { return sending_; }
buildbot@webrtc.org2c0fb052014-08-13 16:47:12 +0000259 uint32 GetDefaultSendChannelSsrc() { return default_send_ssrc_; }
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000260 bool GetRenderer(uint32 ssrc, VideoRenderer** renderer);
261
262 private:
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000263 void ConfigureReceiverRtp(webrtc::VideoReceiveStream::Config* config,
264 const StreamParams& sp) const;
265
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000266 struct VideoCodecSettings {
267 VideoCodecSettings();
268
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000269 VideoCodec codec;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000270 webrtc::FecConfig fec;
271 int rtx_payload_type;
272 };
273
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000274 // Wrapper for the sender part, this is where the capturer is connected and
275 // frames are then converted from cricket frames to webrtc frames.
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000276 class WebRtcVideoSendStream : public sigslot::has_slots<> {
277 public:
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000278 WebRtcVideoSendStream(
279 webrtc::Call* call,
280 WebRtcVideoEncoderFactory2* encoder_factory,
281 const VideoOptions& options,
282 const Settable<VideoCodecSettings>& codec_settings,
283 const StreamParams& sp,
284 const std::vector<webrtc::RtpExtension>& rtp_extensions);
285
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000286 ~WebRtcVideoSendStream();
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000287 void SetOptions(const VideoOptions& options);
288 void SetCodec(const VideoCodecSettings& codec);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000289 void SetRtpExtensions(
290 const std::vector<webrtc::RtpExtension>& rtp_extensions);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000291
292 void InputFrame(VideoCapturer* capturer, const VideoFrame* frame);
293 bool SetCapturer(VideoCapturer* capturer);
294 bool SetVideoFormat(const VideoFormat& format);
pbos@webrtc.orgef8bb8d2014-08-13 21:36:18 +0000295 void MuteStream(bool mute);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000296 bool DisconnectCapturer();
297
298 void Start();
299 void Stop();
300
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000301 VideoSenderInfo GetVideoSenderInfo();
302
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000303 private:
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000304 // Parameters needed to reconstruct the underlying stream.
305 // webrtc::VideoSendStream doesn't support setting a lot of options on the
306 // fly, so when those need to be changed we tear down and reconstruct with
307 // similar parameters depending on which options changed etc.
308 struct VideoSendStreamParameters {
309 VideoSendStreamParameters(
310 const webrtc::VideoSendStream::Config& config,
311 const VideoOptions& options,
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000312 const Settable<VideoCodecSettings>& codec_settings);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000313 webrtc::VideoSendStream::Config config;
314 VideoOptions options;
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000315 Settable<VideoCodecSettings> codec_settings;
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000316 // Sent resolutions + bitrates etc. by the underlying VideoSendStream,
317 // typically changes when setting a new resolution or reconfiguring
318 // bitrates.
319 std::vector<webrtc::VideoStream> video_streams;
320 };
321
pbos@webrtc.org5301b0f2014-07-17 08:51:46 +0000322 void SetCodecAndOptions(const VideoCodecSettings& codec,
323 const VideoOptions& options);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000324 void RecreateWebRtcStream();
pbos@webrtc.orgc4175b92014-09-03 15:25:49 +0000325 // When |override_max| is false constrain width/height to codec dimensions.
326 void SetDimensions(int width, int height, bool override_max);
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000327
328 webrtc::Call* const call_;
329 WebRtcVideoEncoderFactory2* const encoder_factory_;
330
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000331 rtc::CriticalSection lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000332 webrtc::VideoSendStream* stream_ GUARDED_BY(lock_);
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +0000333 VideoSendStreamParameters parameters_ GUARDED_BY(lock_);
334
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000335 VideoCapturer* capturer_ GUARDED_BY(lock_);
336 bool sending_ GUARDED_BY(lock_);
337 bool muted_ GUARDED_BY(lock_);
338 VideoFormat format_ GUARDED_BY(lock_);
339
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000340 rtc::CriticalSection frame_lock_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000341 webrtc::I420VideoFrame video_frame_ GUARDED_BY(frame_lock_);
342 };
343
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000344 // Wrapper for the receiver part, contains configs etc. that are needed to
345 // reconstruct the underlying VideoReceiveStream. Also serves as a wrapper
346 // between webrtc::VideoRenderer and cricket::VideoRenderer.
347 class WebRtcVideoReceiveStream : public webrtc::VideoRenderer {
348 public:
349 WebRtcVideoReceiveStream(
350 webrtc::Call*,
351 const webrtc::VideoReceiveStream::Config& config,
352 const std::vector<VideoCodecSettings>& recv_codecs);
353 ~WebRtcVideoReceiveStream();
354
355 void SetRecvCodecs(const std::vector<VideoCodecSettings>& recv_codecs);
356 void SetRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
357
358 virtual void RenderFrame(const webrtc::I420VideoFrame& frame,
359 int time_to_render_ms) OVERRIDE;
360
361 void SetRenderer(cricket::VideoRenderer* renderer);
362 cricket::VideoRenderer* GetRenderer();
363
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000364 VideoReceiverInfo GetVideoReceiverInfo();
365
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000366 private:
367 void SetSize(int width, int height);
368 void RecreateWebRtcStream();
369
370 webrtc::Call* const call_;
371
372 webrtc::VideoReceiveStream* stream_;
373 webrtc::VideoReceiveStream::Config config_;
374
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000375 rtc::CriticalSection renderer_lock_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000376 cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000377 int last_width_ GUARDED_BY(renderer_lock_);
378 int last_height_ GUARDED_BY(renderer_lock_);
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000379 };
380
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000381 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine);
pbos@webrtc.org6f48f1b2014-07-22 16:29:54 +0000382 void SetDefaultOptions();
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000383
384 virtual bool SendRtp(const uint8_t* data, size_t len) OVERRIDE;
385 virtual bool SendRtcp(const uint8_t* data, size_t len) OVERRIDE;
386
387 void StartAllSendStreams();
388 void StopAllSendStreams();
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000389
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000390 static std::vector<VideoCodecSettings> MapCodecs(
391 const std::vector<VideoCodec>& codecs);
392 std::vector<VideoCodecSettings> FilterSupportedCodecs(
393 const std::vector<VideoCodecSettings>& mapped_codecs);
394
pbos@webrtc.orge6f84ae2014-07-18 11:11:55 +0000395 void FillSenderStats(VideoMediaInfo* info);
396 void FillReceiverStats(VideoMediaInfo* info);
397 void FillBandwidthEstimationStats(VideoMediaInfo* info);
398
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000399 uint32_t rtcp_receiver_report_ssrc_;
400 bool sending_;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000401 rtc::scoped_ptr<webrtc::Call> call_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000402 uint32_t default_send_ssrc_;
pbos@webrtc.orgafb554f42014-08-12 23:17:13 +0000403
404 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
405 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000406
407 // Using primary-ssrc (first ssrc) as key.
408 std::map<uint32, WebRtcVideoSendStream*> send_streams_;
pbos@webrtc.orgd1ea06b2014-07-18 09:35:58 +0000409 std::map<uint32, WebRtcVideoReceiveStream*> receive_streams_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000410
411 Settable<VideoCodecSettings> send_codec_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000412 std::vector<webrtc::RtpExtension> send_rtp_extensions_;
413
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000414 WebRtcVideoEncoderFactory2* const encoder_factory_;
415 std::vector<VideoCodecSettings> recv_codecs_;
pbos@webrtc.org587ef602014-06-16 17:32:02 +0000416 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
pbos@webrtc.orgb5a22b12014-05-13 11:07:01 +0000417 VideoOptions options_;
418};
419
420} // namespace cricket
421
422#endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_