~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to protocols/jabber/googletalk/libjingle/talk/session/phone/fakewebrtcvoiceengine.h

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * libjingle
3
 
 * Copyright 2010, Google Inc.
4
 
 *
5
 
 * Redistribution and use in source and binary forms, with or without
6
 
 * modification, are permitted provided that the following conditions are met:
7
 
 *
8
 
 *  1. Redistributions of source code must retain the above copyright notice,
9
 
 *     this list of conditions and the following disclaimer.
10
 
 *  2. Redistributions in binary form must reproduce the above copyright notice,
11
 
 *     this list of conditions and the following disclaimer in the documentation
12
 
 *     and/or other materials provided with the distribution.
13
 
 *  3. The name of the author may not be used to endorse or promote products
14
 
 *     derived from this software without specific prior written permission.
15
 
 *
16
 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17
 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
 
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19
 
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22
 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23
 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25
 
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 
 */
27
 
 
28
 
#ifndef TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
29
 
#define TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
30
 
 
31
 
#include <list>
32
 
#include <map>
33
 
#include <vector>
34
 
 
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/voiceprocessor.h"
40
 
#include "talk/session/phone/webrtcvoe.h"
41
 
 
42
 
namespace cricket {
43
 
 
44
 
static const char kFakeDefaultDeviceName[] = "Fake Default";
45
 
static const int kFakeDefaultDeviceId = -1;
46
 
static const char kFakeDeviceName[] = "Fake Device";
47
 
#ifdef WIN32
48
 
static const int kFakeDeviceId = 0;
49
 
#else
50
 
static const int kFakeDeviceId = 1;
51
 
#endif
52
 
 
53
 
class FakeWebRtcVoiceEngine
54
 
    : public webrtc::VoEAudioProcessing,
55
 
      public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
56
 
      public webrtc::VoEFile, public webrtc::VoEHardware,
57
 
      public webrtc::VoEExternalMedia, public webrtc::VoENetEqStats,
58
 
      public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
59
 
      public webrtc::VoEVideoSync, public webrtc::VoEVolumeControl {
60
 
 public:
61
 
  struct Channel {
62
 
    Channel()
63
 
        : external_transport(false),
64
 
          send(false),
65
 
          playout(false),
66
 
          file(false),
67
 
          vad(false),
68
 
          fec(false),
69
 
          media_processor_registered(false),
70
 
          cn8_type(13),
71
 
          cn16_type(105),
72
 
          dtmf_type(106),
73
 
          fec_type(117),
74
 
          send_ssrc(0),
75
 
          level_header_ext_(-1) {
76
 
      memset(&send_codec, 0, sizeof(send_codec));
77
 
    }
78
 
    bool external_transport;
79
 
    bool send;
80
 
    bool playout;
81
 
    bool file;
82
 
    bool vad;
83
 
    bool fec;
84
 
    bool media_processor_registered;
85
 
    int cn8_type;
86
 
    int cn16_type;
87
 
    int dtmf_type;
88
 
    int fec_type;
89
 
    uint32 send_ssrc;
90
 
    int level_header_ext_;
91
 
    std::vector<webrtc::CodecInst> recv_codecs;
92
 
    webrtc::CodecInst send_codec;
93
 
    std::list<std::string> packets;
94
 
  };
95
 
 
96
 
  FakeWebRtcVoiceEngine(const cricket::AudioCodec* const* codecs,
97
 
                        int num_codecs)
98
 
      : inited_(false),
99
 
        last_channel_(-1),
100
 
        fail_create_channel_(false),
101
 
        codecs_(codecs),
102
 
        num_codecs_(num_codecs),
103
 
        ec_enabled_(false),
104
 
        ns_enabled_(false),
105
 
        ec_mode_(webrtc::kEcDefault),
106
 
        ns_mode_(webrtc::kNsDefault),
107
 
        observer_(NULL),
108
 
        playout_fail_channel_(-1),
109
 
        send_fail_channel_(-1),
110
 
        fail_start_recording_microphone_(false),
111
 
        recording_microphone_(false),
112
 
        media_processor_(NULL) {
113
 
    memset(&agc_config_, 0, sizeof(agc_config_));
114
 
  }
115
 
  ~FakeWebRtcVoiceEngine() {
116
 
    // Ought to have all been deleted by the WebRtcVoiceMediaChannel
117
 
    // destructors, but just in case ...
118
 
    for (std::map<int, Channel*>::const_iterator i = channels_.begin();
119
 
         i != channels_.end(); ++i) {
120
 
      delete i->second;
121
 
    }
122
 
  }
123
 
  bool IsExternalMediaProcessorRegistered() const {
124
 
    return media_processor_ != NULL;
125
 
  }
126
 
  bool IsInited() const { return inited_; }
127
 
  int GetLastChannel() const { return last_channel_; }
128
 
  int GetNumChannels() const { return channels_.size(); }
129
 
  bool GetPlayout(int channel) {
130
 
    return channels_[channel]->playout;
131
 
  }
132
 
  bool GetSend(int channel) {
133
 
    return channels_[channel]->send;
134
 
  }
135
 
  bool GetRecordingMicrophone() {
136
 
    return recording_microphone_;
137
 
  }
138
 
  bool GetVAD(int channel) {
139
 
    return channels_[channel]->vad;
140
 
  }
141
 
  bool GetFEC(int channel) {
142
 
    return channels_[channel]->fec;
143
 
  }
144
 
  int GetSendCNPayloadType(int channel, bool wideband) {
145
 
    return (wideband) ?
146
 
        channels_[channel]->cn16_type :
147
 
        channels_[channel]->cn8_type;
148
 
  }
149
 
  int GetSendTelephoneEventPayloadType(int channel) {
150
 
    return channels_[channel]->dtmf_type;
151
 
  }
152
 
  int GetSendFECPayloadType(int channel) {
153
 
    return channels_[channel]->fec_type;
154
 
  }
155
 
  bool CheckPacket(int channel, const void* data, size_t len) {
156
 
    bool result = !CheckNoPacket(channel);
157
 
    if (result) {
158
 
      std::string packet = channels_[channel]->packets.front();
159
 
      result = (packet == std::string(static_cast<const char*>(data), len));
160
 
      channels_[channel]->packets.pop_front();
161
 
    }
162
 
    return result;
163
 
  }
164
 
  bool CheckNoPacket(int channel) {
165
 
    return channels_[channel]->packets.empty();
166
 
  }
167
 
  void TriggerCallbackOnError(int channel_num, int err_code) {
168
 
    ASSERT(observer_ != NULL);
169
 
    observer_->CallbackOnError(channel_num, err_code);
170
 
  }
171
 
  void set_playout_fail_channel(int channel) {
172
 
    playout_fail_channel_ = channel;
173
 
  }
174
 
  void set_send_fail_channel(int channel) {
175
 
    send_fail_channel_ = channel;
176
 
  }
177
 
  void set_fail_start_recording_microphone(
178
 
      bool fail_start_recording_microphone) {
179
 
    fail_start_recording_microphone_ = fail_start_recording_microphone;
180
 
  }
181
 
  void set_fail_create_channel(bool fail_create_channel) {
182
 
    fail_create_channel_ = fail_create_channel;
183
 
  }
184
 
  void TriggerProcessPacket(MediaProcessorDirection direction) {
185
 
    webrtc::ProcessingTypes pt =
186
 
        (direction == cricket::MPD_TX) ?
187
 
            webrtc::kRecordingPerChannel : webrtc::kPlaybackPerChannel;
188
 
    if (media_processor_ != NULL) {
189
 
      media_processor_->Process(0,
190
 
                                pt,
191
 
                                NULL,
192
 
                                0,
193
 
                                0,
194
 
                                true);
195
 
    }
196
 
  }
197
 
 
198
 
  WEBRTC_STUB(Release, ());
199
 
 
200
 
  // webrtc::VoEBase
201
 
  WEBRTC_FUNC(RegisterVoiceEngineObserver, (
202
 
      webrtc::VoiceEngineObserver& observer)) {
203
 
    observer_ = &observer;
204
 
    return 0;
205
 
  }
206
 
  WEBRTC_STUB(DeRegisterVoiceEngineObserver, ());
207
 
  WEBRTC_STUB(RegisterAudioDeviceModule, (webrtc::AudioDeviceModule& adm));
208
 
  WEBRTC_STUB(DeRegisterAudioDeviceModule, ());
209
 
 
210
 
  WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm)) {
211
 
    inited_ = true;
212
 
    return 0;
213
 
  }
214
 
  WEBRTC_FUNC(Terminate, ()) {
215
 
    inited_ = false;
216
 
    return 0;
217
 
  }
218
 
  WEBRTC_STUB(MaxNumOfChannels, ());
219
 
  WEBRTC_FUNC(CreateChannel, ()) {
220
 
    if (fail_create_channel_) {
221
 
      return -1;
222
 
    }
223
 
    Channel* ch = new Channel();
224
 
    for (int i = 0; i < NumOfCodecs(); ++i) {
225
 
      webrtc::CodecInst codec;
226
 
      GetCodec(i, codec);
227
 
      ch->recv_codecs.push_back(codec);
228
 
    }
229
 
    channels_[++last_channel_] = ch;
230
 
    return last_channel_;
231
 
  }
232
 
  WEBRTC_FUNC(DeleteChannel, (int channel)) {
233
 
    WEBRTC_CHECK_CHANNEL(channel);
234
 
    delete channels_[channel];
235
 
    channels_.erase(channel);
236
 
    return 0;
237
 
  }
238
 
  WEBRTC_STUB(SetLocalReceiver, (int channel, int port, int RTCPport,
239
 
                                 const char ipaddr[64],
240
 
                                 const char multiCastAddr[64]));
241
 
  WEBRTC_STUB(GetLocalReceiver, (int channel, int& port, int& RTCPport,
242
 
                                 char ipaddr[64]));
243
 
  WEBRTC_STUB(SetSendDestination, (int channel, int port,
244
 
                                   const char ipaddr[64],
245
 
                                   int sourcePort, int RTCPport));
246
 
  WEBRTC_STUB(GetSendDestination, (int channel, int& port, char ipaddr[64],
247
 
                                   int& sourcePort, int& RTCPport));
248
 
  WEBRTC_STUB(StartReceive, (int channel));
249
 
  WEBRTC_FUNC(StartPlayout, (int channel)) {
250
 
    if (playout_fail_channel_ != channel) {
251
 
      WEBRTC_CHECK_CHANNEL(channel);
252
 
      channels_[channel]->playout = true;
253
 
      return 0;
254
 
    } else {
255
 
      // When playout_fail_channel_ == channel, fail the StartPlayout on this
256
 
      // channel.
257
 
      return -1;
258
 
    }
259
 
  }
