summaryrefslogtreecommitdiff
path: root/media/webrtc/fakewebrtcvoiceengine.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/webrtc/fakewebrtcvoiceengine.h')
-rw-r--r--media/webrtc/fakewebrtcvoiceengine.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/media/webrtc/fakewebrtcvoiceengine.h b/media/webrtc/fakewebrtcvoiceengine.h
index f731b8d..52a50ff 100644
--- a/media/webrtc/fakewebrtcvoiceengine.h
+++ b/media/webrtc/fakewebrtcvoiceengine.h
@@ -43,10 +43,7 @@
#ifdef USE_WEBRTC_DEV_BRANCH
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#endif
-
-namespace webrtc {
-class ViENetwork;
-}
+#include "webrtc/video_engine/include/vie_network.h"
namespace cricket {
@@ -64,6 +61,12 @@ static const int kFakeDeviceId = 0;
static const int kFakeDeviceId = 1;
#endif
+static const int kOpusBandwidthNb = 4000;
+static const int kOpusBandwidthMb = 6000;
+static const int kOpusBandwidthWb = 8000;
+static const int kOpusBandwidthSwb = 12000;
+static const int kOpusBandwidthFb = 20000;
+
// Verify the header extension ID, if enabled, is within the bounds specified in
// [RFC5285]: 1-14 inclusive.
#define WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id) \
@@ -183,6 +186,7 @@ class FakeWebRtcVoiceEngine
file(false),
vad(false),
codec_fec(false),
+ max_encoding_bandwidth(0),
red(false),
nack(false),
media_processor_registered(false),
@@ -212,6 +216,7 @@ class FakeWebRtcVoiceEngine
bool file;
bool vad;
bool codec_fec;
+ int max_encoding_bandwidth;
bool red;
bool nack;
bool media_processor_registered;
@@ -308,6 +313,9 @@ class FakeWebRtcVoiceEngine
bool GetCodecFEC(int channel) {
return channels_[channel]->codec_fec;
}
+ int GetMaxEncodingBandwidth(int channel) {
+ return channels_[channel]->max_encoding_bandwidth;
+ }
bool GetNACK(int channel) {
return channels_[channel]->nack;
}
@@ -316,6 +324,8 @@ class FakeWebRtcVoiceEngine
}
webrtc::ViENetwork* GetViENetwork(int channel) {
WEBRTC_ASSERT_CHANNEL(channel);
+ // WARNING: This pointer is for verification purposes only. Calling
+ // functions on it may result in undefined behavior!
return channels_[channel]->vie_network;
}
int GetVideoChannel(int channel) {
@@ -488,8 +498,6 @@ class FakeWebRtcVoiceEngine
WEBRTC_STUB(LastError, ());
WEBRTC_STUB(SetOnHoldStatus, (int, bool, webrtc::OnHoldModes));
WEBRTC_STUB(GetOnHoldStatus, (int, bool&, webrtc::OnHoldModes&));
- WEBRTC_STUB(SetNetEQPlayoutMode, (int, webrtc::NetEqModes));
- WEBRTC_STUB(GetNetEQPlayoutMode, (int, webrtc::NetEqModes&));
// webrtc::VoECodec
WEBRTC_FUNC(NumOfCodecs, ()) {
@@ -625,10 +633,11 @@ class FakeWebRtcVoiceEngine
}
WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
webrtc::VadModes& mode, bool& disabledDTX));
+
#ifdef USE_WEBRTC_DEV_BRANCH
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
WEBRTC_CHECK_CHANNEL(channel);
- if (strcmp(channels_[channel]->send_codec.plname, "opus")) {
+ if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
// Return -1 if current send codec is not Opus.
// TODO(minyue): Excludes other codecs if they support inband FEC.
return -1;
@@ -641,6 +650,25 @@ class FakeWebRtcVoiceEngine
enable = channels_[channel]->codec_fec;
return 0;
}
+
+ WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) {
+ WEBRTC_CHECK_CHANNEL(channel);
+ if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
+ // Return -1 if current send codec is not Opus.
+ return -1;
+ }
+ if (frequency_hz <= 8000)
+ channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb;
+ else if (frequency_hz <= 12000)
+ channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb;
+ else if (frequency_hz <= 16000)
+ channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb;
+ else if (frequency_hz <= 24000)
+ channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb;
+ else
+ channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb;
+ return 0;
+ }
#endif // USE_WEBRTC_DEV_BRANCH
// webrtc::VoEDtmf
@@ -999,6 +1027,11 @@ class FakeWebRtcVoiceEngine
WEBRTC_CHECK_CHANNEL(channel);
channels_[channel]->vie_network = vie_network;
channels_[channel]->video_channel = video_channel;
+ if (vie_network) {
+ // The interface is released here to avoid leaks. A test should not
+ // attempt to call functions on the interface stored in the channel.
+ vie_network->Release();
+ }
return 0;
}