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_SESSION_PHONE_FAKEWEBRTCVIDEOENGINE_H_
29
#define TALK_SESSION_PHONE_FAKEWEBRTCVIDEOENGINE_H_
35
#include "talk/base/basictypes.h"
36
#include "talk/base/stringutils.h"
37
#include "talk/session/phone/codec.h"
38
#include "talk/session/phone/fakewebrtccommon.h"
39
#include "talk/session/phone/webrtcvie.h"
43
bool operator==(const webrtc::VideoCodec& c1, const webrtc::VideoCodec& c2) {
44
return memcmp(&c1, &c2, sizeof(c1)) == 0;
51
#define WEBRTC_CHECK_CAPTURER(capturer) \
52
if (capturers_.find(capturer) == capturers_.end()) return -1;
54
#define WEBRTC_ASSERT_CAPTURER(capturer) \
55
ASSERT(capturers_.find(capturer) != capturers_.end());
57
static const int kMinVideoBitrate = 100;
58
static const int kStartVideoBitrate = 300;
59
static const int kMaxVideoBitrate = 1000;
61
// WebRtc channel id and capture id share the same number space.
62
// This is how AddRenderer(renderId, ...) is able to tell if it is adding a
63
// renderer for a channel or it is adding a renderer for a capturer.
64
static const int kViEChannelIdBase = 0;
65
static const int kViEChannelIdMax = 1000;
66
static const int kViECaptureIdBase = 10000; // Make sure there is a gap.
67
static const int kViECaptureIdMax = 11000;
69
class FakeWebRtcVideoEngine
70
: public webrtc::ViEBase,
71
public webrtc::ViECodec,
72
public webrtc::ViECapture,
73
public webrtc::ViENetwork,
74
public webrtc::ViERender,
75
public webrtc::ViERTP_RTCP,
76
public webrtc::ViEImageProcess {
81
original_channel_id_(-1),
83
render_started_(false),
85
rtcp_status_(webrtc::kRtcpNone),
86
key_frame_request_method_(webrtc::kViEKeyFrameRequestNone),
91
hybrid_nack_fec_(false) {
92
ssrcs_[0] = 0; // default ssrc.
93
memset(&send_codec, 0, sizeof(send_codec));
96
int original_channel_id_;
100
std::map<int, int> ssrcs_;
102
webrtc::ViERTCPMode rtcp_status_;
103
webrtc::ViEKeyFrameRequestMethod key_frame_request_method_;
105
bool remb_send_; // This channel send REMB packets.
106
bool remb_; // This channel report BWE using remb.
108
bool hybrid_nack_fec_;
109
std::vector<webrtc::VideoCodec> recv_codecs;
110
webrtc::VideoCodec send_codec;
112
class Capturer : public webrtc::ViEExternalCapture {
114
Capturer() : channel_id_(-1), denoising_(false) { }
115
int channel_id() const { return channel_id_; }
116
void set_channel_id(int channel_id) { channel_id_ = channel_id; }
117
bool denoising() const { return denoising_; }
118
void set_denoising(bool denoising) { denoising_ = denoising; }
120
// From ViEExternalCapture
121
virtual int IncomingFrame(unsigned char* videoFrame,
122
unsigned int videoFrameLength,
123
unsigned short width,
124
unsigned short height,
125
webrtc::RawVideoType videoType,
126
unsigned long long captureTime) {
129
virtual int IncomingFrameI420(
130
const webrtc::ViEVideoFrameI420& video_frame,
131
unsigned long long captureTime) {
140
FakeWebRtcVideoEngine(const cricket::VideoCodec* const* codecs,
143
last_channel_(kViEChannelIdBase - 1),
144
fail_create_channel_(false),
145
last_capturer_(kViECaptureIdBase - 1),
146
fail_alloc_capturer_(false),
148
num_codecs_(num_codecs) {
151
~FakeWebRtcVideoEngine() {
152
ASSERT(0 == channels_.size());
153
ASSERT(0 == capturers_.size());
155
bool IsInited() const { return inited_; }
157
int GetLastChannel() const { return last_channel_; }
158
int GetNumChannels() const { return channels_.size(); }
159
bool IsChannel(int channel) const {
160
return (channels_.find(channel) != channels_.end());
162
void set_fail_create_channel(bool fail_create_channel) {
163
fail_create_channel_ = fail_create_channel;
166
int GetLastCapturer() const { return last_capturer_; }
167
int GetNumCapturers() const { return capturers_.size(); }
168
void set_fail_alloc_capturer(bool fail_alloc_capturer) {
169
fail_alloc_capturer_ = fail_alloc_capturer;
172
int GetCaptureId(int channel) const {
173
WEBRTC_ASSERT_CHANNEL(channel);
174
return channels_.find(channel)->second->capture_id_;
176
int GetOriginalChannelId(int channel) const {
177
WEBRTC_ASSERT_CHANNEL(channel);
178
return channels_.find(channel)->second->original_channel_id_;
180
bool GetHasRenderer(int channel) const {
181
WEBRTC_ASSERT_CHANNEL(channel);
182
return channels_.find(channel)->second->has_renderer_;
184
bool GetRenderStarted(int channel) const {
185
WEBRTC_ASSERT_CHANNEL(channel);
186
return channels_.find(channel)->second->render_started_;
188
bool GetSend(int channel) const {
189
WEBRTC_ASSERT_CHANNEL(channel);
190
return channels_.find(channel)->second->send;
192
int GetCaptureChannelId(int capture_id) const {
193
WEBRTC_ASSERT_CAPTURER(capture_id);
194
return capturers_.find(capture_id)->second->channel_id();
196
bool GetCaptureDenoising(int capture_id) const {
197
WEBRTC_ASSERT_CAPTURER(capture_id);
198
return capturers_.find(capture_id)->second->denoising();
200
webrtc::ViERTCPMode GetRtcpStatus(int channel) const {
201
WEBRTC_ASSERT_CHANNEL(channel);
202
return channels_.find(channel)->second->rtcp_status_;
204
webrtc::ViEKeyFrameRequestMethod GetKeyFrameRequestMethod(int channel) const {
205
WEBRTC_ASSERT_CHANNEL(channel);
206
return channels_.find(channel)->second->key_frame_request_method_;
208
bool GetTmmbrStatus(int channel) const {
209
WEBRTC_ASSERT_CHANNEL(channel);
210
return channels_.find(channel)->second->tmmbr_;
212
bool GetRembStatus(int channel) const {
213
WEBRTC_ASSERT_CHANNEL(channel);
214
return channels_.find(channel)->second->remb_;
216
bool GetRembStatusSend(int channel) const {
217
WEBRTC_ASSERT_CHANNEL(channel);
218
return channels_.find(channel)->second->remb_send_;
220
bool GetNackStatus(int channel) const {
221
WEBRTC_ASSERT_CHANNEL(channel);
222
return channels_.find(channel)->second->nack_;
224
bool GetHybridNackFecStatus(int channel) const {
225
WEBRTC_ASSERT_CHANNEL(channel);
226
return channels_.find(channel)->second->hybrid_nack_fec_;
228
int GetNumSsrcs(int channel) const {
229
WEBRTC_ASSERT_CHANNEL(channel);
230
return channels_.find(channel)->second->ssrcs_.size();
232
int GetSimulcastSsrc(int channel,
233
int simulcast_idx) const {
234
WEBRTC_ASSERT_CHANNEL(channel);
235
if (channels_.find(channel)->second->ssrcs_.find(simulcast_idx) ==
236
channels_.find(channel)->second->ssrcs_.end()) {
239
return channels_.find(channel)->second->ssrcs_[simulcast_idx];
241
bool ReceiveCodecRegistered(int channel,
242
const webrtc::VideoCodec& codec) const {
243
WEBRTC_ASSERT_CHANNEL(channel);
244
const std::vector<webrtc::VideoCodec>& codecs =
245
channels_.find(channel)->second->recv_codecs;
246
return std::find(codecs.begin(), codecs.end(), codec) != codecs.end();
249
WEBRTC_STUB(Release, ());
252
WEBRTC_FUNC(Init, ()) {
256
WEBRTC_STUB(SetVoiceEngine, (webrtc::VoiceEngine*));
257
WEBRTC_FUNC(CreateChannel, (int& channel)) { // NOLINT
258
if (fail_create_channel_) {
261
if (kViEChannelIdMax == last_channel_) {
264
Channel* ch = new Channel();
265
channels_[++last_channel_] = ch;
266
channel = last_channel_;
269
WEBRTC_FUNC(CreateChannel, (int& channel, int original_channel)) {
270
WEBRTC_CHECK_CHANNEL(original_channel);
271
if (CreateChannel(channel) != 0) {
274
channels_[channel]->original_channel_id_ = original_channel;
277
WEBRTC_FUNC(CreateReceiveChannel, (int& channel, int original_channel)) {
278
return CreateChannel(channel, original_channel);
280
WEBRTC_FUNC(DeleteChannel, (const int channel)) {
281
WEBRTC_CHECK_CHANNEL(channel);
282
delete channels_[channel];
283
channels_.erase(channel);
286
WEBRTC_STUB(ConnectAudioChannel, (const int, const int));
287
WEBRTC_STUB(DisconnectAudioChannel, (const int));
288
WEBRTC_FUNC(StartSend, (const int channel)) {
289
WEBRTC_CHECK_CHANNEL(channel);
290
channels_[channel]->send = true;
293
WEBRTC_FUNC(StopSend, (const int channel)) {
294
WEBRTC_CHECK_CHANNEL(channel);
295
channels_[channel]->send = false;
298
WEBRTC_STUB(StartReceive, (const int));
299
WEBRTC_STUB(StopReceive, (const int));
300
WEBRTC_STUB(RegisterObserver, (webrtc::ViEBaseObserver&));
301
WEBRTC_STUB(DeregisterObserver, ());
302
WEBRTC_STUB(GetVersion, (char version[1024]));
303
WEBRTC_STUB(LastError, ());
306
WEBRTC_FUNC(NumberOfCodecs, ()) const {
309
WEBRTC_FUNC(GetCodec, (const unsigned char list_number,
310
webrtc::VideoCodec& out_codec)) const {
311
if (list_number >= NumberOfCodecs()) {
314
memset(&out_codec, 0, sizeof(out_codec));
315
const cricket::VideoCodec& c(*codecs_[list_number]);
316
if ("I420" == c.name) {
317
out_codec.codecType = webrtc::kVideoCodecI420;
318
} else if ("VP8" == c.name) {
319
out_codec.codecType = webrtc::kVideoCodecVP8;
320
} else if ("red" == c.name) {
321
out_codec.codecType = webrtc::kVideoCodecRED;
322
} else if ("ulpfec" == c.name) {
323
out_codec.codecType = webrtc::kVideoCodecULPFEC;
325
out_codec.codecType = webrtc::kVideoCodecUnknown;
327
talk_base::strcpyn(out_codec.plName, sizeof(out_codec.plName),
329
out_codec.plType = c.id;
330
out_codec.width = c.width;
331
out_codec.height = c.height;
332
out_codec.startBitrate = kStartVideoBitrate;
333
out_codec.maxBitrate = kMaxVideoBitrate;
334
out_codec.minBitrate = kMinVideoBitrate;
335
out_codec.maxFramerate = c.framerate;
338
WEBRTC_FUNC(SetSendCodec, (const int channel,
339
const webrtc::VideoCodec& codec)) {
340
WEBRTC_CHECK_CHANNEL(channel);
341
channels_[channel]->send_codec = codec;
344
WEBRTC_FUNC(GetSendCodec, (const int channel,
345
webrtc::VideoCodec& codec)) const { // NOLINT
346
WEBRTC_CHECK_CHANNEL(channel);
347
codec = channels_.find(channel)->second->send_codec;
350
WEBRTC_FUNC(SetReceiveCodec, (const int channel,
351
const webrtc::VideoCodec& codec)) { // NOLINT
352
WEBRTC_CHECK_CHANNEL(channel);
353
channels_[channel]->recv_codecs.push_back(codec);
356
WEBRTC_STUB_CONST(GetReceiveCodec, (const int, webrtc::VideoCodec&));
357
WEBRTC_STUB_CONST(GetCodecConfigParameters, (const int,
358
unsigned char*, unsigned char&));
359
WEBRTC_STUB(SetImageScaleStatus, (const int, const bool));
360
WEBRTC_STUB_CONST(GetSendCodecStastistics, (const int,
361
unsigned int&, unsigned int&));
362
WEBRTC_STUB_CONST(GetReceiveCodecStastistics, (const int,
363
unsigned int&, unsigned int&));
364
WEBRTC_STUB_CONST(GetCodecTargetBitrate, (const int, unsigned int*));
365
virtual unsigned int GetDiscardedPackets(const int channel) const {
369
WEBRTC_STUB(SetKeyFrameRequestCallbackStatus, (const int, const bool));
370
WEBRTC_STUB(SetSignalKeyPacketLossStatus, (const int, const bool,
372
WEBRTC_STUB(RegisterEncoderObserver, (const int,
373
webrtc::ViEEncoderObserver&));
374
WEBRTC_STUB(DeregisterEncoderObserver, (const int));
375
WEBRTC_STUB(RegisterDecoderObserver, (const int,
376
webrtc::ViEDecoderObserver&));
377
WEBRTC_STUB(DeregisterDecoderObserver, (const int));
378
WEBRTC_STUB(SendKeyFrame, (const int));
379
WEBRTC_STUB(WaitForFirstKeyFrame, (const int, const bool));
380
WEBRTC_STUB(SetInverseH263Logic, (int, bool));
382
// webrtc::ViECapture
383
WEBRTC_STUB(NumberOfCaptureDevices, ());
384
WEBRTC_STUB(GetCaptureDevice, (unsigned int, char*,
385
const unsigned int, char*, const unsigned int));
386
WEBRTC_STUB(AllocateCaptureDevice, (const char*, const unsigned int, int&));
387
WEBRTC_FUNC(AllocateExternalCaptureDevice,
388
(int& capture_id, webrtc::ViEExternalCapture*& capture)) {
389
if (fail_alloc_capturer_) {
392
if (kViECaptureIdMax == last_capturer_) {
395
Capturer* cap = new Capturer();
396
capturers_[++last_capturer_] = cap;
397
capture_id = last_capturer_;
401
WEBRTC_STUB(AllocateCaptureDevice, (webrtc::VideoCaptureModule&, int&));
402
WEBRTC_FUNC(ReleaseCaptureDevice, (const int capture_id)) {
403
WEBRTC_CHECK_CAPTURER(capture_id);
404
delete capturers_[capture_id];
405
capturers_.erase(capture_id);
408
WEBRTC_FUNC(ConnectCaptureDevice, (const int capture_id,
409
const int channel)) {
410
WEBRTC_CHECK_CHANNEL(channel);
411
WEBRTC_CHECK_CAPTURER(capture_id);
412
channels_[channel]->capture_id_ = capture_id;
413
capturers_[capture_id]->set_channel_id(channel);
416
WEBRTC_FUNC(DisconnectCaptureDevice, (const int channel)) {
417
WEBRTC_CHECK_CHANNEL(channel);
418
int capture_id = channels_[channel]->capture_id_;
419
WEBRTC_CHECK_CAPTURER(capture_id);
420
channels_[channel]->capture_id_ = -1;
421
capturers_[capture_id]->set_channel_id(-1);
424
WEBRTC_STUB(StartCapture, (const int, const webrtc::CaptureCapability&));
425
WEBRTC_STUB(StopCapture, (const int));
426
WEBRTC_STUB(SetRotateCapturedFrames, (const int,
427
const webrtc::RotateCapturedFrame));
428
WEBRTC_STUB(SetCaptureDelay, (const int, const unsigned int));
429
WEBRTC_STUB(NumberOfCapabilities, (const char*, const unsigned int));
430
WEBRTC_STUB(GetCaptureCapability, (const char*, const unsigned int,
431
const unsigned int, webrtc::CaptureCapability&));
432
WEBRTC_STUB(ShowCaptureSettingsDialogBox, (const char*, const unsigned int,
433
const char*, void*, const unsigned int, const unsigned int));
434
WEBRTC_STUB(GetOrientation, (const char*, webrtc::RotateCapturedFrame&));
435
WEBRTC_STUB(EnableBrightnessAlarm, (const int, const bool));
436
WEBRTC_STUB(RegisterObserver, (const int, webrtc::ViECaptureObserver&));
437
WEBRTC_STUB(DeregisterObserver, (const int));
439
// webrtc::ViENetwork
440
WEBRTC_STUB(SetLocalReceiver, (const int, const unsigned short,
441
const unsigned short, const char*));
442
WEBRTC_STUB(GetLocalReceiver, (const int, unsigned short&,
443
unsigned short&, char*));
444
WEBRTC_STUB(SetSendDestination, (const int, const char*, const unsigned short,
445
const unsigned short, const unsigned short, const unsigned short));
446
WEBRTC_STUB(GetSendDestination, (const int, char*, unsigned short&,
447
unsigned short&, unsigned short&, unsigned short&));
448
WEBRTC_STUB(RegisterSendTransport, (const int, webrtc::Transport&));
449
WEBRTC_STUB(DeregisterSendTransport, (const int));
450
WEBRTC_STUB(ReceivedRTPPacket, (const int, const void*, const int));
451
WEBRTC_STUB(ReceivedRTCPPacket, (const int, const void*, const int));
452
WEBRTC_STUB(GetSourceInfo, (const int, unsigned short&, unsigned short&,
453
char*, unsigned int));
454
WEBRTC_STUB(GetLocalIP, (char*, bool));
455
WEBRTC_STUB(EnableIPv6, (int));
456
// Not using WEBRTC_STUB due to bool return value
457
virtual bool IsIPv6Enabled(int channel) { return true; }
458
WEBRTC_STUB(SetSourceFilter, (const int, const unsigned short,
459
const unsigned short, const char*));
460
WEBRTC_STUB(GetSourceFilter, (const int, unsigned short&,
461
unsigned short&, char*));
462
WEBRTC_STUB(SetSendToS, (const int, const int, const bool));
463
WEBRTC_STUB(GetSendToS, (const int, int&, bool&));
464
WEBRTC_STUB(SetSendGQoS, (const int, const bool, const int, const int));
465
WEBRTC_STUB(GetSendGQoS, (const int, bool&, int&, int&));
466
WEBRTC_STUB(SetMTU, (int, unsigned int));
467
WEBRTC_STUB(SetPacketTimeoutNotification, (const int, bool, int));
468
WEBRTC_STUB(RegisterObserver, (const int, webrtc::ViENetworkObserver&));
469
WEBRTC_STUB(SetPeriodicDeadOrAliveStatus, (const int, const bool,
470
const unsigned int));
471
WEBRTC_STUB(SendUDPPacket, (const int, const void*, const unsigned int,
475
WEBRTC_STUB(RegisterVideoRenderModule, (webrtc::VideoRender&));
476
WEBRTC_STUB(DeRegisterVideoRenderModule, (webrtc::VideoRender&));
477
WEBRTC_STUB(AddRenderer, (const int, void*, const unsigned int, const float,
478
const float, const float, const float));
479
WEBRTC_FUNC(RemoveRenderer, (const int render_id)) {
480
if (IsCapturerId(render_id)) {
481
WEBRTC_CHECK_CAPTURER(render_id);
483
} else if (IsChannelId(render_id)) {
484
WEBRTC_CHECK_CHANNEL(render_id);
485
channels_[render_id]->has_renderer_ = false;
490
WEBRTC_FUNC(StartRender, (const int render_id)) {
491
if (IsCapturerId(render_id)) {
492
WEBRTC_CHECK_CAPTURER(render_id);
494
} else if (IsChannelId(render_id)) {
495
WEBRTC_CHECK_CHANNEL(render_id);
496
channels_[render_id]->render_started_ = true;
501
WEBRTC_FUNC(StopRender, (const int render_id)) {
502
if (IsCapturerId(render_id)) {
503
WEBRTC_CHECK_CAPTURER(render_id);
505
} else if (IsChannelId(render_id)) {
506
WEBRTC_CHECK_CHANNEL(render_id);
507
channels_[render_id]->render_started_ = false;
512
WEBRTC_STUB(ConfigureRender, (int, const unsigned int, const float,
513
const float, const float, const float));
514
WEBRTC_STUB(MirrorRenderStream, (const int, const bool, const bool,
516
WEBRTC_FUNC(AddRenderer, (const int render_id,
517
webrtc::RawVideoType video_type,
518
webrtc::ExternalRenderer* renderer)) {
519
if (IsCapturerId(render_id)) {
520
WEBRTC_CHECK_CAPTURER(render_id);
522
} else if (IsChannelId(render_id)) {
523
WEBRTC_CHECK_CHANNEL(render_id);
524
channels_[render_id]->has_renderer_ = true;
530
// webrtc::ViERTP_RTCP
531
WEBRTC_FUNC(SetLocalSSRC, (const int channel,
532
const unsigned int ssrc,
533
const webrtc::StreamType usage,
534
const unsigned char simulcast_idx)) {
535
// default simulcast_idx is 0.
536
WEBRTC_CHECK_CHANNEL(channel);
537
channels_[channel]->ssrcs_[simulcast_idx] = ssrc;
540
WEBRTC_STUB_CONST(SetRemoteSSRCType, (const int,
541
const webrtc::StreamType, const unsigned int));
543
WEBRTC_FUNC_CONST(GetLocalSSRC, (const int channel,
544
unsigned int& ssrc)) {
545
// ssrcs_[0] is the default local ssrc.
546
WEBRTC_CHECK_CHANNEL(channel);
547
ssrc = channels_.find(channel)->second->ssrcs_[0];
550
WEBRTC_STUB_CONST(GetRemoteSSRC, (const int, unsigned int&));
551
WEBRTC_STUB_CONST(GetRemoteCSRCs, (const int, unsigned int*));
552
WEBRTC_STUB(SetStartSequenceNumber, (const int, unsigned short));
553
WEBRTC_FUNC(SetRTCPStatus,
554
(const int channel, const webrtc::ViERTCPMode mode)) {
555
WEBRTC_CHECK_CHANNEL(channel);
556
channels_[channel]->rtcp_status_ = mode;
559
WEBRTC_STUB_CONST(GetRTCPStatus, (const int, webrtc::ViERTCPMode&));
560
WEBRTC_FUNC(SetRTCPCName, (const int channel,
561
const char rtcp_cname[KMaxRTCPCNameLength])) {
562
WEBRTC_CHECK_CHANNEL(channel);
563
channels_[channel]->cname_.assign(rtcp_cname);
566
WEBRTC_FUNC_CONST(GetRTCPCName, (const int channel,
567
char rtcp_cname[KMaxRTCPCNameLength])) {
568
WEBRTC_CHECK_CHANNEL(channel);
569
talk_base::strcpyn(rtcp_cname, KMaxRTCPCNameLength,
570
channels_.find(channel)->second->cname_.c_str());
573
WEBRTC_STUB_CONST(GetRemoteRTCPCName, (const int, char*));
574
WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (const int, const unsigned char,
575
unsigned int, const char*, unsigned short));
576
WEBRTC_FUNC(SetNACKStatus, (const int channel, const bool enable)) {
577
WEBRTC_CHECK_CHANNEL(channel);
578
channels_[channel]->nack_ = enable;
579
channels_[channel]->hybrid_nack_fec_ = false;
582
WEBRTC_STUB(SetFECStatus, (const int, const bool, const unsigned char,
583
const unsigned char));
584
WEBRTC_FUNC(SetHybridNACKFECStatus, (const int channel, const bool enable,
585
const unsigned char red_type, const unsigned char fec_type)) {
586
WEBRTC_CHECK_CHANNEL(channel);
587
if (red_type == fec_type ||
588
red_type == channels_[channel]->send_codec.plType ||
589
fec_type == channels_[channel]->send_codec.plType) {
592
channels_[channel]->nack_ = false;
593
channels_[channel]->hybrid_nack_fec_ = true;
596
WEBRTC_FUNC(SetKeyFrameRequestMethod,
598
const webrtc::ViEKeyFrameRequestMethod method)) {
599
WEBRTC_CHECK_CHANNEL(channel);
600
channels_[channel]->key_frame_request_method_ = method;
603
WEBRTC_FUNC(SetRembStatus, (int channel, bool send, bool receive)) {
604
WEBRTC_CHECK_CHANNEL(channel);
605
channels_[channel]->remb_send_ = send;
606
channels_[channel]->remb_ = receive;
609
WEBRTC_FUNC(SetTMMBRStatus, (const int channel, const bool enable)) {
610
WEBRTC_CHECK_CHANNEL(channel);
611
channels_[channel]->tmmbr_ = enable;
614
WEBRTC_STUB_CONST(GetReceivedRTCPStatistics, (const int, unsigned short&,
615
unsigned int&, unsigned int&, unsigned int&, int&));
616
WEBRTC_STUB_CONST(GetSentRTCPStatistics, (const int, unsigned short&,
617
unsigned int&, unsigned int&, unsigned int&, int&));
618
WEBRTC_STUB_CONST(GetRTPStatistics, (const int, unsigned int&, unsigned int&,
619
unsigned int&, unsigned int&));
620
WEBRTC_STUB_CONST(GetBandwidthUsage, (const int, unsigned int&,
621
unsigned int&, unsigned int&, unsigned int&));
622
WEBRTC_STUB_CONST(GetEstimatedSendBandwidth, (const int, unsigned int*));
623
WEBRTC_STUB_CONST(GetEstimatedReceiveBandwidth, (const int, unsigned int*));
625
WEBRTC_STUB(SetRTPKeepAliveStatus, (const int, bool, const int,
626
const unsigned int));
627
WEBRTC_STUB_CONST(GetRTPKeepAliveStatus,
628
(const int, bool&, int&, unsigned int&));
629
WEBRTC_STUB(StartRTPDump, (const int, const char*, webrtc::RTPDirections));
630
WEBRTC_STUB(StopRTPDump, (const int, webrtc::RTPDirections));
631
WEBRTC_STUB(RegisterRTPObserver, (const int, webrtc::ViERTPObserver&));
632
WEBRTC_STUB(DeregisterRTPObserver, (const int));
633
WEBRTC_STUB(RegisterRTCPObserver, (const int, webrtc::ViERTCPObserver&));
634
WEBRTC_STUB(DeregisterRTCPObserver, (const int));
636
// webrtc::ViEImageProcess
637
WEBRTC_STUB(RegisterCaptureEffectFilter, (const int,
638
webrtc::ViEEffectFilter&));
639
WEBRTC_STUB(DeregisterCaptureEffectFilter, (const int));
640
WEBRTC_STUB(RegisterSendEffectFilter, (const int,
641
webrtc::ViEEffectFilter&));
642
WEBRTC_STUB(DeregisterSendEffectFilter, (const int));
643
WEBRTC_STUB(RegisterRenderEffectFilter, (const int,
644
webrtc::ViEEffectFilter&));
645
WEBRTC_STUB(DeregisterRenderEffectFilter, (const int));
646
WEBRTC_STUB(EnableDeflickering, (const int, const bool));
647
WEBRTC_FUNC(EnableDenoising, (const int capture_id, const bool denoising)) {
648
WEBRTC_CHECK_CAPTURER(capture_id);
649
capturers_[capture_id]->set_denoising(denoising);
652
WEBRTC_STUB(EnableColorEnhancement, (const int, const bool));
655
bool IsChannelId(int id) const {
656
return (id >= kViEChannelIdBase && id <= kViEChannelIdMax);
658
bool IsCapturerId(int id) const {
659
return (id >= kViECaptureIdBase && id <= kViECaptureIdMax);
664
std::map<int, Channel*> channels_;
665
bool fail_create_channel_;
667
std::map<int, Capturer*> capturers_;
668
bool fail_alloc_capturer_;
669
const cricket::VideoCodec* const* codecs_;
673
} // namespace cricket
675
#endif // TALK_SESSION_PHONE_FAKEWEBRTCVIDEOENGINE_H_