260
 
  WEBRTC_FUNC(StartSend, (int channel)) {
261
 
    if (send_fail_channel_ != channel) {
262
 
      WEBRTC_CHECK_CHANNEL(channel);
263
 
      channels_[channel]->send = true;
264
 
      return 0;
265
 
    } else {
266
 
      // When send_fail_channel_ == channel, fail the StartSend on this
267
 
      // channel.
268
 
      return -1;
269
 
    }
270
 
  }
271
 
  WEBRTC_STUB(StopReceive, (int channel));
272
 
  WEBRTC_FUNC(StopPlayout, (int channel)) {
273
 
    WEBRTC_CHECK_CHANNEL(channel);
274
 
    channels_[channel]->playout = false;
275
 
    return 0;
276
 
  }
277
 
  WEBRTC_FUNC(StopSend, (int channel)) {
278
 
    WEBRTC_CHECK_CHANNEL(channel);
279
 
    channels_[channel]->send = false;
280
 
    return 0;
281
 
  }
282
 
  WEBRTC_STUB(GetVersion, (char version[1024]));
283
 
  WEBRTC_STUB(LastError, ());
284
 
  WEBRTC_STUB(SetOnHoldStatus, (int, bool, webrtc::OnHoldModes));
285
 
  WEBRTC_STUB(GetOnHoldStatus, (int, bool&, webrtc::OnHoldModes&));
286
 
  WEBRTC_STUB(SetNetEQPlayoutMode, (int, webrtc::NetEqModes));
287
 
  WEBRTC_STUB(GetNetEQPlayoutMode, (int, webrtc::NetEqModes&));
288
 
  WEBRTC_STUB(SetNetEQBGNMode, (int, webrtc::NetEqBgnModes));
289
 
  WEBRTC_STUB(GetNetEQBGNMode, (int, webrtc::NetEqBgnModes&));
290
 
 
291
 
  // webrtc::VoECodec
292
 
  WEBRTC_FUNC(NumOfCodecs, ()) {
293
 
    return num_codecs_;
294
 
  }
295
 
  WEBRTC_FUNC(GetCodec, (int index, webrtc::CodecInst& codec)) {
296
 
    if (index < 0 || index >= NumOfCodecs()) {
297
 
      return -1;
298
 
    }
299
 
    const cricket::AudioCodec& c(*codecs_[index]);
300
 
    codec.pltype = c.id;
301
 
    talk_base::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
302
 
    codec.plfreq = c.clockrate;
303
 
    codec.pacsize = 0;
304
 
    codec.channels = c.channels;
305
 
    codec.rate = c.bitrate;
306
 
    return 0;
307
 
  }
308
 
  WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) {
309
 
    WEBRTC_CHECK_CHANNEL(channel);
310
 
    channels_[channel]->send_codec = codec;
311
 
    return 0;
312
 
  }
313
 
  WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
314
 
    WEBRTC_CHECK_CHANNEL(channel);
315
 
    codec = channels_[channel]->send_codec;
316
 
    return 0;
317
 
  }
318
 
  WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec));
319
 
  WEBRTC_STUB(SetAMREncFormat, (int channel, webrtc::AmrMode mode));
320
 
  WEBRTC_STUB(SetAMRDecFormat, (int channel, webrtc::AmrMode mode));
321
 
  WEBRTC_STUB(SetAMRWbEncFormat, (int channel, webrtc::AmrMode mode));
322
 
  WEBRTC_STUB(SetAMRWbDecFormat, (int channel, webrtc::AmrMode mode));
323
 
  WEBRTC_STUB(SetISACInitTargetRate, (int channel, int rateBps,
324
 
                                      bool useFixedFrameSize));
325
 
  WEBRTC_STUB(SetISACMaxRate, (int channel, int rateBps));
326
 
  WEBRTC_STUB(SetISACMaxPayloadSize, (int channel, int sizeBytes));
327
 
  WEBRTC_FUNC(SetRecPayloadType, (int channel,
328
 
                                  const webrtc::CodecInst& codec)) {
329
 
    WEBRTC_CHECK_CHANNEL(channel);
330
 
    Channel* ch = channels_[channel];
331
 
    // Check if something else already has this slot.
332
 
    if (codec.pltype != -1) {
333
 
      for (std::vector<webrtc::CodecInst>::iterator it =
334
 
          ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
335
 
        if (it->pltype == codec.pltype) {
336
 
          return -1;
337
 
        }
338
 
      }
339
 
    }
340
 
    // Otherwise try to find this codec and update its payload type.
341
 
    for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
342
 
         it != ch->recv_codecs.end(); ++it) {
343
 
      if (strcmp(it->plname, codec.plname) == 0 &&
344
 
          it->plfreq == codec.plfreq) {
345
 
        it->pltype = codec.pltype;
346
 
        return 0;
347
 
      }
348
 
    }
349
 
    return -1;  // not found
350
 
  }
351
 
  WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type,
352
 
                                     webrtc::PayloadFrequencies frequency)) {
353
 
    WEBRTC_CHECK_CHANNEL(channel);
354
 
    if (frequency == webrtc::kFreq8000Hz) {
355
 
      channels_[channel]->cn8_type = type;
356
 
    } else if (frequency == webrtc::kFreq16000Hz) {
357
 
      channels_[channel]->cn16_type = type;
358
 
    }
359
 
    return 0;
360
 
  }
