3 * Copyright 2010 Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
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.
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.
28 #ifndef TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_
29 #define TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_
35 #include "talk/base/basictypes.h"
36 #include "talk/base/gunit.h"
37 #include "talk/base/stringutils.h"
38 #include "talk/media/base/codec.h"
39 #include "talk/media/webrtc/fakewebrtccommon.h"
40 #include "talk/media/webrtc/webrtcvideodecoderfactory.h"
41 #include "talk/media/webrtc/webrtcvideoencoderfactory.h"
42 #include "talk/media/webrtc/webrtcvie.h"
46 bool operator==(const webrtc::VideoCodec& c1, const webrtc::VideoCodec& c2) {
47 return memcmp(&c1, &c2, sizeof(c1)) == 0;
54 #define WEBRTC_CHECK_CAPTURER(capturer) \
55 if (capturers_.find(capturer) == capturers_.end()) return -1;
57 #define WEBRTC_ASSERT_CAPTURER(capturer) \
58 ASSERT(capturers_.find(capturer) != capturers_.end());
60 static const int kMinVideoBitrate = 100;
61 static const int kStartVideoBitrate = 300;
62 static const int kMaxVideoBitrate = 1000;
64 // WebRtc channel id and capture id share the same number space.
65 // This is how AddRenderer(renderId, ...) is able to tell if it is adding a
66 // renderer for a channel or it is adding a renderer for a capturer.
67 static const int kViEChannelIdBase = 0;
68 static const int kViEChannelIdMax = 1000;
69 static const int kViECaptureIdBase = 10000; // Make sure there is a gap.
70 static const int kViECaptureIdMax = 11000;
72 // Fake class for mocking out webrtc::VideoDecoder
73 class FakeWebRtcVideoDecoder : public webrtc::VideoDecoder {
75 FakeWebRtcVideoDecoder()
76 : num_frames_received_(0) {
79 virtual int32 InitDecode(const webrtc::VideoCodec*, int32) {
80 return WEBRTC_VIDEO_CODEC_OK;
84 const webrtc::EncodedImage&, bool, const webrtc::RTPFragmentationHeader*,
85 const webrtc::CodecSpecificInfo*, int64) {
86 num_frames_received_++;
87 return WEBRTC_VIDEO_CODEC_OK;
90 virtual int32 RegisterDecodeCompleteCallback(
91 webrtc::DecodedImageCallback*) {
92 return WEBRTC_VIDEO_CODEC_OK;
95 virtual int32 Release() {
96 return WEBRTC_VIDEO_CODEC_OK;
99 virtual int32 Reset() {
100 return WEBRTC_VIDEO_CODEC_OK;
103 int GetNumFramesReceived() const {
104 return num_frames_received_;
108 int num_frames_received_;
111 // Fake class for mocking out WebRtcVideoDecoderFactory.
112 class FakeWebRtcVideoDecoderFactory : public WebRtcVideoDecoderFactory {
114 FakeWebRtcVideoDecoderFactory()
115 : num_created_decoders_(0) {
118 virtual webrtc::VideoDecoder* CreateVideoDecoder(
119 webrtc::VideoCodecType type) {
120 if (supported_codec_types_.count(type) == 0) {
123 FakeWebRtcVideoDecoder* decoder = new FakeWebRtcVideoDecoder();
124 decoders_.push_back(decoder);
125 num_created_decoders_++;
129 virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) {
131 std::remove(decoders_.begin(), decoders_.end(), decoder),
136 void AddSupportedVideoCodecType(webrtc::VideoCodecType type) {
137 supported_codec_types_.insert(type);
140 int GetNumCreatedDecoders() {
141 return num_created_decoders_;
144 const std::vector<FakeWebRtcVideoDecoder*>& decoders() {
149 std::set<webrtc::VideoCodecType> supported_codec_types_;
150 std::vector<FakeWebRtcVideoDecoder*> decoders_;
151 int num_created_decoders_;
154 // Fake class for mocking out webrtc::VideoEnoder
155 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder {
157 FakeWebRtcVideoEncoder() {}
159 virtual int32 InitEncode(const webrtc::VideoCodec* codecSettings,
161 uint32 maxPayloadSize) {
162 return WEBRTC_VIDEO_CODEC_OK;
165 virtual int32 Encode(
166 const webrtc::I420VideoFrame& inputImage,
167 const webrtc::CodecSpecificInfo* codecSpecificInfo,
168 const std::vector<webrtc::VideoFrameType>* frame_types) {
169 return WEBRTC_VIDEO_CODEC_OK;
172 virtual int32 RegisterEncodeCompleteCallback(
173 webrtc::EncodedImageCallback* callback) {
174 return WEBRTC_VIDEO_CODEC_OK;
177 virtual int32 Release() {
178 return WEBRTC_VIDEO_CODEC_OK;
181 virtual int32 SetChannelParameters(uint32 packetLoss,
183 return WEBRTC_VIDEO_CODEC_OK;
186 virtual int32 SetRates(uint32 newBitRate,
188 return WEBRTC_VIDEO_CODEC_OK;
192 // Fake class for mocking out WebRtcVideoEncoderFactory.
193 class FakeWebRtcVideoEncoderFactory : public WebRtcVideoEncoderFactory {
195 FakeWebRtcVideoEncoderFactory()
196 : num_created_encoders_(0) {
199 virtual webrtc::VideoEncoder* CreateVideoEncoder(
200 webrtc::VideoCodecType type) {
201 if (supported_codec_types_.count(type) == 0) {
204 FakeWebRtcVideoEncoder* encoder = new FakeWebRtcVideoEncoder();
205 encoders_.push_back(encoder);
206 num_created_encoders_++;
210 virtual void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) {
212 std::remove(encoders_.begin(), encoders_.end(), encoder),
217 virtual void AddObserver(WebRtcVideoEncoderFactory::Observer* observer) {
218 bool inserted = observers_.insert(observer).second;
219 EXPECT_TRUE(inserted);
222 virtual void RemoveObserver(WebRtcVideoEncoderFactory::Observer* observer) {
223 size_t erased = observers_.erase(observer);
224 EXPECT_EQ(erased, 1UL);
227 virtual const std::vector<WebRtcVideoEncoderFactory::VideoCodec>& codecs()
232 void AddSupportedVideoCodecType(webrtc::VideoCodecType type,
233 const std::string& name) {
234 supported_codec_types_.insert(type);
236 WebRtcVideoEncoderFactory::VideoCodec(type, name, 1280, 720, 30));
239 void NotifyCodecsAvailable() {
240 std::set<WebRtcVideoEncoderFactory::Observer*>::iterator it;
241 for (it = observers_.begin(); it != observers_.end(); ++it)
242 (*it)->OnCodecsAvailable();
245 int GetNumCreatedEncoders() {
246 return num_created_encoders_;
249 const std::vector<FakeWebRtcVideoEncoder*>& encoders() {
254 std::set<webrtc::VideoCodecType> supported_codec_types_;
255 std::vector<WebRtcVideoEncoderFactory::VideoCodec> codecs_;
256 std::vector<FakeWebRtcVideoEncoder*> encoders_;
257 std::set<WebRtcVideoEncoderFactory::Observer*> observers_;
258 int num_created_encoders_;
261 class FakeWebRtcVideoEngine
262 : public webrtc::ViEBase,
263 public webrtc::ViECodec,
264 public webrtc::ViECapture,
265 public webrtc::ViENetwork,
266 public webrtc::ViERender,
267 public webrtc::ViERTP_RTCP,
268 public webrtc::ViEImageProcess,
269 public webrtc::ViEExternalCodec {
274 original_channel_id_(-1),
275 has_renderer_(false),
276 render_started_(false),
280 remote_rtx_ssrc_(-1),
281 rtx_send_payload_type(-1),
282 rtcp_status_(webrtc::kRtcpNone),
283 key_frame_request_method_(webrtc::kViEKeyFrameRequestNone),
285 remb_contribute_(false),
286 remb_bw_partition_(false),
287 rtp_offset_send_id_(0),
288 rtp_offset_receive_id_(0),
289 rtp_absolute_send_time_send_id_(0),
290 rtp_absolute_send_time_receive_id_(0),
291 sender_target_delay_(0),
292 receiver_target_delay_(0),
293 transmission_smoothing_(false),
295 hybrid_nack_fec_(false),
296 send_video_bitrate_(0),
297 send_fec_bitrate_(0),
298 send_nack_bitrate_(0),
300 receive_bandwidth_(0) {
301 ssrcs_[0] = 0; // default ssrc.
302 memset(&send_codec, 0, sizeof(send_codec));
305 int original_channel_id_;
307 bool render_started_;
311 std::map<int, int> ssrcs_;
312 std::map<int, int> rtx_ssrcs_;
313 int remote_rtx_ssrc_;
314 int rtx_send_payload_type;
316 webrtc::ViERTCPMode rtcp_status_;
317 webrtc::ViEKeyFrameRequestMethod key_frame_request_method_;
319 bool remb_contribute_; // This channel contributes to the remb report.
320 bool remb_bw_partition_; // This channel is allocated part of total bw.
321 int rtp_offset_send_id_;
322 int rtp_offset_receive_id_;
323 int rtp_absolute_send_time_send_id_;
324 int rtp_absolute_send_time_receive_id_;
325 int sender_target_delay_;
326 int receiver_target_delay_;
327 bool transmission_smoothing_;
329 bool hybrid_nack_fec_;
330 std::vector<webrtc::VideoCodec> recv_codecs;
331 std::set<unsigned int> ext_decoder_pl_types_;
332 std::set<unsigned int> ext_encoder_pl_types_;
333 webrtc::VideoCodec send_codec;
334 unsigned int send_video_bitrate_;
335 unsigned int send_fec_bitrate_;
336 unsigned int send_nack_bitrate_;
337 unsigned int send_bandwidth_;
338 unsigned int receive_bandwidth_;
340 class Capturer : public webrtc::ViEExternalCapture {
342 Capturer() : channel_id_(-1), denoising_(false),
343 last_capture_time_(0), incoming_frame_num_(0) { }
344 int channel_id() const { return channel_id_; }
345 void set_channel_id(int channel_id) { channel_id_ = channel_id; }
346 bool denoising() const { return denoising_; }
347 void set_denoising(bool denoising) { denoising_ = denoising; }
348 int64 last_capture_time() const { return last_capture_time_; }
349 int incoming_frame_num() const { return incoming_frame_num_; }
351 // From ViEExternalCapture
352 virtual int IncomingFrame(unsigned char* videoFrame,
353 unsigned int videoFrameLength,
354 unsigned short width,
355 unsigned short height,
356 webrtc::RawVideoType videoType,
357 unsigned long long captureTime) {
360 virtual int IncomingFrameI420(
361 const webrtc::ViEVideoFrameI420& video_frame,
362 unsigned long long captureTime) {
363 last_capture_time_ = captureTime;
364 ++incoming_frame_num_;
371 int64 last_capture_time_;
372 int incoming_frame_num_;
375 FakeWebRtcVideoEngine(const cricket::VideoCodec* const* codecs,
378 last_channel_(kViEChannelIdBase - 1),
379 fail_create_channel_(false),
380 last_capturer_(kViECaptureIdBase - 1),
381 fail_alloc_capturer_(false),
383 num_codecs_(num_codecs),
384 num_set_send_codecs_(0) {
387 ~FakeWebRtcVideoEngine() {
388 ASSERT(0 == channels_.size());
389 ASSERT(0 == capturers_.size());
391 bool IsInited() const { return inited_; }
393 int GetLastChannel() const { return last_channel_; }
394 int GetChannelFromLocalSsrc(int local_ssrc) const {
395 // ssrcs_[0] is the default local ssrc.
396 for (std::map<int, Channel*>::const_iterator iter = channels_.begin();
397 iter != channels_.end(); ++iter) {
398 if (local_ssrc == iter->second->ssrcs_[0]) {
405 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
406 bool IsChannel(int channel) const {
407 return (channels_.find(channel) != channels_.end());
409 void set_fail_create_channel(bool fail_create_channel) {
410 fail_create_channel_ = fail_create_channel;
413 int GetLastCapturer() const { return last_capturer_; }
414 int GetNumCapturers() const { return static_cast<int>(capturers_.size()); }
415 int GetIncomingFrameNum(int channel_id) const {
416 for (std::map<int, Capturer*>::const_iterator iter = capturers_.begin();
417 iter != capturers_.end(); ++iter) {
418 Capturer* capturer = iter->second;
419 if (capturer->channel_id() == channel_id) {
420 return capturer->incoming_frame_num();
425 void set_fail_alloc_capturer(bool fail_alloc_capturer) {
426 fail_alloc_capturer_ = fail_alloc_capturer;
428 int num_set_send_codecs() const { return num_set_send_codecs_; }
430 int GetCaptureId(int channel) const {
431 WEBRTC_ASSERT_CHANNEL(channel);
432 return channels_.find(channel)->second->capture_id_;
434 int GetOriginalChannelId(int channel) const {
435 WEBRTC_ASSERT_CHANNEL(channel);
436 return channels_.find(channel)->second->original_channel_id_;
438 bool GetHasRenderer(int channel) const {
439 WEBRTC_ASSERT_CHANNEL(channel);
440 return channels_.find(channel)->second->has_renderer_;
442 bool GetRenderStarted(int channel) const {
443 WEBRTC_ASSERT_CHANNEL(channel);
444 return channels_.find(channel)->second->render_started_;
446 bool GetSend(int channel) const {
447 WEBRTC_ASSERT_CHANNEL(channel);
448 return channels_.find(channel)->second->send;
450 int GetCaptureChannelId(int capture_id) const {
451 WEBRTC_ASSERT_CAPTURER(capture_id);
452 return capturers_.find(capture_id)->second->channel_id();
454 bool GetCaptureDenoising(int capture_id) const {
455 WEBRTC_ASSERT_CAPTURER(capture_id);
456 return capturers_.find(capture_id)->second->denoising();
458 int64 GetCaptureLastTimestamp(int capture_id) const {
459 WEBRTC_ASSERT_CAPTURER(capture_id);
460 return capturers_.find(capture_id)->second->last_capture_time();
462 webrtc::ViERTCPMode GetRtcpStatus(int channel) const {
463 WEBRTC_ASSERT_CHANNEL(channel);
464 return channels_.find(channel)->second->rtcp_status_;
466 webrtc::ViEKeyFrameRequestMethod GetKeyFrameRequestMethod(int channel) const {
467 WEBRTC_ASSERT_CHANNEL(channel);
468 return channels_.find(channel)->second->key_frame_request_method_;
470 bool GetTmmbrStatus(int channel) const {
471 WEBRTC_ASSERT_CHANNEL(channel);
472 return channels_.find(channel)->second->tmmbr_;
474 bool GetRembStatusBwPartition(int channel) const {
475 WEBRTC_ASSERT_CHANNEL(channel);
476 return channels_.find(channel)->second->remb_bw_partition_;
478 bool GetRembStatusContribute(int channel) const {
479 WEBRTC_ASSERT_CHANNEL(channel);
480 return channels_.find(channel)->second->remb_contribute_;
482 int GetSendRtpTimestampOffsetExtensionId(int channel) {
483 WEBRTC_ASSERT_CHANNEL(channel);
484 return channels_.find(channel)->second->rtp_offset_send_id_;
486 int GetReceiveRtpTimestampOffsetExtensionId(int channel) {
487 WEBRTC_ASSERT_CHANNEL(channel);
488 return channels_.find(channel)->second->rtp_offset_receive_id_;
490 int GetSendAbsoluteSendTimeExtensionId(int channel) {
491 WEBRTC_ASSERT_CHANNEL(channel);
492 return channels_.find(channel)->second->rtp_absolute_send_time_send_id_;
494 int GetReceiveAbsoluteSendTimeExtensionId(int channel) {
495 WEBRTC_ASSERT_CHANNEL(channel);
496 return channels_.find(channel)->second->rtp_absolute_send_time_receive_id_;
498 bool GetTransmissionSmoothingStatus(int channel) {
499 WEBRTC_ASSERT_CHANNEL(channel);
500 return channels_.find(channel)->second->transmission_smoothing_;
502 int GetSenderTargetDelay(int channel) {
503 WEBRTC_ASSERT_CHANNEL(channel);
504 return channels_.find(channel)->second->sender_target_delay_;
506 int GetReceiverTargetDelay(int channel) {
507 WEBRTC_ASSERT_CHANNEL(channel);
508 return channels_.find(channel)->second->receiver_target_delay_;
510 bool GetNackStatus(int channel) const {
511 WEBRTC_ASSERT_CHANNEL(channel);
512 return channels_.find(channel)->second->nack_;
514 bool GetHybridNackFecStatus(int channel) const {
515 WEBRTC_ASSERT_CHANNEL(channel);
516 return channels_.find(channel)->second->hybrid_nack_fec_;
518 int GetNumSsrcs(int channel) const {
519 WEBRTC_ASSERT_CHANNEL(channel);
520 return static_cast<int>(
521 channels_.find(channel)->second->ssrcs_.size());
523 int GetNumRtxSsrcs(int channel) const {
524 WEBRTC_ASSERT_CHANNEL(channel);
525 return static_cast<int>(
526 channels_.find(channel)->second->rtx_ssrcs_.size());
528 bool GetIsTransmitting(int channel) const {
529 WEBRTC_ASSERT_CHANNEL(channel);
530 return channels_.find(channel)->second->can_transmit_;
532 int GetRtxSsrc(int channel, int simulcast_idx) const {
533 WEBRTC_ASSERT_CHANNEL(channel);
534 if (channels_.find(channel)->second->rtx_ssrcs_.find(simulcast_idx) ==
535 channels_.find(channel)->second->rtx_ssrcs_.end()) {
538 return channels_.find(channel)->second->rtx_ssrcs_[simulcast_idx];
540 bool ReceiveCodecRegistered(int channel,
541 const webrtc::VideoCodec& codec) const {
542 WEBRTC_ASSERT_CHANNEL(channel);
543 const std::vector<webrtc::VideoCodec>& codecs =
544 channels_.find(channel)->second->recv_codecs;
545 return std::find(codecs.begin(), codecs.end(), codec) != codecs.end();
547 bool ExternalDecoderRegistered(int channel,
548 unsigned int pl_type) const {
549 WEBRTC_ASSERT_CHANNEL(channel);
550 return channels_.find(channel)->second->
551 ext_decoder_pl_types_.count(pl_type) != 0;
553 int GetNumExternalDecoderRegistered(int channel) const {
554 WEBRTC_ASSERT_CHANNEL(channel);
555 return static_cast<int>(
556 channels_.find(channel)->second->ext_decoder_pl_types_.size());
558 bool ExternalEncoderRegistered(int channel,
559 unsigned int pl_type) const {
560 WEBRTC_ASSERT_CHANNEL(channel);
561 return channels_.find(channel)->second->
562 ext_encoder_pl_types_.count(pl_type) != 0;
564 int GetNumExternalEncoderRegistered(int channel) const {
565 WEBRTC_ASSERT_CHANNEL(channel);
566 return static_cast<int>(
567 channels_.find(channel)->second->ext_encoder_pl_types_.size());
569 int GetTotalNumExternalEncoderRegistered() const {
570 std::map<int, Channel*>::const_iterator it;
571 int total_num_registered = 0;
572 for (it = channels_.begin(); it != channels_.end(); ++it)
573 total_num_registered +=
574 static_cast<int>(it->second->ext_encoder_pl_types_.size());
575 return total_num_registered;
577 void SetSendBitrates(int channel, unsigned int video_bitrate,
578 unsigned int fec_bitrate, unsigned int nack_bitrate) {
579 WEBRTC_ASSERT_CHANNEL(channel);
580 channels_[channel]->send_video_bitrate_ = video_bitrate;
581 channels_[channel]->send_fec_bitrate_ = fec_bitrate;
582 channels_[channel]->send_nack_bitrate_ = nack_bitrate;
584 void SetSendBandwidthEstimate(int channel, unsigned int send_bandwidth) {
585 WEBRTC_ASSERT_CHANNEL(channel);
586 channels_[channel]->send_bandwidth_ = send_bandwidth;
588 void SetReceiveBandwidthEstimate(int channel,
589 unsigned int receive_bandwidth) {
590 WEBRTC_ASSERT_CHANNEL(channel);
591 channels_[channel]->receive_bandwidth_ = receive_bandwidth;
593 int GetRtxSendPayloadType(int channel) {
594 WEBRTC_CHECK_CHANNEL(channel);
595 return channels_[channel]->rtx_send_payload_type;
597 int GetRemoteRtxSsrc(int channel) {
598 WEBRTC_CHECK_CHANNEL(channel);
599 return channels_.find(channel)->second->remote_rtx_ssrc_;
602 WEBRTC_STUB(Release, ());
605 WEBRTC_FUNC(Init, ()) {
609 WEBRTC_STUB(SetVoiceEngine, (webrtc::VoiceEngine*));
610 WEBRTC_FUNC(CreateChannel, (int& channel)) { // NOLINT
611 if (fail_create_channel_) {
614 if (kViEChannelIdMax == last_channel_) {
617 Channel* ch = new Channel();
618 channels_[++last_channel_] = ch;
619 channel = last_channel_;
622 WEBRTC_FUNC(CreateChannel, (int& channel, int original_channel)) {
623 WEBRTC_CHECK_CHANNEL(original_channel);
624 if (CreateChannel(channel) != 0) {
627 channels_[channel]->original_channel_id_ = original_channel;
630 WEBRTC_FUNC(CreateReceiveChannel, (int& channel, int original_channel)) {
631 return CreateChannel(channel, original_channel);
633 WEBRTC_FUNC(DeleteChannel, (const int channel)) {
634 WEBRTC_CHECK_CHANNEL(channel);
635 // Make sure we deregister all the decoders before deleting a channel.
636 EXPECT_EQ(0, GetNumExternalDecoderRegistered(channel));
637 delete channels_[channel];
638 channels_.erase(channel);
641 WEBRTC_STUB(RegisterCpuOveruseObserver,
642 (int channel, webrtc::CpuOveruseObserver* observer));
643 WEBRTC_STUB(CpuOveruseMeasures, (int, int*, int*, int*, int*));
644 WEBRTC_STUB(ConnectAudioChannel, (const int, const int));
645 WEBRTC_STUB(DisconnectAudioChannel, (const int));
646 WEBRTC_FUNC(StartSend, (const int channel)) {
647 WEBRTC_CHECK_CHANNEL(channel);
648 channels_[channel]->send = true;
651 WEBRTC_FUNC(StopSend, (const int channel)) {
652 WEBRTC_CHECK_CHANNEL(channel);
653 channels_[channel]->send = false;
656 WEBRTC_FUNC(StartReceive, (const int channel)) {
657 WEBRTC_CHECK_CHANNEL(channel);
658 channels_[channel]->receive_ = true;
661 WEBRTC_FUNC(StopReceive, (const int channel)) {
662 WEBRTC_CHECK_CHANNEL(channel);
663 channels_[channel]->receive_ = false;
666 WEBRTC_STUB(GetVersion, (char version[1024]));
667 WEBRTC_STUB(LastError, ());
670 WEBRTC_FUNC_CONST(NumberOfCodecs, ()) {
673 WEBRTC_FUNC_CONST(GetCodec, (const unsigned char list_number,
674 webrtc::VideoCodec& out_codec)) {
675 if (list_number >= NumberOfCodecs()) {
678 memset(&out_codec, 0, sizeof(out_codec));
679 const cricket::VideoCodec& c(*codecs_[list_number]);
680 if ("I420" == c.name) {
681 out_codec.codecType = webrtc::kVideoCodecI420;
682 } else if ("VP8" == c.name) {
683 out_codec.codecType = webrtc::kVideoCodecVP8;
684 } else if ("red" == c.name) {
685 out_codec.codecType = webrtc::kVideoCodecRED;
686 } else if ("ulpfec" == c.name) {
687 out_codec.codecType = webrtc::kVideoCodecULPFEC;
689 out_codec.codecType = webrtc::kVideoCodecUnknown;
691 talk_base::strcpyn(out_codec.plName, sizeof(out_codec.plName),
693 out_codec.plType = c.id;
694 out_codec.width = c.width;
695 out_codec.height = c.height;
696 out_codec.startBitrate = kStartVideoBitrate;
697 out_codec.maxBitrate = kMaxVideoBitrate;
698 out_codec.minBitrate = kMinVideoBitrate;
699 out_codec.maxFramerate = c.framerate;
702 WEBRTC_FUNC(SetSendCodec, (const int channel,
703 const webrtc::VideoCodec& codec)) {
704 WEBRTC_CHECK_CHANNEL(channel);
705 channels_[channel]->send_codec = codec;
706 ++num_set_send_codecs_;
709 WEBRTC_FUNC_CONST(GetSendCodec, (const int channel,
710 webrtc::VideoCodec& codec)) { // NOLINT
711 WEBRTC_CHECK_CHANNEL(channel);
712 codec = channels_.find(channel)->second->send_codec;
715 WEBRTC_FUNC(SetReceiveCodec, (const int channel,
716 const webrtc::VideoCodec& codec)) { // NOLINT
717 WEBRTC_CHECK_CHANNEL(channel);
718 channels_[channel]->recv_codecs.push_back(codec);
721 WEBRTC_STUB_CONST(GetReceiveCodec, (const int, webrtc::VideoCodec&));
722 WEBRTC_STUB_CONST(GetCodecConfigParameters, (const int,
723 unsigned char*, unsigned char&));
724 WEBRTC_STUB(SetImageScaleStatus, (const int, const bool));
725 WEBRTC_STUB_CONST(GetSendCodecStastistics, (const int,
726 unsigned int&, unsigned int&));
727 WEBRTC_STUB_CONST(GetReceiveCodecStastistics, (const int,
728 unsigned int&, unsigned int&));
729 WEBRTC_STUB_CONST(GetReceiveSideDelay, (const int video_channel,
731 WEBRTC_FUNC_CONST(GetCodecTargetBitrate, (const int channel,
732 unsigned int* codec_target_bitrate)) {
733 WEBRTC_CHECK_CHANNEL(channel);
735 std::map<int, Channel*>::const_iterator it = channels_.find(channel);
736 if (it->second->send) {
737 // Assume the encoder produces the expected rate.
738 *codec_target_bitrate = it->second->send_video_bitrate_;
740 *codec_target_bitrate = 0;
744 virtual unsigned int GetDiscardedPackets(const int channel) const {
748 WEBRTC_STUB(SetKeyFrameRequestCallbackStatus, (const int, const bool));
749 WEBRTC_STUB(SetSignalKeyPacketLossStatus, (const int, const bool,
751 WEBRTC_STUB(RegisterEncoderObserver, (const int,
752 webrtc::ViEEncoderObserver&));
753 WEBRTC_STUB(DeregisterEncoderObserver, (const int));
754 WEBRTC_STUB(RegisterDecoderObserver, (const int,
755 webrtc::ViEDecoderObserver&));
756 WEBRTC_STUB(DeregisterDecoderObserver, (const int));
757 WEBRTC_STUB(SendKeyFrame, (const int));
758 WEBRTC_STUB(WaitForFirstKeyFrame, (const int, const bool));
759 WEBRTC_STUB(StartDebugRecording, (int, const char*));
760 WEBRTC_STUB(StopDebugRecording, (int));
761 WEBRTC_VOID_STUB(SuspendBelowMinBitrate, (int));
763 // webrtc::ViECapture
764 WEBRTC_STUB(NumberOfCaptureDevices, ());
765 WEBRTC_STUB(GetCaptureDevice, (unsigned int, char*,
766 const unsigned int, char*, const unsigned int));
767 WEBRTC_STUB(AllocateCaptureDevice, (const char*, const unsigned int, int&));
768 WEBRTC_FUNC(AllocateExternalCaptureDevice,
769 (int& capture_id, webrtc::ViEExternalCapture*& capture)) {
770 if (fail_alloc_capturer_) {
773 if (kViECaptureIdMax == last_capturer_) {
776 Capturer* cap = new Capturer();
777 capturers_[++last_capturer_] = cap;
778 capture_id = last_capturer_;
782 WEBRTC_STUB(AllocateCaptureDevice, (webrtc::VideoCaptureModule&, int&));
783 WEBRTC_FUNC(ReleaseCaptureDevice, (const int capture_id)) {
784 WEBRTC_CHECK_CAPTURER(capture_id);
785 delete capturers_[capture_id];
786 capturers_.erase(capture_id);
789 WEBRTC_FUNC(ConnectCaptureDevice, (const int capture_id,
790 const int channel)) {
791 WEBRTC_CHECK_CHANNEL(channel);
792 WEBRTC_CHECK_CAPTURER(capture_id);
793 channels_[channel]->capture_id_ = capture_id;
794 capturers_[capture_id]->set_channel_id(channel);
797 WEBRTC_FUNC(DisconnectCaptureDevice, (const int channel)) {
798 WEBRTC_CHECK_CHANNEL(channel);
799 int capture_id = channels_[channel]->capture_id_;
800 WEBRTC_CHECK_CAPTURER(capture_id);
801 channels_[channel]->capture_id_ = -1;
802 capturers_[capture_id]->set_channel_id(-1);
805 WEBRTC_STUB(StartCapture, (const int, const webrtc::CaptureCapability&));
806 WEBRTC_STUB(StopCapture, (const int));
807 WEBRTC_STUB(SetRotateCapturedFrames, (const int,
808 const webrtc::RotateCapturedFrame));
809 WEBRTC_STUB(SetCaptureDelay, (const int, const unsigned int));
810 WEBRTC_STUB(NumberOfCapabilities, (const char*, const unsigned int));
811 WEBRTC_STUB(GetCaptureCapability, (const char*, const unsigned int,
812 const unsigned int, webrtc::CaptureCapability&));
813 WEBRTC_STUB(ShowCaptureSettingsDialogBox, (const char*, const unsigned int,
814 const char*, void*, const unsigned int, const unsigned int));
815 WEBRTC_STUB(GetOrientation, (const char*, webrtc::RotateCapturedFrame&));
816 WEBRTC_STUB(EnableBrightnessAlarm, (const int, const bool));
817 WEBRTC_STUB(RegisterObserver, (const int, webrtc::ViECaptureObserver&));
818 WEBRTC_STUB(DeregisterObserver, (const int));
820 // webrtc::ViENetwork
821 WEBRTC_VOID_FUNC(SetNetworkTransmissionState, (const int channel,
822 const bool is_transmitting)) {
823 WEBRTC_ASSERT_CHANNEL(channel);
824 channels_[channel]->can_transmit_ = is_transmitting;
826 WEBRTC_STUB(RegisterSendTransport, (const int, webrtc::Transport&));
827 WEBRTC_STUB(DeregisterSendTransport, (const int));
828 WEBRTC_STUB(ReceivedRTPPacket, (const int, const void*, const int,
829 const webrtc::PacketTime&));
830 WEBRTC_STUB(ReceivedRTCPPacket, (const int, const void*, const int));
831 // Not using WEBRTC_STUB due to bool return value
832 virtual bool IsIPv6Enabled(int channel) { return true; }
833 WEBRTC_STUB(SetMTU, (int, unsigned int));
836 WEBRTC_STUB(RegisterVideoRenderModule, (webrtc::VideoRender&));
837 WEBRTC_STUB(DeRegisterVideoRenderModule, (webrtc::VideoRender&));
838 WEBRTC_STUB(AddRenderer, (const int, void*, const unsigned int, const float,
839 const float, const float, const float));
840 WEBRTC_FUNC(RemoveRenderer, (const int render_id)) {
841 if (IsCapturerId(render_id)) {
842 WEBRTC_CHECK_CAPTURER(render_id);
844 } else if (IsChannelId(render_id)) {
845 WEBRTC_CHECK_CHANNEL(render_id);
846 channels_[render_id]->has_renderer_ = false;
851 WEBRTC_FUNC(StartRender, (const int render_id)) {
852 if (IsCapturerId(render_id)) {
853 WEBRTC_CHECK_CAPTURER(render_id);
855 } else if (IsChannelId(render_id)) {
856 WEBRTC_CHECK_CHANNEL(render_id);
857 channels_[render_id]->render_started_ = true;
862 WEBRTC_FUNC(StopRender, (const int render_id)) {
863 if (IsCapturerId(render_id)) {
864 WEBRTC_CHECK_CAPTURER(render_id);
866 } else if (IsChannelId(render_id)) {
867 WEBRTC_CHECK_CHANNEL(render_id);
868 channels_[render_id]->render_started_ = false;
873 WEBRTC_STUB(SetExpectedRenderDelay, (int render_id, int render_delay));
874 WEBRTC_STUB(ConfigureRender, (int, const unsigned int, const float,
875 const float, const float, const float));
876 WEBRTC_STUB(MirrorRenderStream, (const int, const bool, const bool,
878 WEBRTC_FUNC(AddRenderer, (const int render_id,
879 webrtc::RawVideoType video_type,
880 webrtc::ExternalRenderer* renderer)) {
881 if (IsCapturerId(render_id)) {
882 WEBRTC_CHECK_CAPTURER(render_id);
884 } else if (IsChannelId(render_id)) {
885 WEBRTC_CHECK_CHANNEL(render_id);
886 channels_[render_id]->has_renderer_ = true;
892 // webrtc::ViERTP_RTCP
893 WEBRTC_FUNC(SetLocalSSRC, (const int channel,
894 const unsigned int ssrc,
895 const webrtc::StreamType usage,
896 const unsigned char idx)) {
897 WEBRTC_CHECK_CHANNEL(channel);
899 case webrtc::kViEStreamTypeNormal:
900 channels_[channel]->ssrcs_[idx] = ssrc;
902 case webrtc::kViEStreamTypeRtx:
903 channels_[channel]->rtx_ssrcs_[idx] = ssrc;
911 WEBRTC_FUNC_CONST(SetRemoteSSRCType, (const int channel,
912 const webrtc::StreamType usage, const unsigned int ssrc)) {
913 WEBRTC_CHECK_CHANNEL(channel);
914 if (usage == webrtc::kViEStreamTypeRtx) {
915 channels_.find(channel)->second->remote_rtx_ssrc_ = ssrc;
921 WEBRTC_FUNC_CONST(GetLocalSSRC, (const int channel,
922 unsigned int& ssrc)) {
923 // ssrcs_[0] is the default local ssrc.
924 WEBRTC_CHECK_CHANNEL(channel);
925 ssrc = channels_.find(channel)->second->ssrcs_[0];
928 WEBRTC_STUB_CONST(GetRemoteSSRC, (const int, unsigned int&));
929 WEBRTC_STUB_CONST(GetRemoteCSRCs, (const int, unsigned int*));
931 WEBRTC_FUNC(SetRtxSendPayloadType, (const int channel,
932 const uint8 payload_type)) {
933 WEBRTC_CHECK_CHANNEL(channel);
934 channels_[channel]->rtx_send_payload_type = payload_type;
937 WEBRTC_STUB(SetRtxReceivePayloadType, (const int, const uint8));
939 WEBRTC_STUB(SetStartSequenceNumber, (const int, unsigned short));
940 WEBRTC_FUNC(SetRTCPStatus,
941 (const int channel, const webrtc::ViERTCPMode mode)) {
942 WEBRTC_CHECK_CHANNEL(channel);
943 channels_[channel]->rtcp_status_ = mode;
946 WEBRTC_STUB_CONST(GetRTCPStatus, (const int, webrtc::ViERTCPMode&));
947 WEBRTC_FUNC(SetRTCPCName, (const int channel,
948 const char rtcp_cname[KMaxRTCPCNameLength])) {
949 WEBRTC_CHECK_CHANNEL(channel);
950 channels_[channel]->cname_.assign(rtcp_cname);
953 WEBRTC_FUNC_CONST(GetRTCPCName, (const int channel,
954 char rtcp_cname[KMaxRTCPCNameLength])) {
955 WEBRTC_CHECK_CHANNEL(channel);
956 talk_base::strcpyn(rtcp_cname, KMaxRTCPCNameLength,
957 channels_.find(channel)->second->cname_.c_str());
960 WEBRTC_STUB_CONST(GetRemoteRTCPCName, (const int, char*));
961 WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (const int, const unsigned char,
962 unsigned int, const char*, unsigned short));
963 WEBRTC_FUNC(SetNACKStatus, (const int channel, const bool enable)) {
964 WEBRTC_CHECK_CHANNEL(channel);
965 channels_[channel]->nack_ = enable;
966 channels_[channel]->hybrid_nack_fec_ = false;
969 WEBRTC_STUB(SetFECStatus, (const int, const bool, const unsigned char,
970 const unsigned char));
971 WEBRTC_FUNC(SetHybridNACKFECStatus, (const int channel, const bool enable,
972 const unsigned char red_type, const unsigned char fec_type)) {
973 WEBRTC_CHECK_CHANNEL(channel);
974 if (red_type == fec_type ||
975 red_type == channels_[channel]->send_codec.plType ||
976 fec_type == channels_[channel]->send_codec.plType) {
979 channels_[channel]->nack_ = false;
980 channels_[channel]->hybrid_nack_fec_ = enable;
983 WEBRTC_FUNC(SetKeyFrameRequestMethod,
985 const webrtc::ViEKeyFrameRequestMethod method)) {
986 WEBRTC_CHECK_CHANNEL(channel);
987 channels_[channel]->key_frame_request_method_ = method;
990 WEBRTC_FUNC(SetSenderBufferingMode, (int channel, int target_delay)) {
991 WEBRTC_CHECK_CHANNEL(channel);
992 channels_[channel]->sender_target_delay_ = target_delay;
995 WEBRTC_FUNC(SetReceiverBufferingMode, (int channel, int target_delay)) {
996 WEBRTC_CHECK_CHANNEL(channel);
997 channels_[channel]->receiver_target_delay_ = target_delay;
1000 // |Send| and |receive| are stored locally in variables that more clearly
1001 // explain what they mean.
1002 WEBRTC_FUNC(SetRembStatus, (int channel, bool send, bool receive)) {
1003 WEBRTC_CHECK_CHANNEL(channel);
1004 channels_[channel]->remb_contribute_ = receive;
1005 channels_[channel]->remb_bw_partition_ = send;
1008 WEBRTC_FUNC(SetTMMBRStatus, (const int channel, const bool enable)) {
1009 WEBRTC_CHECK_CHANNEL(channel);
1010 channels_[channel]->tmmbr_ = enable;
1013 WEBRTC_FUNC(SetSendTimestampOffsetStatus, (int channel, bool enable,
1015 WEBRTC_CHECK_CHANNEL(channel);
1016 channels_[channel]->rtp_offset_send_id_ = (enable) ? id : 0;
1019 WEBRTC_FUNC(SetReceiveTimestampOffsetStatus, (int channel, bool enable,
1021 WEBRTC_CHECK_CHANNEL(channel);
1022 channels_[channel]->rtp_offset_receive_id_ = (enable) ? id : 0;
1025 WEBRTC_FUNC(SetSendAbsoluteSendTimeStatus, (int channel, bool enable,
1027 WEBRTC_CHECK_CHANNEL(channel);
1028 channels_[channel]->rtp_absolute_send_time_send_id_ = (enable) ? id : 0;
1031 WEBRTC_FUNC(SetReceiveAbsoluteSendTimeStatus, (int channel, bool enable,
1033 WEBRTC_CHECK_CHANNEL(channel);
1034 channels_[channel]->rtp_absolute_send_time_receive_id_ = (enable) ? id : 0;
1037 WEBRTC_STUB(SetRtcpXrRrtrStatus, (int, bool));
1038 WEBRTC_FUNC(SetTransmissionSmoothingStatus, (int channel, bool enable)) {
1039 WEBRTC_CHECK_CHANNEL(channel);
1040 channels_[channel]->transmission_smoothing_ = enable;
1043 WEBRTC_STUB_CONST(GetReceivedRTCPStatistics, (const int, unsigned short&,
1044 unsigned int&, unsigned int&, unsigned int&, int&));
1045 WEBRTC_STUB_CONST(GetSentRTCPStatistics, (const int, unsigned short&,
1046 unsigned int&, unsigned int&, unsigned int&, int&));
1047 WEBRTC_STUB_CONST(GetRTPStatistics, (const int, unsigned int&, unsigned int&,
1048 unsigned int&, unsigned int&));
1049 WEBRTC_STUB_CONST(GetReceiveChannelRtcpStatistics, (const int,
1050 webrtc::RtcpStatistics&, int&));
1051 WEBRTC_STUB_CONST(GetSendChannelRtcpStatistics, (const int,
1052 webrtc::RtcpStatistics&, int&));
1053 WEBRTC_STUB_CONST(GetRtpStatistics, (const int, webrtc::StreamDataCounters&,
1054 webrtc::StreamDataCounters&));
1055 WEBRTC_FUNC_CONST(GetBandwidthUsage, (const int channel,
1056 unsigned int& total_bitrate, unsigned int& video_bitrate,
1057 unsigned int& fec_bitrate, unsigned int& nack_bitrate)) {
1058 WEBRTC_CHECK_CHANNEL(channel);
1059 std::map<int, Channel*>::const_iterator it = channels_.find(channel);
1060 if (it->second->send) {
1061 video_bitrate = it->second->send_video_bitrate_;
1062 fec_bitrate = it->second->send_fec_bitrate_;
1063 nack_bitrate = it->second->send_nack_bitrate_;
1064 total_bitrate = video_bitrate + fec_bitrate + nack_bitrate;
1073 WEBRTC_FUNC_CONST(GetEstimatedSendBandwidth, (const int channel,
1074 unsigned int* send_bandwidth_estimate)) {
1075 WEBRTC_CHECK_CHANNEL(channel);
1076 std::map<int, Channel*>::const_iterator it = channels_.find(channel);
1077 // Assume the current video, fec and nack bitrate sums up to our estimate.
1078 if (it->second->send) {
1079 *send_bandwidth_estimate = it->second->send_bandwidth_;
1081 *send_bandwidth_estimate = 0;
1085 WEBRTC_FUNC_CONST(GetEstimatedReceiveBandwidth, (const int channel,
1086 unsigned int* receive_bandwidth_estimate)) {
1087 WEBRTC_CHECK_CHANNEL(channel);
1088 std::map<int, Channel*>::const_iterator it = channels_.find(channel);
1089 if (it->second->receive_) {
1090 // For simplicity, assume all channels receive half of max send rate.
1091 *receive_bandwidth_estimate = it->second->receive_bandwidth_;
1093 *receive_bandwidth_estimate = 0;
1097 WEBRTC_STUB(RegisterSendChannelRtcpStatisticsCallback,
1098 (int, webrtc::RtcpStatisticsCallback*));
1099 WEBRTC_STUB(DeregisterSendChannelRtcpStatisticsCallback,
1100 (int, webrtc::RtcpStatisticsCallback*));
1101 WEBRTC_STUB(RegisterReceiveChannelRtcpStatisticsCallback,
1102 (int, webrtc::RtcpStatisticsCallback*));
1103 WEBRTC_STUB(DeregisterReceiveChannelRtcpStatisticsCallback,
1104 (int, webrtc::RtcpStatisticsCallback*));
1105 WEBRTC_STUB(RegisterSendChannelRtpStatisticsCallback,
1106 (int, webrtc::StreamDataCountersCallback*));
1107 WEBRTC_STUB(DeregisterSendChannelRtpStatisticsCallback,
1108 (int, webrtc::StreamDataCountersCallback*));
1109 WEBRTC_STUB(RegisterReceiveChannelRtpStatisticsCallback,
1110 (int, webrtc::StreamDataCountersCallback*));
1111 WEBRTC_STUB(DeregisterReceiveChannelRtpStatisticsCallback,
1112 (int, webrtc::StreamDataCountersCallback*));
1113 WEBRTC_STUB(RegisterSendBitrateObserver,
1114 (int, webrtc::BitrateStatisticsObserver*));
1115 WEBRTC_STUB(DeregisterSendBitrateObserver,
1116 (int, webrtc::BitrateStatisticsObserver*));
1117 WEBRTC_STUB(RegisterSendFrameCountObserver,
1118 (int, webrtc::FrameCountObserver*));
1119 WEBRTC_STUB(DeregisterSendFrameCountObserver,
1120 (int, webrtc::FrameCountObserver*));
1122 WEBRTC_STUB(StartRTPDump, (const int, const char*, webrtc::RTPDirections));
1123 WEBRTC_STUB(StopRTPDump, (const int, webrtc::RTPDirections));
1124 WEBRTC_STUB(RegisterRTPObserver, (const int, webrtc::ViERTPObserver&));
1125 WEBRTC_STUB(DeregisterRTPObserver, (const int));
1126 WEBRTC_STUB(RegisterRTCPObserver, (const int, webrtc::ViERTCPObserver&));
1127 WEBRTC_STUB(DeregisterRTCPObserver, (const int));
1129 // webrtc::ViEImageProcess
1130 WEBRTC_STUB(RegisterCaptureEffectFilter, (const int,
1131 webrtc::ViEEffectFilter&));
1132 WEBRTC_STUB(DeregisterCaptureEffectFilter, (const int));
1133 WEBRTC_STUB(RegisterSendEffectFilter, (const int,
1134 webrtc::ViEEffectFilter&));
1135 WEBRTC_STUB(DeregisterSendEffectFilter, (const int));
1136 WEBRTC_STUB(RegisterRenderEffectFilter, (const int,
1137 webrtc::ViEEffectFilter&));
1138 WEBRTC_STUB(DeregisterRenderEffectFilter, (const int));
1139 WEBRTC_STUB(EnableDeflickering, (const int, const bool));
1140 WEBRTC_FUNC(EnableDenoising, (const int capture_id, const bool denoising)) {
1141 WEBRTC_CHECK_CAPTURER(capture_id);
1142 capturers_[capture_id]->set_denoising(denoising);
1145 WEBRTC_STUB(EnableColorEnhancement, (const int, const bool));
1146 WEBRTC_VOID_STUB(RegisterPreEncodeCallback,
1147 (int, webrtc::I420FrameCallback*));
1148 WEBRTC_VOID_STUB(DeRegisterPreEncodeCallback, (int));
1149 WEBRTC_VOID_STUB(RegisterPreRenderCallback,
1150 (int, webrtc::I420FrameCallback*));
1151 WEBRTC_VOID_STUB(DeRegisterPreRenderCallback, (int));
1152 // webrtc::ViEExternalCodec
1153 WEBRTC_FUNC(RegisterExternalSendCodec,
1154 (const int channel, const unsigned char pl_type, webrtc::VideoEncoder*,
1156 WEBRTC_CHECK_CHANNEL(channel);
1157 channels_[channel]->ext_encoder_pl_types_.insert(pl_type);
1160 WEBRTC_FUNC(DeRegisterExternalSendCodec,
1161 (const int channel, const unsigned char pl_type)) {
1162 WEBRTC_CHECK_CHANNEL(channel);
1163 channels_[channel]->ext_encoder_pl_types_.erase(pl_type);
1166 WEBRTC_FUNC(RegisterExternalReceiveCodec,
1167 (const int channel, const unsigned int pl_type, webrtc::VideoDecoder*,
1169 WEBRTC_CHECK_CHANNEL(channel);
1170 channels_[channel]->ext_decoder_pl_types_.insert(pl_type);
1173 WEBRTC_FUNC(DeRegisterExternalReceiveCodec,
1174 (const int channel, const unsigned char pl_type)) {
1175 WEBRTC_CHECK_CHANNEL(channel);
1176 channels_[channel]->ext_decoder_pl_types_.erase(pl_type);
1181 bool IsChannelId(int id) const {
1182 return (id >= kViEChannelIdBase && id <= kViEChannelIdMax);
1184 bool IsCapturerId(int id) const {
1185 return (id >= kViECaptureIdBase && id <= kViECaptureIdMax);
1190 std::map<int, Channel*> channels_;
1191 bool fail_create_channel_;
1193 std::map<int, Capturer*> capturers_;
1194 bool fail_alloc_capturer_;
1195 const cricket::VideoCodec* const* codecs_;
1197 int num_set_send_codecs_; // how many times we call SetSendCodec().
1200 } // namespace cricket
1202 #endif // TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_