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