361
 
  WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) {
362
 
    WEBRTC_CHECK_CHANNEL(channel);
363
 
    Channel* ch = channels_[channel];
364
 
    for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
365
 
         it != ch->recv_codecs.end(); ++it) {
366
 
      if (strcmp(it->plname, codec.plname) == 0 &&
367
 
          it->plfreq == codec.plfreq &&
368
 
          it->pltype != -1) {
369
 
        codec.pltype = it->pltype;
370
 
        return 0;
371
 
      }
372
 
    }
373
 
    return -1;  // not found
374
 
  }
375
 
  WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode,
376
 
                             bool disableDTX)) {
377
 
    WEBRTC_CHECK_CHANNEL(channel);
378
 
    channels_[channel]->vad = enable;
379
 
    return 0;
380
 
  }
381
 
  WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
382
 
                             webrtc::VadModes& mode, bool& disabledDTX));
383
 
 
384
 
  // webrtc::VoEDtmf
385
 
  WEBRTC_STUB(SendTelephoneEvent, (int channel, int eventCode,
386
 
      bool outOfBand = true, int lengthMs = 160, int attenuationDb = 10));
387
 
 
388
 
  WEBRTC_FUNC(SetSendTelephoneEventPayloadType,
389
 
      (int channel, unsigned char type)) {
390
 
    channels_[channel]->dtmf_type = type;
391
 
    return 0;
392
 
  };
393
 
  WEBRTC_STUB(GetSendTelephoneEventPayloadType,
394
 
      (int channel, unsigned char& type));
395
 
 
396
 
  WEBRTC_STUB(SetDtmfFeedbackStatus, (bool enable, bool directFeedback));
397
 
  WEBRTC_STUB(GetDtmfFeedbackStatus, (bool& enabled, bool& directFeedback));
398
 
  WEBRTC_STUB(RegisterTelephoneEventDetection, (int channel,
399
 
      webrtc::TelephoneEventDetectionMethods detectionMethod,
400
 
      webrtc::VoETelephoneEventObserver& observer));
401
 
  WEBRTC_STUB(DeRegisterTelephoneEventDetection, (int channel));
402
 
  WEBRTC_STUB(SetDtmfPlayoutStatus, (int channel, bool enable));
403
 
  WEBRTC_STUB(GetDtmfPlayoutStatus, (int channel, bool& enabled));
404
 
 
405
 
 
406
 
  WEBRTC_STUB(PlayDtmfTone,
407
 
      (int eventCode, int lengthMs = 200, int attenuationDb = 10));
408
 
  WEBRTC_STUB(StartPlayingDtmfTone,
409
 
      (int eventCode, int attenuationDb = 10));
410
 
  WEBRTC_STUB(StopPlayingDtmfTone, ());
411
 
  WEBRTC_STUB(GetTelephoneEventDetectionStatus, (int channel,
412
 
      bool& enabled, webrtc::TelephoneEventDetectionMethods& detectionMethod));
413
 
 
414
 
  // webrtc::VoEFile
415
 
  WEBRTC_FUNC(StartPlayingFileLocally, (int channel, const char* fileNameUTF8,
416
 
                                        bool loop, webrtc::FileFormats format,
417
 
                                        float volumeScaling, int startPointMs,
418
 
                                        int stopPointMs)) {
419
 
    WEBRTC_CHECK_CHANNEL(channel);
420
 
    channels_[channel]->file = true;
421
 
    return 0;
422
 
  }
423
 
  WEBRTC_FUNC(StartPlayingFileLocally, (int channel, webrtc::InStream* stream,
424
 
                                        webrtc::FileFormats format,
425
 
                                        float volumeScaling, int startPointMs,
426
 
                                        int stopPointMs)) {
427
 
    WEBRTC_CHECK_CHANNEL(channel);
428
 
    channels_[channel]->file = true;
429
 
    return 0;
430
 
  }
431
 
  WEBRTC_FUNC(StopPlayingFileLocally, (int channel)) {
432
 
    WEBRTC_CHECK_CHANNEL(channel);
433
 
    channels_[channel]->file = false;
434
 
    return 0;
435
 
  }
436
 
  WEBRTC_FUNC(IsPlayingFileLocally, (int channel)) {
437
 
    WEBRTC_CHECK_CHANNEL(channel);
438
 
    return (channels_[channel]->file) ? 1 : 0;
439
 
  }
440
 
  WEBRTC_STUB(ScaleLocalFilePlayout, (int channel, float scale));
441
 
  WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
442
 
                                             const char* fileNameUTF8,
443
 
                                             bool loop,
444
 
                                             bool mixWithMicrophone,
445
 
                                             webrtc::FileFormats format,
446
 
                                             float volumeScaling));
447
 
  WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
448
 
                                             webrtc::InStream* stream,
449
 
                                             bool mixWithMicrophone,
450
 
                                             webrtc::FileFormats format,
451
 
                                             float volumeScaling));
452
 
  WEBRTC_STUB(StopPlayingFileAsMicrophone, (int channel));
453
 
  WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel));
454
 
  WEBRTC_STUB(ScaleFileAsMicrophonePlayout, (int channel, float scale));
455
 
  WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8,
456
 
                                      webrtc::CodecInst* compression,
457
 
                                      int maxSizeBytes));
458
 
  WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream,
459
 
                                      webrtc::CodecInst* compression));
460
 
  WEBRTC_STUB(StopRecordingPlayout, (int channel));
461
 
  WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8,
