summaryrefslogtreecommitdiff
path: root/media/webrtc/fakewebrtcvoiceengine.h
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2014-06-20 14:52:48 +0100
committerTorne (Richard Coles) <torne@google.com>2014-06-20 14:52:48 +0100
commit99bc8f39c7d7784a6d03c08add97b0f97c44db53 (patch)
tree3b4bc0bedfa949af7f8fd4ae7633f7a0870e6e86 /media/webrtc/fakewebrtcvoiceengine.h
parent92d181beaac81934497a46fa15e218b0fd6569a6 (diff)
parent6de09a1dbcfa359a587b972f3e0fe30ffbd5be41 (diff)
downloadtalk-99bc8f39c7d7784a6d03c08add97b0f97c44db53.tar.gz
Merge from Chromium at DEPS revision 278205
This commit was generated by merge_to_master.py. Change-Id: I708b08f68e2ffaf5f127f628e6d299007754091d
Diffstat (limited to 'media/webrtc/fakewebrtcvoiceengine.h')
-rw-r--r--media/webrtc/fakewebrtcvoiceengine.h69
1 files changed, 56 insertions, 13 deletions
diff --git a/media/webrtc/fakewebrtcvoiceengine.h b/media/webrtc/fakewebrtcvoiceengine.h
index 1df2195..ff2079b 100644
--- a/media/webrtc/fakewebrtcvoiceengine.h
+++ b/media/webrtc/fakewebrtcvoiceengine.h
@@ -36,6 +36,7 @@
#include "talk/base/gunit.h"
#include "talk/base/stringutils.h"
#include "talk/media/base/codec.h"
+#include "talk/media/base/rtputils.h"
#include "talk/media/base/voiceprocessor.h"
#include "talk/media/webrtc/fakewebrtccommon.h"
#include "talk/media/webrtc/webrtcvoe.h"
@@ -96,7 +97,8 @@ class FakeWebRtcVoiceEngine
volume_pan_right(1.0),
file(false),
vad(false),
- fec(false),
+ codec_fec(false),
+ red(false),
nack(false),
media_processor_registered(false),
rx_agc_enabled(false),
@@ -104,7 +106,7 @@ class FakeWebRtcVoiceEngine
cn8_type(13),
cn16_type(105),
dtmf_type(106),
- fec_type(117),
+ red_type(117),
nack_max_packets(0),
vie_network(NULL),
video_channel(-1),
@@ -124,7 +126,8 @@ class FakeWebRtcVoiceEngine
float volume_pan_right;
bool file;
bool vad;
- bool fec;
+ bool codec_fec;
+ bool red;
bool nack;
bool media_processor_registered;
bool rx_agc_enabled;
@@ -133,7 +136,7 @@ class FakeWebRtcVoiceEngine
int cn8_type;
int cn16_type;
int dtmf_type;
- int fec_type;
+ int red_type;
int nack_max_packets;
webrtc::ViENetwork* vie_network;
int video_channel;
@@ -214,8 +217,11 @@ class FakeWebRtcVoiceEngine
bool GetVAD(int channel) {
return channels_[channel]->vad;
}
- bool GetFEC(int channel) {
- return channels_[channel]->fec;
+ bool GetRED(int channel) {
+ return channels_[channel]->red;
+ }
+ bool GetCodecFEC(int channel) {
+ return channels_[channel]->codec_fec;
}
bool GetNACK(int channel) {
return channels_[channel]->nack;
@@ -243,8 +249,8 @@ class FakeWebRtcVoiceEngine
int GetSendTelephoneEventPayloadType(int channel) {
return channels_[channel]->dtmf_type;
}
- int GetSendFECPayloadType(int channel) {
- return channels_[channel]->fec_type;
+ int GetSendREDPayloadType(int channel) {
+ return channels_[channel]->red_type;
}
bool CheckPacket(int channel, const void* data, size_t len) {
bool result = !CheckNoPacket(channel);
@@ -437,7 +443,26 @@ class FakeWebRtcVoiceEngine
WEBRTC_STUB(RemoveSecondarySendCodec, (int channel));
WEBRTC_STUB(GetSecondarySendCodec, (int channel,
webrtc::CodecInst& codec));
- WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec));
+ WEBRTC_FUNC(GetRecCodec, (int channel, webrtc::CodecInst& codec)) {
+ WEBRTC_CHECK_CHANNEL(channel);
+ const Channel* c = channels_[channel];
+ for (std::list<std::string>::const_iterator it_packet = c->packets.begin();
+ it_packet != c->packets.end(); ++it_packet) {
+ int pltype;
+ if (!GetRtpPayloadType(it_packet->data(), it_packet->length(), &pltype)) {
+ continue;
+ }
+ for (std::vector<webrtc::CodecInst>::const_iterator it_codec =
+ c->recv_codecs.begin(); it_codec != c->recv_codecs.end();
+ ++it_codec) {
+ if (it_codec->pltype == pltype) {
+ codec = *it_codec;
+ return 0;
+ }
+ }
+ }
+ return -1;
+ }
WEBRTC_STUB(SetAMREncFormat, (int channel, webrtc::AmrMode mode));
WEBRTC_STUB(SetAMRDecFormat, (int channel, webrtc::AmrMode mode));
WEBRTC_STUB(SetAMRWbEncFormat, (int channel, webrtc::AmrMode mode));
@@ -511,6 +536,16 @@ class FakeWebRtcVoiceEngine
}
WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
webrtc::VadModes& mode, bool& disabledDTX));
+ WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
+ WEBRTC_CHECK_CHANNEL(channel);
+ channels_[channel]->codec_fec = enable;
+ return 0;
+ }
+ WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) {
+ WEBRTC_CHECK_CHANNEL(channel);
+ enable = channels_[channel]->codec_fec;
+ return 0;
+ }
// webrtc::VoEDtmf
WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
@@ -823,16 +858,24 @@ class FakeWebRtcVoiceEngine
stats.packetsReceived = kIntStatValue;
return 0;
}
+#ifdef USE_WEBRTC_DEV_BRANCH
+ WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
+#else
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
+#endif // USE_WEBRTC_DEV_BRANCH
WEBRTC_CHECK_CHANNEL(channel);
- channels_[channel]->fec = enable;
- channels_[channel]->fec_type = redPayloadtype;
+ channels_[channel]->red = enable;
+ channels_[channel]->red_type = redPayloadtype;
return 0;
}
+#ifdef USE_WEBRTC_DEV_BRANCH
+ WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) {
+#else
WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
+#endif // USE_WEBRTC_DEV_BRANCH
WEBRTC_CHECK_CHANNEL(channel);
- enable = channels_[channel]->fec;
- redPayloadtype = channels_[channel]->fec_type;
+ enable = channels_[channel]->red;
+ redPayloadtype = channels_[channel]->red_type;
return 0;
}
WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {