Remove the VoEDtmf interface.

BUG=webrtc:4690

Review URL: https://codereview.webrtc.org/1723153002

Cr-Commit-Position: refs/heads/master@{#11906}
This commit is contained in:
solenberg
2016-03-08 04:10:51 -08:00
committed by Commit bot
parent 7b4c9db28a
commit 622d8950f5
18 changed files with 19 additions and 461 deletions

View File

@ -35,7 +35,6 @@
#define WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
#define WEBRTC_VOICE_ENGINE_CODEC_API
#define WEBRTC_VOICE_ENGINE_DTMF_API
#define WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
#define WEBRTC_VOICE_ENGINE_FILE_API
#define WEBRTC_VOICE_ENGINE_HARDWARE_API

View File

@ -143,22 +143,6 @@ class MockVoiceEngine : public VoiceEngineImpl {
MOCK_METHOD2(SetOpusDtx, int(int channel, bool enable_dtx));
MOCK_METHOD0(GetEventLog, RtcEventLog*());
// VoEDtmf
MOCK_METHOD5(SendTelephoneEvent,
int(int channel,
int eventCode,
bool outOfBand,
int lengthMs,
int attenuationDb));
MOCK_METHOD2(SetSendTelephoneEventPayloadType,
int(int channel, unsigned char type));
MOCK_METHOD2(GetSendTelephoneEventPayloadType,
int(int channel, unsigned char& type));
MOCK_METHOD2(SetDtmfFeedbackStatus, int(bool enable, bool directFeedback));
MOCK_METHOD2(GetDtmfFeedbackStatus, int(bool& enabled, bool& directFeedback));
MOCK_METHOD3(PlayDtmfTone,
int(int eventCode, int lengthMs, int attenuationDb));
// VoEExternalMedia
MOCK_METHOD3(RegisterExternalMediaProcessing,
int(int channel,

View File

@ -23,7 +23,6 @@ source_set("voice_engine") {
"include/voe_audio_processing.h",
"include/voe_base.h",
"include/voe_codec.h",
"include/voe_dtmf.h",
"include/voe_errors.h",
"include/voe_external_media.h",
"include/voe_file.h",
@ -55,8 +54,6 @@ source_set("voice_engine") {
"voe_base_impl.h",
"voe_codec_impl.cc",
"voe_codec_impl.h",
"voe_dtmf_impl.cc",
"voe_dtmf_impl.h",
"voe_external_media_impl.cc",
"voe_external_media_impl.h",
"voe_file_impl.cc",

View File

@ -34,11 +34,6 @@
#include "webrtc/voice_engine/shared_data.h"
#include "webrtc/voice_engine/voice_engine_defines.h"
#ifdef WEBRTC_DTMF_DETECTION
// TelephoneEventDetectionMethods, TelephoneEventObserver
#include "webrtc/voice_engine/include/voe_dtmf.h"
#endif
namespace rtc {
class TimestampWrapAroundHandler;

View File

@ -1,92 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
// This sub-API supports the following functionalities:
//
// - Telephone event transmission.
// - DTMF tone generation.
//
// Usage example, omitting error checking:
//
// using namespace webrtc;
// VoiceEngine* voe = VoiceEngine::Create();
// VoEBase* base = VoEBase::GetInterface(voe);
// VoEDtmf* dtmf = VoEDtmf::GetInterface(voe);
// base->Init();
// int ch = base->CreateChannel();
// ...
// dtmf->SendTelephoneEvent(ch, 7);
// ...
// base->DeleteChannel(ch);
// base->Terminate();
// base->Release();
// dtmf->Release();
// VoiceEngine::Delete(voe);
//
#ifndef WEBRTC_VOICE_ENGINE_VOE_DTMF_H
#define WEBRTC_VOICE_ENGINE_VOE_DTMF_H
#include "webrtc/common_types.h"
namespace webrtc {
class VoiceEngine;
// VoEDtmf
class WEBRTC_DLLEXPORT VoEDtmf {
public:
// Factory for the VoEDtmf sub-API. Increases an internal
// reference counter if successful. Returns NULL if the API is not
// supported or if construction fails.
static VoEDtmf* GetInterface(VoiceEngine* voiceEngine);
// Releases the VoEDtmf sub-API and decreases an internal
// reference counter. Returns the new reference count. This value should
// be zero for all sub-API:s before the VoiceEngine object can be safely
// deleted.
virtual int Release() = 0;
// Sends telephone events either in-band or out-of-band.
virtual int SendTelephoneEvent(int channel,
int eventCode,
bool outOfBand = true,
int lengthMs = 160,
int attenuationDb = 10) = 0;
// Sets the dynamic payload |type| that should be used for telephone
// events.
virtual int SetSendTelephoneEventPayloadType(int channel,
unsigned char type) = 0;
// Gets the currently set dynamic payload |type| for telephone events.
virtual int GetSendTelephoneEventPayloadType(int channel,
unsigned char& type) = 0;
// Toogles DTMF feedback state: when a DTMF tone is sent, the same tone
// is played out on the speaker.
virtual int SetDtmfFeedbackStatus(bool enable,
bool directFeedback = false) = 0;
// Gets the DTMF feedback status.
virtual int GetDtmfFeedbackStatus(bool& enabled, bool& directFeedback) = 0;
// Plays a DTMF feedback tone (only locally).
virtual int PlayDtmfTone(int eventCode,
int lengthMs = 200,
int attenuationDb = 10) = 0;
protected:
VoEDtmf() {}
virtual ~VoEDtmf() {}
};
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_VOE_DTMF_H

View File

@ -9,8 +9,12 @@
*/
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
AfterStreamingFixture::AfterStreamingFixture()
: BeforeStreamingFixture() {
webrtc::VoiceEngineImpl* voe_impl =
static_cast<webrtc::VoiceEngineImpl*>(voice_engine_);
channel_proxy_ = voe_impl->GetChannelProxy(channel_);
ResumePlaying();
}

View File

@ -11,6 +11,9 @@
#ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_AFTER_STREAMING_H_
#define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_AFTER_STREAMING_H_
#include <memory>
#include "webrtc/voice_engine/channel_proxy.h"
#include "webrtc/voice_engine/test/auto_test/fixtures/before_streaming_fixture.h"
// This fixture will, in addition to the work done by its superclasses,
@ -19,6 +22,9 @@ class AfterStreamingFixture : public BeforeStreamingFixture {
public:
AfterStreamingFixture();
virtual ~AfterStreamingFixture() {}
protected:
std::unique_ptr<webrtc::voe::ChannelProxy> channel_proxy_;
};
#endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_AFTER_STREAMING_H_

View File

@ -19,7 +19,6 @@ BeforeInitializationFixture::BeforeInitializationFixture()
voe_base_ = webrtc::VoEBase::GetInterface(voice_engine_);
voe_codec_ = webrtc::VoECodec::GetInterface(voice_engine_);
voe_volume_control_ = webrtc::VoEVolumeControl::GetInterface(voice_engine_);
voe_dtmf_ = webrtc::VoEDtmf::GetInterface(voice_engine_);
voe_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(voice_engine_);
voe_apm_ = webrtc::VoEAudioProcessing::GetInterface(voice_engine_);
voe_network_ = webrtc::VoENetwork::GetInterface(voice_engine_);
@ -34,7 +33,6 @@ BeforeInitializationFixture::~BeforeInitializationFixture() {
voe_base_->Release();
voe_codec_->Release();
voe_volume_control_->Release();
voe_dtmf_->Release();
voe_rtp_rtcp_->Release();
voe_apm_->Release();
voe_network_->Release();

View File

@ -19,7 +19,6 @@
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
#include "webrtc/voice_engine/include/voe_file.h"
@ -58,7 +57,6 @@ class BeforeInitializationFixture : public testing::Test {
webrtc::VoEBase* voe_base_;
webrtc::VoECodec* voe_codec_;
webrtc::VoEVolumeControl* voe_volume_control_;
webrtc::VoEDtmf* voe_dtmf_;
webrtc::VoERTP_RTCP* voe_rtp_rtcp_;
webrtc::VoEAudioProcessing* voe_apm_;
webrtc::VoENetwork* voe_network_;

View File

@ -13,43 +13,25 @@
class DtmfTest : public AfterStreamingFixture {
protected:
void RunSixteenDtmfEvents(bool out_of_band) {
void RunSixteenDtmfEvents() {
TEST_LOG("Sending telephone events:\n");
EXPECT_EQ(0, voe_dtmf_->SetDtmfFeedbackStatus(false));
for (int i = 0; i < 16; i++) {
TEST_LOG("%d ", i);
TEST_LOG_FLUSH;
EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent(
channel_, i, out_of_band, 160, 10));
EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(i, 160));
Sleep(500);
}
TEST_LOG("\n");
}
};
TEST_F(DtmfTest, DtmfFeedbackIsEnabledByDefaultButNotDirectFeedback) {
bool dtmf_feedback = false;
bool dtmf_direct_feedback = false;
EXPECT_EQ(0, voe_dtmf_->GetDtmfFeedbackStatus(dtmf_feedback,
dtmf_direct_feedback));
EXPECT_TRUE(dtmf_feedback);
EXPECT_FALSE(dtmf_direct_feedback);
}
TEST_F(DtmfTest, ManualSuccessfullySendsInBandTelephoneEvents) {
RunSixteenDtmfEvents(false);
}
TEST_F(DtmfTest, ManualSuccessfullySendsOutOfBandTelephoneEvents) {
RunSixteenDtmfEvents(true);
RunSixteenDtmfEvents();
}
TEST_F(DtmfTest, TestTwoNonDtmfEvents) {
EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent(channel_, 32, true));
EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent(channel_, 110, true));
EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(32, 160));
EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(110, 160));
}
// This test modifies the DTMF payload type from the default 106 to 88
@ -78,10 +60,8 @@ TEST_F(DtmfTest, ManualCanChangeDtmfPayloadType) {
Sleep(500);
// Next, we must modify the sending side as well.
EXPECT_EQ(0, voe_dtmf_->SetSendTelephoneEventPayloadType(
channel_, codec_instance.pltype));
EXPECT_TRUE(
channel_proxy_->SetSendTelephoneEventPayloadType(codec_instance.pltype));
RunSixteenDtmfEvents(true);
EXPECT_EQ(0, voe_dtmf_->SetDtmfFeedbackStatus(true, false));
RunSixteenDtmfEvents();
}

View File

@ -42,8 +42,6 @@ void SubAPIManager::DisplayStatus() const {
TEST_LOG(" Base\n");
if (_codec)
TEST_LOG(" Codec\n");
if (_dtmf)
TEST_LOG(" Dtmf\n");
if (_externalMedia)
TEST_LOG(" ExternalMedia\n");
if (_file)
@ -68,8 +66,6 @@ void SubAPIManager::DisplayStatus() const {
TEST_LOG(" Base\n");
if (!_codec)
TEST_LOG(" Codec\n");
if (!_dtmf)
TEST_LOG(" Dtmf\n");
if (!_externalMedia)
TEST_LOG(" ExternamMedia\n");
if (!_file)
@ -96,7 +92,6 @@ VoETestManager::VoETestManager()
voice_engine_(NULL),
voe_base_(0),
voe_codec_(0),
voe_dtmf_(0),
voe_xmedia_(0),
voe_file_(0),
voe_hardware_(0),
@ -131,7 +126,6 @@ void VoETestManager::GetInterfaces() {
voe_base_ = VoEBase::GetInterface(voice_engine_);
voe_codec_ = VoECodec::GetInterface(voice_engine_);
voe_volume_control_ = VoEVolumeControl::GetInterface(voice_engine_);
voe_dtmf_ = VoEDtmf::GetInterface(voice_engine_);
voe_rtp_rtcp_ = VoERTP_RTCP::GetInterface(voice_engine_);
voe_apm_ = VoEAudioProcessing::GetInterface(voice_engine_);
voe_network_ = VoENetwork::GetInterface(voice_engine_);
@ -175,10 +169,6 @@ int VoETestManager::ReleaseInterfaces() {
voe_volume_control_->Release();
voe_volume_control_ = NULL;
}
if (voe_dtmf_) {
voe_dtmf_->Release();
voe_dtmf_ = NULL;
}
if (voe_rtp_rtcp_) {
voe_rtp_rtcp_->Release();
voe_rtp_rtcp_ = NULL;

View File

@ -17,7 +17,6 @@
#include "gflags/gflags.h"
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/include/voe_file.h"
#include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
@ -60,7 +59,6 @@ class SubAPIManager {
SubAPIManager()
: _base(true),
_codec(false),
_dtmf(false),
_externalMedia(false),
_file(false),
_hardware(false),
@ -73,9 +71,6 @@ class SubAPIManager {
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
_codec = true;
#endif
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
_dtmf = true;
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
_externalMedia = true;
#endif
@ -106,7 +101,7 @@ class SubAPIManager {
void DisplayStatus() const;
private:
bool _base, _codec, _dtmf;
bool _base, _codec;
bool _externalMedia, _file, _hardware;
bool _netEqStats, _network, _rtp_rtcp, _videoSync, _volumeControl, _apm;
};
@ -142,9 +137,6 @@ class VoETestManager {
VoEVolumeControl* VolumeControlPtr() const {
return voe_volume_control_;
}
VoEDtmf* DtmfPtr() const {
return voe_dtmf_;
}
VoERTP_RTCP* RTP_RTCPPtr() const {
return voe_rtp_rtcp_;
}
@ -184,7 +176,6 @@ class VoETestManager {
VoiceEngine* voice_engine_;
VoEBase* voe_base_;
VoECodec* voe_codec_;
VoEDtmf* voe_dtmf_;
VoEExternalMedia* voe_xmedia_;
VoEFile* voe_file_;
VoEHardware* voe_hardware_;

View File

@ -23,7 +23,6 @@
#define _TEST_RTP_RTCP_
#define _TEST_HARDWARE_
#define _TEST_CODEC_
#define _TEST_DTMF_
#define _TEST_VOLUME_
#define _TEST_AUDIO_PROCESSING_
#define _TEST_FILE_
@ -52,9 +51,6 @@
#ifndef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
#undef _TEST_VOLUME_
#endif
#ifndef WEBRTC_VOICE_ENGINE_DTMF_API
#undef _TEST_DTMF_
#endif
#ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
#undef _TEST_RTP_RTCP_
#endif

View File

@ -30,7 +30,6 @@
#include "webrtc/voice_engine/include/voe_audio_processing.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_codec.h"
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/include/voe_external_media.h"
#include "webrtc/voice_engine/include/voe_file.h"
@ -57,7 +56,6 @@ VoiceEngine* m_voe = NULL;
VoEBase* base1 = NULL;
VoECodec* codec = NULL;
VoEVolumeControl* volume = NULL;
VoEDtmf* dtmf = NULL;
VoERTP_RTCP* rtp_rtcp = NULL;
VoEAudioProcessing* apm = NULL;
VoENetwork* netw = NULL;
@ -131,7 +129,6 @@ int main(int argc, char** argv) {
codec = VoECodec::GetInterface(m_voe);
apm = VoEAudioProcessing::GetInterface(m_voe);
volume = VoEVolumeControl::GetInterface(m_voe);
dtmf = VoEDtmf::GetInterface(m_voe);
rtp_rtcp = VoERTP_RTCP::GetInterface(m_voe);
netw = VoENetwork::GetInterface(m_voe);
file = VoEFile::GetInterface(m_voe);
@ -190,9 +187,6 @@ int main(int argc, char** argv) {
if (volume)
volume->Release();
if (dtmf)
dtmf->Release();
if (rtp_rtcp)
rtp_rtcp->Release();

View File

@ -1,217 +0,0 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/voice_engine/voe_dtmf_impl.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/voice_engine/channel.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/output_mixer.h"
#include "webrtc/voice_engine/transmit_mixer.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
namespace webrtc {
VoEDtmf* VoEDtmf::GetInterface(VoiceEngine* voiceEngine) {
#ifndef WEBRTC_VOICE_ENGINE_DTMF_API
return NULL;
#else
if (NULL == voiceEngine) {
return NULL;
}
VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
s->AddRef();
return s;
#endif
}
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
VoEDtmfImpl::VoEDtmfImpl(voe::SharedData* shared)
: _dtmfFeedback(true), _dtmfDirectFeedback(false), _shared(shared) {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
"VoEDtmfImpl::VoEDtmfImpl() - ctor");
}
VoEDtmfImpl::~VoEDtmfImpl() {
WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
"VoEDtmfImpl::~VoEDtmfImpl() - dtor");
}
int VoEDtmfImpl::SendTelephoneEvent(int channel,
int eventCode,
bool outOfBand,
int lengthMs,
int attenuationDb) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SendTelephoneEvent(channel=%d, eventCode=%d, outOfBand=%d,"
"length=%d, attenuationDb=%d)",
channel, eventCode, (int)outOfBand, lengthMs, attenuationDb);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SendTelephoneEvent() failed to locate channel");
return -1;
}
if (!channelPtr->Sending()) {
_shared->SetLastError(VE_NOT_SENDING, kTraceError,
"SendTelephoneEvent() sending is not active");
return -1;
}
// Sanity check
const int maxEventCode = outOfBand ? static_cast<int>(kMaxTelephoneEventCode)
: static_cast<int>(kMaxDtmfEventCode);
const bool testFailed = ((eventCode < 0) || (eventCode > maxEventCode) ||
(lengthMs < kMinTelephoneEventDuration) ||
(lengthMs > kMaxTelephoneEventDuration) ||
(attenuationDb < kMinTelephoneEventAttenuation) ||
(attenuationDb > kMaxTelephoneEventAttenuation));
if (testFailed) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"SendTelephoneEvent() invalid parameter(s)");
return -1;
}
const bool isDtmf = (eventCode >= 0) && (eventCode <= kMaxDtmfEventCode);
const bool playDtmfToneDirect =
isDtmf && (_dtmfFeedback && _dtmfDirectFeedback);
if (playDtmfToneDirect) {
// Mute the microphone signal while playing back the tone directly.
// This is to reduce the risk of introducing echo from the added output.
_shared->transmit_mixer()->UpdateMuteMicrophoneTime(lengthMs);
// Play out local feedback tone directly (same approach for both inband
// and outband).
// Reduce the length of the the tone with 80ms to reduce risk of echo.
// For non-direct feedback, outband and inband cases are handled
// differently.
_shared->output_mixer()->PlayDtmfTone(eventCode, lengthMs - 80,
attenuationDb);
}
if (outOfBand) {
// The RTP/RTCP module will always deliver OnPlayTelephoneEvent when
// an event is transmitted. It is up to the VoE to utilize it or not.
// This flag ensures that feedback/playout is enabled; however, the
// channel object must still parse out the Dtmf events (0-15) from
// all possible events (0-255).
const bool playDTFMEvent = (_dtmfFeedback && !_dtmfDirectFeedback);
return channelPtr->SendTelephoneEventOutband(eventCode, lengthMs,
attenuationDb, playDTFMEvent);
} else {
// For Dtmf tones, we want to ensure that inband tones are played out
// in sync with the transmitted audio. This flag is utilized by the
// channel object to determine if the queued Dtmf e vent shall also
// be fed to the output mixer in the same step as input audio is
// replaced by inband Dtmf tones.
const bool playDTFMEvent =
(isDtmf && _dtmfFeedback && !_dtmfDirectFeedback);
return channelPtr->SendTelephoneEventInband(eventCode, lengthMs,
attenuationDb, playDTFMEvent);
}
}
int VoEDtmfImpl::SetSendTelephoneEventPayloadType(int channel,
unsigned char type) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetSendTelephoneEventPayloadType(channel=%d, type=%u)", channel,
type);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(
VE_CHANNEL_NOT_VALID, kTraceError,
"SetSendTelephoneEventPayloadType() failed to locate channel");
return -1;
}
return channelPtr->SetSendTelephoneEventPayloadType(type);
}
int VoEDtmfImpl::GetSendTelephoneEventPayloadType(int channel,
unsigned char& type) {
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL) {
_shared->SetLastError(
VE_CHANNEL_NOT_VALID, kTraceError,
"GetSendTelephoneEventPayloadType() failed to locate channel");
return -1;
}
return channelPtr->GetSendTelephoneEventPayloadType(type);
}
int VoEDtmfImpl::PlayDtmfTone(int eventCode, int lengthMs, int attenuationDb) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"PlayDtmfTone(eventCode=%d, lengthMs=%d, attenuationDb=%d)",
eventCode, lengthMs, attenuationDb);
if (!_shared->statistics().Initialized()) {
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
if (!_shared->audio_device()->Playing()) {
_shared->SetLastError(VE_NOT_PLAYING, kTraceError,
"PlayDtmfTone() no channel is playing out");
return -1;
}
if ((eventCode < kMinDtmfEventCode) || (eventCode > kMaxDtmfEventCode) ||
(lengthMs < kMinTelephoneEventDuration) ||
(lengthMs > kMaxTelephoneEventDuration) ||
(attenuationDb < kMinTelephoneEventAttenuation) ||
(attenuationDb > kMaxTelephoneEventAttenuation)) {
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
"PlayDtmfTone() invalid tone parameter(s)");
return -1;
}
return _shared->output_mixer()->PlayDtmfTone(eventCode, lengthMs,
attenuationDb);
}
int VoEDtmfImpl::SetDtmfFeedbackStatus(bool enable, bool directFeedback) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetDtmfFeedbackStatus(enable=%d, directFeeback=%d)",
(int)enable, (int)directFeedback);
rtc::CritScope cs(_shared->crit_sec());
_dtmfFeedback = enable;
_dtmfDirectFeedback = directFeedback;
return 0;
}
int VoEDtmfImpl::GetDtmfFeedbackStatus(bool& enabled, bool& directFeedback) {
rtc::CritScope cs(_shared->crit_sec());
enabled = _dtmfFeedback;
directFeedback = _dtmfDirectFeedback;
return 0;
}
#endif // #ifdef WEBRTC_VOICE_ENGINE_DTMF_API
} // namespace webrtc

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_VOICE_ENGINE_VOE_DTMF_IMPL_H
#define WEBRTC_VOICE_ENGINE_VOE_DTMF_IMPL_H
#include "webrtc/voice_engine/include/voe_dtmf.h"
#include "webrtc/voice_engine/shared_data.h"
namespace webrtc {
class VoEDtmfImpl : public VoEDtmf {
public:
int SendTelephoneEvent(int channel,
int eventCode,
bool outOfBand = true,
int lengthMs = 160,
int attenuationDb = 10) override;
int SetSendTelephoneEventPayloadType(int channel,
unsigned char type) override;
int GetSendTelephoneEventPayloadType(int channel,
unsigned char& type) override;
int SetDtmfFeedbackStatus(bool enable, bool directFeedback = false) override;
int GetDtmfFeedbackStatus(bool& enabled, bool& directFeedback) override;
int PlayDtmfTone(int eventCode,
int lengthMs = 200,
int attenuationDb = 10) override;
protected:
VoEDtmfImpl(voe::SharedData* shared);
~VoEDtmfImpl() override;
private:
bool _dtmfFeedback;
bool _dtmfDirectFeedback;
voe::SharedData* _shared;
};
} // namespace webrtc
#endif // WEBRTC_VOICE_ENGINE_VOE_DTMF_IMPL_H

View File

@ -37,7 +37,6 @@
'include/voe_audio_processing.h',
'include/voe_base.h',
'include/voe_codec.h',
'include/voe_dtmf.h',
'include/voe_errors.h',
'include/voe_external_media.h',
'include/voe_file.h',
@ -79,8 +78,6 @@
'voe_base_impl.h',
'voe_codec_impl.cc',
'voe_codec_impl.h',
'voe_dtmf_impl.cc',
'voe_dtmf_impl.h',
'voe_external_media_impl.cc',
'voe_external_media_impl.h',
'voe_file_impl.cc',

View File

@ -23,9 +23,6 @@
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
#include "webrtc/voice_engine/voe_codec_impl.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
#include "webrtc/voice_engine/voe_dtmf_impl.h"
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
#include "webrtc/voice_engine/voe_external_media_impl.h"
#endif
@ -62,9 +59,6 @@ class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
public VoECodecImpl,
#endif
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
public VoEDtmfImpl,
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
public VoEExternalMediaImpl,
#endif
@ -97,9 +91,6 @@ class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
VoECodecImpl(this),
#endif
#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
VoEDtmfImpl(this),
#endif
#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
VoEExternalMediaImpl(this),
#endif