462
 
                                         webrtc::CodecInst* compression,
463
 
                                         int maxSizeBytes)) {
464
 
    if (fail_start_recording_microphone_) {
465
 
      return -1;
466
 
    }
467
 
    recording_microphone_ = true;
468
 
    return 0;
469
 
  }
470
 
  WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream,
471
 
                                         webrtc::CodecInst* compression)) {
472
 
    if (fail_start_recording_microphone_) {
473
 
      return -1;
474
 
    }
475
 
    recording_microphone_ = true;
476
 
    return 0;
477
 
  }
478
 
  WEBRTC_FUNC(StopRecordingMicrophone, ()) {
479
 
    if (!recording_microphone_) {
480
 
      return -1;
481
 
    }
482
 
    recording_microphone_ = false;
483
 
    return 0;
484
 
  }
485
 
  WEBRTC_STUB(ConvertPCMToWAV, (const char* fileNameInUTF8,
486
 
                                const char* fileNameOutUTF8));
487
 
  WEBRTC_STUB(ConvertPCMToWAV, (webrtc::InStream* streamIn,
488
 
                                webrtc::OutStream* streamOut));
489
 
  WEBRTC_STUB(ConvertWAVToPCM, (const char* fileNameInUTF8,
490
 
                                const char* fileNameOutUTF8));
491
 
  WEBRTC_STUB(ConvertWAVToPCM, (webrtc::InStream* streamIn,
492
 
                                webrtc::OutStream* streamOut));
493
 
  WEBRTC_STUB(ConvertPCMToCompressed, (const char* fileNameInUTF8,
494
 
                                       const char* fileNameOutUTF8,
495
 
                                       webrtc::CodecInst* compression));
496
 
  WEBRTC_STUB(ConvertPCMToCompressed, (webrtc::InStream* streamIn,
497
 
                                       webrtc::OutStream* streamOut,
498
 
                                       webrtc::CodecInst* compression));
499
 
  WEBRTC_STUB(ConvertCompressedToPCM, (const char* fileNameInUTF8,
500
 
                                     const char* fileNameOutUTF8));
501
 
  WEBRTC_STUB(ConvertCompressedToPCM, (webrtc::InStream* streamIn,
502
 
                                       webrtc::OutStream* streamOut));
503
 
  WEBRTC_STUB(GetFileDuration, (const char* fileNameUTF8, int& durationMs,
504
 
                                webrtc::FileFormats format));
505
 
  WEBRTC_STUB(GetPlaybackPosition, (int channel, int& positionMs));
506
 
 
507
 
  // webrtc::VoEHardware
508
 
  WEBRTC_STUB(GetCPULoad, (int&));
509
 
  WEBRTC_STUB(GetSystemCPULoad, (int&));
510
 
  WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) {
511
 
    return GetNumDevices(num);
512
 
  }
513
 
  WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) {
514
 
    return GetNumDevices(num);
515
 
  }
516
 
  WEBRTC_FUNC(GetRecordingDeviceName, (int i, char* name, char* guid)) {
517
 
    return GetDeviceName(i, name, guid);
518
 
  }
519
 
  WEBRTC_FUNC(GetPlayoutDeviceName, (int i, char* name, char* guid)) {
520
 
    return GetDeviceName(i, name, guid);
521
 
  }
522
 
  WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel));
523
 
  WEBRTC_STUB(SetPlayoutDevice, (int));
524
 
  WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers));
525
 
  WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&));
526
 
  WEBRTC_STUB(GetPlayoutDeviceStatus, (bool&));
527
 
  WEBRTC_STUB(GetRecordingDeviceStatus, (bool&));
528
 
  WEBRTC_STUB(ResetAudioDevice, ());
529
 
  WEBRTC_STUB(AudioDeviceControl, (unsigned int, unsigned int, unsigned int));
530
 
  WEBRTC_STUB(NeedMorePlayData, (short int*, int, int, int, int&));
531
 
  WEBRTC_STUB(RecordedDataIsAvailable, (short int*, int, int, int, int&));
532
 
  WEBRTC_STUB(GetDevice, (char*, unsigned int));
533
 
  WEBRTC_STUB(GetPlatform, (char*, unsigned int));
534
 
  WEBRTC_STUB(GetOS, (char*, unsigned int));
535
 
  WEBRTC_STUB(SetGrabPlayout, (bool));
536
 
  WEBRTC_STUB(SetGrabRecording, (bool));
537
 
  WEBRTC_STUB(SetLoudspeakerStatus, (bool enable));
538
 
  WEBRTC_STUB(GetLoudspeakerStatus, (bool& enabled));
539
 
  WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
540
 
  virtual bool BuiltInAECIsEnabled() const { return true; }
541
 
  WEBRTC_STUB(SetSamplingRate, (int));
542
 
  WEBRTC_STUB(GetSamplingRate, (int&));
543
 
 
544
 
  // webrtc::VoENetEqStats
545
 
  WEBRTC_STUB(GetNetworkStatistics, (int, webrtc::NetworkStatistics&));
546
 
  WEBRTC_STUB(GetPreferredBufferSize, (int, short unsigned int&));
547
 
  WEBRTC_STUB(ResetJitterStatistics, (int));
548
 
 
549
 
  // webrtc::VoENetwork
550
 
  WEBRTC_FUNC(RegisterExternalTransport, (int channel,
551
 
                                          webrtc::Transport& transport)) {
552
 
    WEBRTC_CHECK_CHANNEL(channel);
553
 
    channels_[channel]->external_transport = true;
554
 
    return 0;
555
 
  }
