blob: 8f7a7904410599a9463ef23b94399181233656c0 [file] [log] [blame]
eladalonf1841382017-06-12 01:16:46 -07001/*
2 * Copyright (c) 2014 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_MEDIA_ENGINE_WEBRTCVIDEOENGINE_H_
12#define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE_H_
13
14#include <map>
15#include <memory>
16#include <set>
17#include <string>
18#include <vector>
19
20#include "webrtc/api/call/transport.h"
21#include "webrtc/api/video/video_frame.h"
eladalonf1841382017-06-12 01:16:46 -070022#include "webrtc/call/call.h"
23#include "webrtc/call/flexfec_receive_stream.h"
aleloi440b6d92017-08-22 05:43:23 -070024#include "webrtc/call/video_receive_stream.h"
25#include "webrtc/call/video_send_stream.h"
eladalonf1841382017-06-12 01:16:46 -070026#include "webrtc/media/base/mediaengine.h"
27#include "webrtc/media/base/videosinkinterface.h"
28#include "webrtc/media/base/videosourceinterface.h"
29#include "webrtc/media/engine/webrtcvideodecoderfactory.h"
30#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020031#include "webrtc/rtc_base/asyncinvoker.h"
32#include "webrtc/rtc_base/criticalsection.h"
33#include "webrtc/rtc_base/networkroute.h"
34#include "webrtc/rtc_base/optional.h"
35#include "webrtc/rtc_base/thread_annotations.h"
36#include "webrtc/rtc_base/thread_checker.h"
eladalonf1841382017-06-12 01:16:46 -070037
38namespace webrtc {
39class VideoDecoder;
40class VideoEncoder;
41struct MediaConfig;
42}
43
44namespace rtc {
45class Thread;
46} // namespace rtc
47
48namespace cricket {
49
andersc084c55a2017-09-01 10:38:15 -070050class DecoderFactoryAdapter;
magjeda35df422017-08-30 04:21:30 -070051class EncoderFactoryAdapter;
eladalonf1841382017-06-12 01:16:46 -070052class VideoCapturer;
53class VideoProcessor;
54class VideoRenderer;
55class VoiceMediaChannel;
56class WebRtcDecoderObserver;
57class WebRtcEncoderObserver;
58class WebRtcLocalStreamInfo;
59class WebRtcRenderAdapter;
60class WebRtcVideoChannel;
61class WebRtcVideoChannelRecvInfo;
62class WebRtcVideoChannelSendInfo;
63class WebRtcVoiceEngine;
64class WebRtcVoiceMediaChannel;
65
66struct Device;
67
68class UnsignalledSsrcHandler {
69 public:
70 enum Action {
71 kDropPacket,
72 kDeliverPacket,
73 };
74 virtual Action OnUnsignalledSsrc(WebRtcVideoChannel* channel,
75 uint32_t ssrc) = 0;
76 virtual ~UnsignalledSsrcHandler() = default;
77};
78
79// TODO(pbos): Remove, use external handlers only.
80class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler {
81 public:
82 DefaultUnsignalledSsrcHandler();
83 Action OnUnsignalledSsrc(WebRtcVideoChannel* channel,
84 uint32_t ssrc) override;
85
86 rtc::VideoSinkInterface<webrtc::VideoFrame>* GetDefaultSink() const;
87 void SetDefaultSink(WebRtcVideoChannel* channel,
88 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink);
89
90 virtual ~DefaultUnsignalledSsrcHandler() = default;
91
92 private:
93 rtc::VideoSinkInterface<webrtc::VideoFrame>* default_sink_;
94};
95
96// WebRtcVideoEngine is used for the new native WebRTC Video API (webrtc:1667).
97class WebRtcVideoEngine {
98 public:
99 WebRtcVideoEngine();
100 virtual ~WebRtcVideoEngine();
101
102 // Basic video engine implementation.
103 void Init();
104
105 WebRtcVideoChannel* CreateChannel(webrtc::Call* call,
106 const MediaConfig& config,
107 const VideoOptions& options);
108
109 std::vector<VideoCodec> codecs() const;
110 RtpCapabilities GetCapabilities() const;
111
112 // Set a WebRtcVideoDecoderFactory for external decoding. Video engine does
113 // not take the ownership of |decoder_factory|. The caller needs to make sure
114 // that |decoder_factory| outlives the video engine.
115 void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory);
116 // Set a WebRtcVideoEncoderFactory for external encoding. Video engine does
117 // not take the ownership of |encoder_factory|. The caller needs to make sure
118 // that |encoder_factory| outlives the video engine.
119 virtual void SetExternalEncoderFactory(
120 WebRtcVideoEncoderFactory* encoder_factory);
121
122 private:
123 bool initialized_;
124
andersc084c55a2017-09-01 10:38:15 -0700125 std::unique_ptr<DecoderFactoryAdapter> decoder_factory_;
magjeda35df422017-08-30 04:21:30 -0700126 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_;
eladalonf1841382017-06-12 01:16:46 -0700127};
128
129class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
130 public:
131 WebRtcVideoChannel(webrtc::Call* call,
132 const MediaConfig& config,
133 const VideoOptions& options,
magjeda35df422017-08-30 04:21:30 -0700134 const EncoderFactoryAdapter& encoder_factory,
andersc084c55a2017-09-01 10:38:15 -0700135 const DecoderFactoryAdapter& decoder_factory);
eladalonf1841382017-06-12 01:16:46 -0700136 ~WebRtcVideoChannel() override;
137
138 // VideoMediaChannel implementation
139 rtc::DiffServCodePoint PreferredDscp() const override;
140
141 bool SetSendParameters(const VideoSendParameters& params) override;
142 bool SetRecvParameters(const VideoRecvParameters& params) override;
143 webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const override;
144 bool SetRtpSendParameters(uint32_t ssrc,
145 const webrtc::RtpParameters& parameters) override;
146 webrtc::RtpParameters GetRtpReceiveParameters(uint32_t ssrc) const override;
147 bool SetRtpReceiveParameters(
148 uint32_t ssrc,
149 const webrtc::RtpParameters& parameters) override;
150 bool GetSendCodec(VideoCodec* send_codec) override;
151 bool SetSend(bool send) override;
152 bool SetVideoSend(
153 uint32_t ssrc,
154 bool enable,
155 const VideoOptions* options,
156 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override;
157 bool AddSendStream(const StreamParams& sp) override;
158 bool RemoveSendStream(uint32_t ssrc) override;
159 bool AddRecvStream(const StreamParams& sp) override;
160 bool AddRecvStream(const StreamParams& sp, bool default_stream);
161 bool RemoveRecvStream(uint32_t ssrc) override;
162 bool SetSink(uint32_t ssrc,
163 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
164 void FillBitrateInfo(BandwidthEstimationInfo* bwe_info) override;
165 bool GetStats(VideoMediaInfo* info) override;
166
167 void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
168 const rtc::PacketTime& packet_time) override;
169 void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
170 const rtc::PacketTime& packet_time) override;
171 void OnReadyToSend(bool ready) override;
172 void OnNetworkRouteChanged(const std::string& transport_name,
173 const rtc::NetworkRoute& network_route) override;
174 void OnTransportOverheadChanged(int transport_overhead_per_packet) override;
175 void SetInterface(NetworkInterface* iface) override;
176
177 // Implemented for VideoMediaChannelTest.
178 bool sending() const { return sending_; }
179
180 rtc::Optional<uint32_t> GetDefaultReceiveStreamSsrc();
181
182 // AdaptReason is used for expressing why a WebRtcVideoSendStream request
183 // a lower input frame size than the currently configured camera input frame
184 // size. There can be more than one reason OR:ed together.
185 enum AdaptReason {
186 ADAPTREASON_NONE = 0,
187 ADAPTREASON_CPU = 1,
188 ADAPTREASON_BANDWIDTH = 2,
189 };
190
sprang67561a62017-06-15 06:34:42 -0700191 static constexpr int kDefaultQpMax = 56;
192
eladalonf1841382017-06-12 01:16:46 -0700193 private:
194 class WebRtcVideoReceiveStream;
195 struct VideoCodecSettings {
196 VideoCodecSettings();
197
198 // Checks if all members of |*this| are equal to the corresponding members
199 // of |other|.
200 bool operator==(const VideoCodecSettings& other) const;
201 bool operator!=(const VideoCodecSettings& other) const;
202
203 // Checks if all members of |a|, except |flexfec_payload_type|, are equal
204 // to the corresponding members of |b|.
205 static bool EqualsDisregardingFlexfec(const VideoCodecSettings& a,
206 const VideoCodecSettings& b);
207
208 VideoCodec codec;
209 webrtc::UlpfecConfig ulpfec;
210 int flexfec_payload_type;
211 int rtx_payload_type;
212 };
213
214 struct ChangedSendParameters {
215 // These optionals are unset if not changed.
216 rtc::Optional<VideoCodecSettings> codec;
217 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
218 rtc::Optional<int> max_bandwidth_bps;
219 rtc::Optional<bool> conference_mode;
220 rtc::Optional<webrtc::RtcpMode> rtcp_mode;
221 };
222
223 struct ChangedRecvParameters {
224 // These optionals are unset if not changed.
225 rtc::Optional<std::vector<VideoCodecSettings>> codec_settings;
226 rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
227 // Keep track of the FlexFEC payload type separately from |codec_settings|.
228 // This allows us to recreate the FlexfecReceiveStream separately from the
229 // VideoReceiveStream when the FlexFEC payload type is changed.
230 rtc::Optional<int> flexfec_payload_type;
231 };
232
233 bool GetChangedSendParameters(const VideoSendParameters& params,
234 ChangedSendParameters* changed_params) const;
235 bool GetChangedRecvParameters(const VideoRecvParameters& params,
236 ChangedRecvParameters* changed_params) const;
237
238 void SetMaxSendBandwidth(int bps);
239
240 void ConfigureReceiverRtp(
241 webrtc::VideoReceiveStream::Config* config,
242 webrtc::FlexfecReceiveStream::Config* flexfec_config,
243 const StreamParams& sp) const;
244 bool ValidateSendSsrcAvailability(const StreamParams& sp) const
245 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
246 bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const
247 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
248 void DeleteReceiveStream(WebRtcVideoReceiveStream* stream)
249 EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
250
251 static std::string CodecSettingsVectorToString(
252 const std::vector<VideoCodecSettings>& codecs);
253
254 // Wrapper for the sender part.
255 class WebRtcVideoSendStream
256 : public rtc::VideoSourceInterface<webrtc::VideoFrame> {
257 public:
258 WebRtcVideoSendStream(
259 webrtc::Call* call,
260 const StreamParams& sp,
261 webrtc::VideoSendStream::Config config,
262 const VideoOptions& options,
magjeda35df422017-08-30 04:21:30 -0700263 const EncoderFactoryAdapter& encoder_factory,
eladalonf1841382017-06-12 01:16:46 -0700264 bool enable_cpu_overuse_detection,
265 int max_bitrate_bps,
266 const rtc::Optional<VideoCodecSettings>& codec_settings,
267 const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
268 const VideoSendParameters& send_params);
269 virtual ~WebRtcVideoSendStream();
270
271 void SetSendParameters(const ChangedSendParameters& send_params);
272 bool SetRtpParameters(const webrtc::RtpParameters& parameters);
273 webrtc::RtpParameters GetRtpParameters() const;
274
275 // Implements rtc::VideoSourceInterface<webrtc::VideoFrame>.
276 // WebRtcVideoSendStream acts as a source to the webrtc::VideoSendStream
277 // in |stream_|. This is done to proxy VideoSinkWants from the encoder to
278 // the worker thread.
279 void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
280 const rtc::VideoSinkWants& wants) override;
281 void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
282
283 bool SetVideoSend(bool mute,
284 const VideoOptions* options,
285 rtc::VideoSourceInterface<webrtc::VideoFrame>* source);
286
287 void SetSend(bool send);
288
289 const std::vector<uint32_t>& GetSsrcs() const;
290 VideoSenderInfo GetVideoSenderInfo(bool log_stats);
291 void FillBitrateInfo(BandwidthEstimationInfo* bwe_info);
292
293 private:
294 // Parameters needed to reconstruct the underlying stream.
295 // webrtc::VideoSendStream doesn't support setting a lot of options on the
296 // fly, so when those need to be changed we tear down and reconstruct with
297 // similar parameters depending on which options changed etc.
298 struct VideoSendStreamParameters {
299 VideoSendStreamParameters(
300 webrtc::VideoSendStream::Config config,
301 const VideoOptions& options,
302 int max_bitrate_bps,
303 const rtc::Optional<VideoCodecSettings>& codec_settings);
304 webrtc::VideoSendStream::Config config;
305 VideoOptions options;
306 int max_bitrate_bps;
307 bool conference_mode;
308 rtc::Optional<VideoCodecSettings> codec_settings;
309 // Sent resolutions + bitrates etc. by the underlying VideoSendStream,
310 // typically changes when setting a new resolution or reconfiguring
311 // bitrates.
312 webrtc::VideoEncoderConfig encoder_config;
313 };
314
eladalonf1841382017-06-12 01:16:46 -0700315 rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
316 ConfigureVideoEncoderSettings(const VideoCodec& codec);
eladalonf1841382017-06-12 01:16:46 -0700317 void SetCodec(const VideoCodecSettings& codec,
318 bool force_encoder_allocation);
319 void RecreateWebRtcStream();
320 webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
321 const VideoCodec& codec) const;
322 void ReconfigureEncoder();
323 bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
324
325 // Calls Start or Stop according to whether or not |sending_| is true,
326 // and whether or not the encoding in |rtp_parameters_| is active.
327 void UpdateSendState();
328
329 webrtc::VideoSendStream::DegradationPreference GetDegradationPreference()
330 const EXCLUSIVE_LOCKS_REQUIRED(&thread_checker_);
331
332 rtc::ThreadChecker thread_checker_;
333 rtc::AsyncInvoker invoker_;
334 rtc::Thread* worker_thread_;
335 const std::vector<uint32_t> ssrcs_ ACCESS_ON(&thread_checker_);
336 const std::vector<SsrcGroup> ssrc_groups_ ACCESS_ON(&thread_checker_);
337 webrtc::Call* const call_;
338 const bool enable_cpu_overuse_detection_;
339 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_
340 ACCESS_ON(&thread_checker_);
magjeda35df422017-08-30 04:21:30 -0700341 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_
eladalonf1841382017-06-12 01:16:46 -0700342 ACCESS_ON(&thread_checker_);
343
344 webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_);
345 rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
346 ACCESS_ON(&thread_checker_);
347 // Contains settings that are the same for all streams in the MediaChannel,
348 // such as codecs, header extensions, and the global bitrate limit for the
349 // entire channel.
350 VideoSendStreamParameters parameters_ ACCESS_ON(&thread_checker_);
351 // Contains settings that are unique for each stream, such as max_bitrate.
352 // Does *not* contain codecs, however.
353 // TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
354 // TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
355 // one stream per MediaChannel.
356 webrtc::RtpParameters rtp_parameters_ ACCESS_ON(&thread_checker_);
magjeda35df422017-08-30 04:21:30 -0700357 std::unique_ptr<webrtc::VideoEncoder> allocated_encoder_
358 ACCESS_ON(&thread_checker_);
359 VideoCodec allocated_codec_ ACCESS_ON(&thread_checker_);
eladalonf1841382017-06-12 01:16:46 -0700360
361 bool sending_ ACCESS_ON(&thread_checker_);
362 };
363
364 // Wrapper for the receiver part, contains configs etc. that are needed to
365 // reconstruct the underlying VideoReceiveStream.
366 class WebRtcVideoReceiveStream
367 : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
368 public:
369 WebRtcVideoReceiveStream(
370 webrtc::Call* call,
371 const StreamParams& sp,
372 webrtc::VideoReceiveStream::Config config,
andersc084c55a2017-09-01 10:38:15 -0700373 const DecoderFactoryAdapter& decoder_factory,
eladalonf1841382017-06-12 01:16:46 -0700374 bool default_stream,
375 const std::vector<VideoCodecSettings>& recv_codecs,
376 const webrtc::FlexfecReceiveStream::Config& flexfec_config);
377 ~WebRtcVideoReceiveStream();
378
379 const std::vector<uint32_t>& GetSsrcs() const;
380 rtc::Optional<uint32_t> GetFirstPrimarySsrc() const;
381
382 void SetLocalSsrc(uint32_t local_ssrc);
383 // TODO(deadbeef): Move these feedback parameters into the recv parameters.
384 void SetFeedbackParameters(bool nack_enabled,
385 bool remb_enabled,
386 bool transport_cc_enabled,
387 webrtc::RtcpMode rtcp_mode);
388 void SetRecvParameters(const ChangedRecvParameters& recv_params);
389
390 void OnFrame(const webrtc::VideoFrame& frame) override;
391 bool IsDefaultStream() const;
392
393 void SetSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink);
394
395 VideoReceiverInfo GetVideoReceiverInfo(bool log_stats);
396
397 private:
eladalonf1841382017-06-12 01:16:46 -0700398 void RecreateWebRtcVideoStream();
399 void MaybeRecreateWebRtcFlexfecStream();
400
eladalonc0d481a2017-08-02 07:39:07 -0700401 void MaybeAssociateFlexfecWithVideo();
402 void MaybeDissociateFlexfecFromVideo();
403
andersc084c55a2017-09-01 10:38:15 -0700404 void ConfigureCodecs(
405 const std::vector<VideoCodecSettings>& recv_codecs,
406 std::map<webrtc::VideoCodecType, std::unique_ptr<webrtc::VideoDecoder>>*
407 old_codecs);
eladalonf1841382017-06-12 01:16:46 -0700408 void ConfigureFlexfecCodec(int flexfec_payload_type);
eladalonf1841382017-06-12 01:16:46 -0700409
410 std::string GetCodecNameFromPayloadType(int payload_type);
411
412 webrtc::Call* const call_;
413 StreamParams stream_params_;
414
415 // Both |stream_| and |flexfec_stream_| are managed by |this|. They are
416 // destroyed by calling call_->DestroyVideoReceiveStream and
417 // call_->DestroyFlexfecReceiveStream, respectively.
418 webrtc::VideoReceiveStream* stream_;
419 const bool default_stream_;
420 webrtc::VideoReceiveStream::Config config_;
421 webrtc::FlexfecReceiveStream::Config flexfec_config_;
422 webrtc::FlexfecReceiveStream* flexfec_stream_;
423
andersc084c55a2017-09-01 10:38:15 -0700424 std::unique_ptr<DecoderFactoryAdapter> decoder_factory_;
425 std::map<webrtc::VideoCodecType, std::unique_ptr<webrtc::VideoDecoder>>
426 allocated_decoders_;
eladalonf1841382017-06-12 01:16:46 -0700427
428 rtc::CriticalSection sink_lock_;
429 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ GUARDED_BY(sink_lock_);
430 // Expands remote RTP timestamps to int64_t to be able to estimate how long
431 // the stream has been running.
432 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_
433 GUARDED_BY(sink_lock_);
434 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_);
435 // Start NTP time is estimated as current remote NTP time (estimated from
436 // RTCP) minus the elapsed time, as soon as remote NTP time is available.
437 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_);
438 };
439
440 void Construct(webrtc::Call* call, WebRtcVideoEngine* engine);
441
442 bool SendRtp(const uint8_t* data,
443 size_t len,
444 const webrtc::PacketOptions& options) override;
445 bool SendRtcp(const uint8_t* data, size_t len) override;
446
447 static std::vector<VideoCodecSettings> MapCodecs(
448 const std::vector<VideoCodec>& codecs);
449 // Select what video codec will be used for sending, i.e. what codec is used
450 // for local encoding, based on supported remote codecs. The first remote
451 // codec that is supported locally will be selected.
452 rtc::Optional<VideoCodecSettings> SelectSendVideoCodec(
453 const std::vector<VideoCodecSettings>& remote_mapped_codecs) const;
454
455 static bool NonFlexfecReceiveCodecsHaveChanged(
456 std::vector<VideoCodecSettings> before,
457 std::vector<VideoCodecSettings> after);
458
459 void FillSenderStats(VideoMediaInfo* info, bool log_stats);
460 void FillReceiverStats(VideoMediaInfo* info, bool log_stats);
461 void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats,
462 VideoMediaInfo* info);
463 void FillSendAndReceiveCodecStats(VideoMediaInfo* video_media_info);
464
465 rtc::ThreadChecker thread_checker_;
466
467 uint32_t rtcp_receiver_report_ssrc_;
468 bool sending_;
469 webrtc::Call* const call_;
470
471 DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
472 UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
473
474 const MediaConfig::Video video_config_;
475
476 rtc::CriticalSection stream_crit_;
477 // Using primary-ssrc (first ssrc) as key.
478 std::map<uint32_t, WebRtcVideoSendStream*> send_streams_
479 GUARDED_BY(stream_crit_);
480 std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_
481 GUARDED_BY(stream_crit_);
482 std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_);
483 std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_);
484
485 rtc::Optional<VideoCodecSettings> send_codec_;
486 rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
487
magjeda35df422017-08-30 04:21:30 -0700488 std::unique_ptr<EncoderFactoryAdapter> encoder_factory_;
andersc084c55a2017-09-01 10:38:15 -0700489 std::unique_ptr<DecoderFactoryAdapter> decoder_factory_;
eladalonf1841382017-06-12 01:16:46 -0700490 std::vector<VideoCodecSettings> recv_codecs_;
491 std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
492 // See reason for keeping track of the FlexFEC payload type separately in
493 // comment in WebRtcVideoChannel::ChangedRecvParameters.
494 int recv_flexfec_payload_type_;
495 webrtc::Call::Config::BitrateConfig bitrate_config_;
496 // TODO(deadbeef): Don't duplicate information between
497 // send_params/recv_params, rtp_extensions, options, etc.
498 VideoSendParameters send_params_;
499 VideoOptions default_send_options_;
500 VideoRecvParameters recv_params_;
501 int64_t last_stats_log_ms_;
502};
503
ilnik6b826ef2017-06-16 06:53:48 -0700504class EncoderStreamFactory
505 : public webrtc::VideoEncoderConfig::VideoStreamFactoryInterface {
506 public:
507 EncoderStreamFactory(std::string codec_name,
508 int max_qp,
509 int max_framerate,
510 bool is_screencast,
511 bool conference_mode);
512
513 private:
514 std::vector<webrtc::VideoStream> CreateEncoderStreams(
515 int width,
516 int height,
517 const webrtc::VideoEncoderConfig& encoder_config) override;
518
519 const std::string codec_name_;
520 const int max_qp_;
521 const int max_framerate_;
522 const bool is_screencast_;
523 const bool conference_mode_;
524};
525
eladalonf1841382017-06-12 01:16:46 -0700526} // namespace cricket
527
528#endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE_H_