556
 
  WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) {
557
 
    WEBRTC_CHECK_CHANNEL(channel);
558
 
    channels_[channel]->external_transport = false;
559
 
    return 0;
560
 
  }
561
 
  WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
562
 
                                  unsigned int length)) {
563
 
    WEBRTC_CHECK_CHANNEL(channel);
564
 
    if (!channels_[channel]->external_transport) return -1;
565
 
    channels_[channel]->packets.push_back(
566
 
        std::string(static_cast<const char*>(data), length));
567
 
    return 0;
568
 
  }
569
 
  WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data,
570
 
                                   unsigned int length));
571
 
  WEBRTC_STUB(GetSourceInfo, (int channel, int& rtpPort, int& rtcpPort,
572
 
                              char ipaddr[64]));
573
 
  WEBRTC_STUB(GetLocalIP, (char ipaddr[64], bool ipv6));
574
 
  WEBRTC_STUB(EnableIPv6, (int channel));
575
 
  // Not using WEBRTC_STUB due to bool return value
576
 
  virtual bool IPv6IsEnabled(int channel) { return true; }
577
 
  WEBRTC_STUB(SetSourceFilter, (int channel, int rtpPort, int rtcpPort,
578
 
                                const char ipaddr[64]));
579
 
  WEBRTC_STUB(GetSourceFilter, (int channel, int& rtpPort, int& rtcpPort,
580
 
                                char ipaddr[64]));
581
 
  WEBRTC_STUB(SetSendTOS, (int channel, int priority,
582
 
                           int DSCP, bool useSetSockopt));
583
 
  WEBRTC_STUB(GetSendTOS, (int channel, int& priority,
584
 
                           int& DSCP, bool& useSetSockopt));
585
 
  WEBRTC_STUB(SetSendGQoS, (int channel, bool enable, int serviceType,
586
 
                            int overrideDSCP));
587
 
  WEBRTC_STUB(GetSendGQoS, (int channel, bool& enabled, int& serviceType,
588
 
                            int& overrideDSCP));
589
 
  WEBRTC_STUB(SetPacketTimeoutNotification, (int channel, bool enable,
590
 
                                             int timeoutSeconds));
591
 
  WEBRTC_STUB(GetPacketTimeoutNotification, (int channel, bool& enable,
592
 
                                             int& timeoutSeconds));
593
 
  WEBRTC_STUB(RegisterDeadOrAliveObserver, (int channel,
594
 
      webrtc::VoEConnectionObserver& observer));
595
 
  WEBRTC_STUB(DeRegisterDeadOrAliveObserver, (int channel));
596
 
  WEBRTC_STUB(GetPeriodicDeadOrAliveStatus, (int channel, bool& enabled,
597
 
                                             int& sampleTimeSeconds));
598
 
  WEBRTC_STUB(SetPeriodicDeadOrAliveStatus, (int channel, bool enable,
599
 
                                             int sampleTimeSeconds));
600
 
  WEBRTC_STUB(SendUDPPacket, (int channel, const void* data,
601
 
                              unsigned int length, int& transmittedBytes,
602
 
                              bool useRtcpSocket));
603
 
 
604
 
  // webrtc::VoERTP_RTCP
605
 
  WEBRTC_STUB(RegisterRTPObserver, (int channel,
606
 
                                    webrtc::VoERTPObserver& observer));
607
 
  WEBRTC_STUB(DeRegisterRTPObserver, (int channel));
608
 
  WEBRTC_STUB(RegisterRTCPObserver, (int channel,
609
 
                                     webrtc::VoERTCPObserver& observer));
610
 
  WEBRTC_STUB(DeRegisterRTCPObserver, (int channel));
611
 
  WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
612
 
    WEBRTC_CHECK_CHANNEL(channel);
613
 
    channels_[channel]->send_ssrc = ssrc;
614
 
    return 0;
615
 
  }
616
 
  WEBRTC_FUNC(GetLocalSSRC, (int channel, unsigned int& ssrc)) {
617
 
    WEBRTC_CHECK_CHANNEL(channel);
618
 
    ssrc = channels_[channel]->send_ssrc;
619
 
    return 0;
620
 
  }
621
 
  WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
622
 
  WEBRTC_FUNC(SetRTPAudioLevelIndicationStatus, (int channel, bool enable,
623
 
      unsigned char ID)) {
624
 
    WEBRTC_CHECK_CHANNEL(channel);
625
 
    channels_[channel]->level_header_ext_ = (enable) ? ID : -1;
626
 
    return 0;
627
 
  }
628
 
  WEBRTC_FUNC(GetRTPAudioLevelIndicationStatus, (int channel, bool& enabled,
629
 
      unsigned char& ID)) {
630
 
    WEBRTC_CHECK_CHANNEL(channel);
631
 
    enabled = (channels_[channel]->level_header_ext_ != -1);
632
 
    ID = channels_[channel]->level_header_ext_;
633
 
    return 0;
634
 
  }
635
 
  WEBRTC_STUB(GetRemoteCSRCs, (int channel, unsigned int arrCSRC[15]));
636
 
  WEBRTC_STUB(GetRemoteEnergy, (int channel, unsigned char arrEnergy[15]));
637
 
  WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable));
638
 
  WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
639
 
  WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
640
 
  WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
641
 
  WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
642
 
  WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
643
 
                                  unsigned int& NTPLow,
644
 
                                  unsigned int& timestamp,
645
 
                                  unsigned int& playoutTimestamp,
646
 
                                  unsigned int* jitter,
647
 
                                  unsigned short* fractionLost));
648
 
  WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (int channel,
649
 
                                                 const unsigned char subType,
650
 
                                                 unsigned int name,
651
 
                                                 const char* data,
652
 
                                                 unsigned short dataLength));
653
 
  WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
654
 
                                 unsigned int& maxJitterMs,
655
 
                                 unsigned int& discardedPackets));
656
 
  WEBRTC_STUB(GetRTCPStatistics, (int channel, unsigned short& fractionLost,
657
 
                                  unsigned int& cumulativeLost,
658
 
                                  unsigned int& extendedMax,
659
 
                                  unsigned int& jitterSamples, int& rttMs));
660
 
  WEBRTC_STUB(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats));
661
 
  WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
662
 
    WEBRTC_CHECK_CHANNEL(channel);
663
 
    channels_[channel]->fec = enable;
664
 
    channels_[channel]->fec_type = redPayloadtype;
665
 
    return 0;
666
 
  }
667
 
  WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
668
 
    WEBRTC_CHECK_CHANNEL(channel);
669
 
    enable = channels_[channel]->fec;
670
 
    redPayloadtype = channels_[channel]->fec_type;
671
 
    return 0;
672
 
  }
673
 
  WEBRTC_STUB(SetRTPKeepaliveStatus, (int channel, bool enable,
674
 
                                      int unknownPayloadType,
675
 
                                      int deltaTransmitTimeSeconds));
676
 
  WEBRTC_STUB(GetRTPKeepaliveStatus, (int channel, bool& enabled,
677
 
                                      int& unknownPayloadType,
678
 
                                      int& deltaTransmitTimeSeconds));
679
 
  WEBRTC_STUB(StartRTPDump, (int channel, const char* fileNameUTF8,
680
 
                             webrtc::RTPDirections direction));
681
 
  WEBRTC_STUB(StopRTPDump, (int channel, webrtc::RTPDirections direction));
682
 
  WEBRTC_STUB(RTPDumpIsActive, (int channel, webrtc::RTPDirections direction));
683
 
  WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType,
684
 
                                     bool markerBit, const char* payloadData,
685
 
                                     unsigned short payloadSize));
686
 
 
687
 
  // webrtc::VoEVideoSync
688
 
  WEBRTC_STUB(GetPlayoutBufferSize, (int& bufferMs));
689
 
  WEBRTC_STUB(GetPlayoutTimestamp, (int channel, unsigned int& timestamp));
690
 
  WEBRTC_STUB(GetRtpRtcp, (int, webrtc::RtpRtcp*&));
691
 
  WEBRTC_STUB(SetInitTimestamp, (int channel, unsigned int timestamp));
692
 
  WEBRTC_STUB(SetInitSequenceNumber, (int channel, short sequenceNumber));
693
 
  WEBRTC_STUB(SetMinimumPlayoutDelay, (int channel, int delayMs));
694
 
  WEBRTC_STUB(GetDelayEstimate, (int channel, int& delayMs));
695
 
  WEBRTC_STUB(GetSoundcardBufferSize, (int& bufferMs));
696
 
 
697
 
  // webrtc::VoEVolumeControl
698
 
  WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
699
 
  WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
700
 
  WEBRTC_STUB(SetSystemOutputMute, (bool));
701
 
  WEBRTC_STUB(GetSystemOutputMute, (bool&));
702
 
  WEBRTC_STUB(SetMicVolume, (unsigned int));
703
 
  WEBRTC_STUB(GetMicVolume, (unsigned int&));
704
 
  WEBRTC_STUB(SetInputMute, (int, bool));
705
 
  WEBRTC_STUB(GetInputMute, (int, bool&));
706
 
  WEBRTC_STUB(SetSystemInputMute, (bool));
707
 
  WEBRTC_STUB(GetSystemInputMute, (bool&));
708
 
  WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
709
 
  WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
710
 
  WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
711
 
  WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&));
712
 
  WEBRTC_STUB(SetChannelOutputVolumeScaling, (int, float));
713
 
  WEBRTC_STUB(GetChannelOutputVolumeScaling, (int, float&));
714
 
  WEBRTC_STUB(SetOutputVolumePan, (int, float, float));
715
 
  WEBRTC_STUB(GetOutputVolumePan, (int, float&, float&));
716
 
 
717
 
  // webrtc::VoEAudioProcessing
718
 
  WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) {
719
 
    ns_enabled_ = enable;
720
 
    ns_mode_ = mode;
721
 
    return 0;
722
 
  }
723
 
  WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) {
724
 
    enabled = ns_enabled_;
725
 
    mode = ns_mode_;
726
 
    return 0;
727
 
  }
728
 
  WEBRTC_STUB(SetAgcStatus, (bool enable, webrtc::AgcModes mode));
729
 
  WEBRTC_STUB(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode));
730
 
 
731
 
  WEBRTC_FUNC(SetAgcConfig, (const webrtc::AgcConfig config)) {
732
 
    agc_config_ = config;
733
 
    return 0;
734
 
  }
735
 
  WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) {
736
 
    config = agc_config_;
737
 
    return 0;
738
 
  }
739
 
  WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) {
740
 
    ec_enabled_ = enable;
741
 
    ec_mode_ = mode;
742
 
    return 0;
743
 
  }
744
 
  WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) {
745
 
    enabled = ec_enabled_;
746
 
    mode = ec_mode_;
747
 
    return 0;
748
 
  }
749
 
  virtual void SetDelayOffsetMs(int offset) {}
750
 
  WEBRTC_STUB(DelayOffsetMs, ());
751
 
  WEBRTC_STUB(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG));
752
 
  WEBRTC_STUB(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG));
753
 
  WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode));
754
 
  WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled,
755
 
                              webrtc::NsModes& mode));
756
 
  WEBRTC_STUB(SetRxAgcStatus, (int channel, bool enable,
757
 
                               webrtc::AgcModes mode));
758
 
  WEBRTC_STUB(GetRxAgcStatus, (int channel, bool& enabled,
759
 
                               webrtc::AgcModes& mode));
760
 
  WEBRTC_STUB(SetRxAgcConfig, (int channel, const webrtc::AgcConfig config));
761
 
  WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config));
762
 
 
763
 
  WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
764
 
  WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
765
 
  WEBRTC_STUB(VoiceActivityIndicator, (int channel));
766
 
  WEBRTC_STUB(SetEcMetricsStatus, (bool enable));
767
 
  WEBRTC_STUB(GetEcMetricsStatus, (bool& enable));
768
 
  WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
769
 
  WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std));
770
 
 
771
 
  WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
772
 
  WEBRTC_STUB(StopDebugRecording, ());
773
 
 
774
 
  WEBRTC_STUB(SetTypingDetectionStatus, (bool enable));
775
 
  WEBRTC_STUB(GetTypingDetectionStatus, (bool& enabled));
776
 
 
777
 
  // webrtc::VoEExternalMedia
778
 
  WEBRTC_FUNC(RegisterExternalMediaProcessing,
779
 
              (int channel, webrtc::ProcessingTypes type,
780
 
               webrtc::VoEMediaProcess& processObject)) {
781
 
    WEBRTC_CHECK_CHANNEL(channel);
782
 
    if (channels_[channel]->media_processor_registered) {
783
 
      return -1;
784
 
    }
785
 
    channels_[channel]->media_processor_registered = true;
786
 
    media_processor_ = &processObject;
787
 
    return 0;
788
 
  }
789
 
  WEBRTC_FUNC(DeRegisterExternalMediaProcessing,
790
 
              (int channel, webrtc::ProcessingTypes type)) {
791
 
    WEBRTC_CHECK_CHANNEL(channel);
792
 
    if (!channels_[channel]->media_processor_registered) {
793
 
      return -1;
794
 
    }
795
 
    channels_[channel]->media_processor_registered = false;
796
 
    media_processor_ = NULL;
797
 
    return 0;
798
 
  }
799
 
  WEBRTC_STUB(SetExternalRecordingStatus, (bool enable));
800
 
  WEBRTC_STUB(SetExternalPlayoutStatus, (bool enable));
801
 
  WEBRTC_STUB(ExternalRecordingInsertData,
802
 
              (const WebRtc_Word16 speechData10ms[], int lengthSamples,
803
 
               int samplingFreqHz, int current_delay_ms));
804
 
  WEBRTC_STUB(ExternalPlayoutGetData,
805
 
              (WebRtc_Word16 speechData10ms[], int samplingFreqHz,
806
 
               int current_delay_ms, int& lengthSamples));
807
 
 
808
 
 private:
809
 
  int GetNumDevices(int& num) {
810
 
#ifdef WIN32
811
 
    num = 1;
812
 
#else
813
 
    // On non-Windows platforms VE adds a special entry for the default device,
814
 
    // so if there is one physical device then there are two entries in the
815
 
    // list.
816
 
    num = 2;
817
 
#endif
818
 
    return 0;
819
 
  }
820
 
 
821
 
  int GetDeviceName(int i, char* name, char* guid) {
822
 
    const char *s;
823
 
#ifdef WIN32
824
 
    if (0 == i) {
825
 
      s = kFakeDeviceName;
826
 
    } else {
827
 
      return -1;
828
 
    }
829
 
#else
830
 
    // See comment above.
831
 
    if (0 == i) {
832
 
      s = kFakeDefaultDeviceName;
833
 
    } else if (1 == i) {
834
 
      s = kFakeDeviceName;
835
 
    } else {
836
 
      return -1;
837
 
    }
838
 
#endif
839
 
    strcpy(name, s);
840
 
    guid[0] = '\0';
841
 
    return 0;
842
 
  }
843
 
 
844
 
  bool inited_;
845
 
  int last_channel_;
846
 
  std::map<int, Channel*> channels_;
847
 
  bool fail_create_channel_;
848
 
  const cricket::AudioCodec* const* codecs_;
849
 
  int num_codecs_;
850
 
  bool ec_enabled_;
851
 
  bool ns_enabled_;
852
 
  webrtc::EcModes ec_mode_;
853
 
  webrtc::NsModes ns_mode_;
854
 
  webrtc::AgcConfig agc_config_;
855
 
  webrtc::VoiceEngineObserver* observer_;
856
 
  int playout_fail_channel_;
857
 
  int send_fail_channel_;
858
 
  bool fail_start_recording_microphone_;
859
 
  bool recording_microphone_;
860
 
  webrtc::VoEMediaProcess* media_processor_;
861
 
};
862
 
 
863
 
}  // namespace cricket
864
 
 
865
 
#endif  // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_