Remove DTMF detection. Talk team has been in the loop and there is no need for
DTMF detection at the receiver side. test=voe_auto_test, VoE extended test DTMF Review URL: https://webrtc-codereview.appspot.com/1168004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3663 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
728b7ea245
commit
b7edd06530
@ -342,13 +342,6 @@ typedef struct // All levels are reported in dB
|
||||
StatVal a_nlp;
|
||||
} EchoStatistics;
|
||||
|
||||
enum TelephoneEventDetectionMethods
|
||||
{
|
||||
kInBand = 0,
|
||||
kOutOfBand = 1,
|
||||
kInAndOutOfBand = 2
|
||||
};
|
||||
|
||||
enum NsModes // type of Noise Suppression
|
||||
{
|
||||
kNsUnchanged = 0, // previously set mode
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "modules/interface/module.h"
|
||||
#include "modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/interface/module.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
|
||||
namespace webrtc {
|
||||
// Forward declarations.
|
||||
@ -796,19 +796,11 @@ class RtpRtcp : public Module {
|
||||
const WebRtc_UWord16 packetSizeSamples) = 0;
|
||||
|
||||
/*
|
||||
* Outband TelephoneEvent(DTMF) detection
|
||||
* Forward DTMF to decoder for playout.
|
||||
*
|
||||
* return -1 on failure else 0
|
||||
*/
|
||||
virtual WebRtc_Word32 SetTelephoneEventStatus(
|
||||
const bool enable,
|
||||
const bool forwardToDecoder,
|
||||
const bool detectEndOfTone = false) = 0;
|
||||
|
||||
/*
|
||||
* Is outband TelephoneEvent(DTMF) turned on/off?
|
||||
*/
|
||||
virtual bool TelephoneEvent() const = 0;
|
||||
virtual int SetTelephoneEventForwardToDecoder(bool forwardToDecoder) = 0;
|
||||
|
||||
/*
|
||||
* Returns true if received DTMF events are forwarded to the decoder using
|
||||
|
@ -207,9 +207,6 @@ protected:
|
||||
|
||||
class RtpAudioFeedback {
|
||||
public:
|
||||
virtual void OnReceivedTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
const bool endOfEvent) = 0;
|
||||
|
||||
virtual void OnPlayTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
@ -304,10 +301,6 @@ class NullRtpAudioFeedback : public RtpAudioFeedback {
|
||||
public:
|
||||
virtual ~NullRtpAudioFeedback() {}
|
||||
|
||||
virtual void OnReceivedTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
const bool endOfEvent) {}
|
||||
|
||||
virtual void OnPlayTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
const WebRtc_UWord16 lengthMs,
|
||||
|
@ -247,10 +247,7 @@ class MockRtpRtcp : public RtpRtcp {
|
||||
WebRtc_Word32(RtpAudioFeedback* messagesCallback));
|
||||
MOCK_METHOD1(SetAudioPacketSize,
|
||||
WebRtc_Word32(const WebRtc_UWord16 packetSizeSamples));
|
||||
MOCK_METHOD3(SetTelephoneEventStatus,
|
||||
WebRtc_Word32(const bool enable, const bool forwardToDecoder, const bool detectEndOfTone));
|
||||
MOCK_CONST_METHOD0(TelephoneEvent,
|
||||
bool());
|
||||
MOCK_METHOD1(SetTelephoneEventForwardToDecoder, int(bool forwardToDecoder));
|
||||
MOCK_CONST_METHOD0(TelephoneEventForwardToDecoder,
|
||||
bool());
|
||||
MOCK_CONST_METHOD1(SendTelephoneEventActive,
|
||||
|
@ -27,9 +27,7 @@ RTPReceiverAudio::RTPReceiverAudio(const WebRtc_Word32 id,
|
||||
critical_section_rtp_receiver_audio_(
|
||||
CriticalSectionWrapper::CreateCriticalSection()),
|
||||
last_received_frequency_(8000),
|
||||
telephone_event_(false),
|
||||
telephone_event_forward_to_decoder_(false),
|
||||
telephone_event_detect_end_of_tone_(false),
|
||||
telephone_event_payload_type_(-1),
|
||||
cng_nb_payload_type_(-1),
|
||||
cng_wb_payload_type_(-1),
|
||||
@ -51,23 +49,13 @@ WebRtc_UWord32 RTPReceiverAudio::AudioFrequency() const {
|
||||
}
|
||||
|
||||
// Outband TelephoneEvent(DTMF) detection
|
||||
WebRtc_Word32 RTPReceiverAudio::SetTelephoneEventStatus(
|
||||
const bool enable,
|
||||
const bool forward_to_decoder,
|
||||
const bool detect_end_of_tone) {
|
||||
int RTPReceiverAudio::SetTelephoneEventForwardToDecoder(
|
||||
bool forward_to_decoder) {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
|
||||
telephone_event_ = enable;
|
||||
telephone_event_detect_end_of_tone_ = detect_end_of_tone;
|
||||
telephone_event_forward_to_decoder_ = forward_to_decoder;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Is outband TelephoneEvent(DTMF) turned on/off?
|
||||
bool RTPReceiverAudio::TelephoneEvent() const {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
|
||||
return telephone_event_;
|
||||
}
|
||||
|
||||
// Is forwarding of outband telephone events turned on/off?
|
||||
bool RTPReceiverAudio::TelephoneEventForwardToDecoder() const {
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
|
||||
@ -194,34 +182,6 @@ WebRtc_Word32 RTPReceiverAudio::OnNewPayloadTypeCreated(
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RTPReceiverAudio::SendTelephoneEvents(
|
||||
WebRtc_UWord8 number_of_new_events,
|
||||
WebRtc_UWord8 new_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS],
|
||||
WebRtc_UWord8 number_of_removed_events,
|
||||
WebRtc_UWord8 removed_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS]) {
|
||||
|
||||
// Copy these variables since we can't hold the critsect when we call the
|
||||
// callback. cb_audio_feedback_ and id_ are immutable though.
|
||||
bool telephone_event;
|
||||
bool telephone_event_detect_end_of_tone;
|
||||
{
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
|
||||
telephone_event = telephone_event_;
|
||||
telephone_event_detect_end_of_tone = telephone_event_detect_end_of_tone_;
|
||||
}
|
||||
if (telephone_event) {
|
||||
for (int n = 0; n < number_of_new_events; ++n) {
|
||||
cb_audio_feedback_->OnReceivedTelephoneEvent(id_, new_events[n], false);
|
||||
}
|
||||
if (telephone_event_detect_end_of_tone) {
|
||||
for (int n = 0; n < number_of_removed_events; ++n) {
|
||||
cb_audio_feedback_->OnReceivedTelephoneEvent(
|
||||
id_, removed_events[n], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32 RTPReceiverAudio::ParseRtpPacket(
|
||||
WebRtcRTPHeader* rtp_header,
|
||||
const ModuleRTPUtility::PayloadUnion& specific_payload,
|
||||
@ -316,10 +276,6 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
|
||||
const WebRtc_UWord16 payload_length,
|
||||
const ModuleRTPUtility::AudioPayload& audio_specific,
|
||||
const bool is_red) {
|
||||
WebRtc_UWord8 new_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS] = {};
|
||||
WebRtc_UWord8 removed_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS] = {};
|
||||
WebRtc_UWord8 number_of_new_events = 0;
|
||||
WebRtc_UWord8 number_of_removed_events = 0;
|
||||
|
||||
if (payload_length == 0) {
|
||||
return 0;
|
||||
@ -355,16 +311,12 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
|
||||
if (event != telephone_event_reported_.end()) {
|
||||
// we have already seen this event
|
||||
if (end) {
|
||||
removed_events[number_of_removed_events] = payload_data[4 * n];
|
||||
number_of_removed_events++;
|
||||
telephone_event_reported_.erase(payload_data[4 * n]);
|
||||
}
|
||||
} else {
|
||||
if (end) {
|
||||
// don't add if it's a end of a tone
|
||||
} else {
|
||||
new_events[number_of_new_events] = payload_data[4 * n];
|
||||
number_of_new_events++;
|
||||
telephone_event_reported_.insert(payload_data[4 * n]);
|
||||
}
|
||||
}
|
||||
@ -376,12 +328,6 @@ WebRtc_Word32 RTPReceiverAudio::ParseAudioCodecSpecific(
|
||||
// RFC 4733 See 2.5.1.5. & 2.5.2.4. Multiple Events in a Packet
|
||||
}
|
||||
|
||||
// This needs to be called without locks held.
|
||||
SendTelephoneEvents(number_of_new_events,
|
||||
new_events,
|
||||
number_of_removed_events,
|
||||
removed_events);
|
||||
|
||||
{
|
||||
CriticalSectionScoped lock(critical_section_rtp_receiver_audio_.get());
|
||||
|
||||
|
@ -33,13 +33,8 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
|
||||
|
||||
WebRtc_UWord32 AudioFrequency() const;
|
||||
|
||||
// Outband TelephoneEvent (DTMF) detection
|
||||
WebRtc_Word32 SetTelephoneEventStatus(const bool enable,
|
||||
const bool forward_to_decoder,
|
||||
const bool detect_end_of_tone);
|
||||
|
||||
// Is outband DTMF(AVT) turned on/off?
|
||||
bool TelephoneEvent() const;
|
||||
// Forward DTMFs to decoder for playout.
|
||||
int SetTelephoneEventForwardToDecoder(bool forward_to_decoder);
|
||||
|
||||
// Is forwarding of outband telephone events turned on/off?
|
||||
bool TelephoneEventForwardToDecoder() const;
|
||||
@ -98,11 +93,6 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
|
||||
bool* should_discard_changes);
|
||||
|
||||
private:
|
||||
void SendTelephoneEvents(
|
||||
WebRtc_UWord8 number_of_new_events,
|
||||
WebRtc_UWord8 new_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS],
|
||||
WebRtc_UWord8 number_of_removed_events,
|
||||
WebRtc_UWord8 removed_events[MAX_NUMBER_OF_PARALLEL_TELEPHONE_EVENTS]);
|
||||
|
||||
WebRtc_Word32 ParseAudioCodecSpecific(
|
||||
WebRtcRTPHeader* rtp_header,
|
||||
@ -116,9 +106,7 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
|
||||
|
||||
WebRtc_UWord32 last_received_frequency_;
|
||||
|
||||
bool telephone_event_;
|
||||
bool telephone_event_forward_to_decoder_;
|
||||
bool telephone_event_detect_end_of_tone_;
|
||||
WebRtc_Word8 telephone_event_payload_type_;
|
||||
std::set<WebRtc_UWord8> telephone_event_reported_;
|
||||
|
||||
|
@ -1582,29 +1582,17 @@ WebRtc_Word32 ModuleRtpRtcpImpl::SetStorePacketsStatus(
|
||||
return 0; // TODO(pwestin): change to void.
|
||||
}
|
||||
|
||||
// Out-band TelephoneEvent detection.
|
||||
WebRtc_Word32 ModuleRtpRtcpImpl::SetTelephoneEventStatus(
|
||||
const bool enable,
|
||||
const bool forward_to_decoder,
|
||||
const bool detect_end_of_tone) {
|
||||
// Forward DTMFs to decoder for playout.
|
||||
int ModuleRtpRtcpImpl::SetTelephoneEventForwardToDecoder(
|
||||
bool forward_to_decoder) {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_,
|
||||
"SetTelephoneEventStatus(enable:%d forward_to_decoder:%d"
|
||||
" detect_end_of_tone:%d)", enable, forward_to_decoder,
|
||||
detect_end_of_tone);
|
||||
"SetTelephoneEventForwardToDecoder(forward_to_decoder:%d)",
|
||||
forward_to_decoder);
|
||||
|
||||
assert(audio_);
|
||||
assert(rtp_telephone_event_handler_);
|
||||
return rtp_telephone_event_handler_->SetTelephoneEventStatus(
|
||||
enable, forward_to_decoder, detect_end_of_tone);
|
||||
}
|
||||
|
||||
// Is out-band TelephoneEvent turned on/off?
|
||||
bool ModuleRtpRtcpImpl::TelephoneEvent() const {
|
||||
WEBRTC_TRACE(kTraceModuleCall, kTraceRtpRtcp, id_, "TelephoneEvent()");
|
||||
|
||||
assert(audio_);
|
||||
assert(rtp_telephone_event_handler_);
|
||||
return rtp_telephone_event_handler_->TelephoneEvent();
|
||||
return rtp_telephone_event_handler_->SetTelephoneEventForwardToDecoder(
|
||||
forward_to_decoder);
|
||||
}
|
||||
|
||||
// Is forwarding of out-band telephone events turned on/off?
|
||||
|
@ -345,14 +345,8 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
||||
virtual WebRtc_Word32 SetAudioPacketSize(
|
||||
const WebRtc_UWord16 packet_size_samples);
|
||||
|
||||
// Outband DTMF detection.
|
||||
virtual WebRtc_Word32 SetTelephoneEventStatus(
|
||||
const bool enable,
|
||||
const bool forward_to_decoder,
|
||||
const bool detect_end_of_tone = false);
|
||||
|
||||
// Is outband DTMF turned on/off?
|
||||
virtual bool TelephoneEvent() const;
|
||||
// Forward DTMFs to decoder for playout.
|
||||
virtual int SetTelephoneEventForwardToDecoder(bool forward_to_decoder);
|
||||
|
||||
// Is forwarding of outband telephone events turned on/off?
|
||||
virtual bool TelephoneEventForwardToDecoder() const;
|
||||
|
@ -190,11 +190,8 @@ TEST_F(RtpRtcpAudioTest, Basic) {
|
||||
EXPECT_EQ(0, module1->SetSSRC(test_ssrc));
|
||||
EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp));
|
||||
|
||||
EXPECT_FALSE(module1->TelephoneEvent());
|
||||
|
||||
// Test detection at the end of a DTMF tone.
|
||||
EXPECT_EQ(0, module2->SetTelephoneEventStatus(true, true, true));
|
||||
EXPECT_EQ(true, module2->TelephoneEvent());
|
||||
EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true));
|
||||
|
||||
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
||||
|
||||
|
@ -93,28 +93,6 @@ Channel::InFrameType(WebRtc_Word16 frameType)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
int
|
||||
Channel::IncomingDtmf(const WebRtc_UWord8 digitDtmf, const bool end)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::IncomingDtmf(digitDtmf=%u, end=%d)",
|
||||
digitDtmf, end);
|
||||
|
||||
if (digitDtmf != 999)
|
||||
{
|
||||
CriticalSectionScoped cs(&_callbackCritSect);
|
||||
if (_telephoneEventDetectionPtr)
|
||||
{
|
||||
_telephoneEventDetectionPtr->OnReceivedTelephoneEventInband(
|
||||
_channelId, digitDtmf, end);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
WebRtc_Word32
|
||||
Channel::OnRxVadDetected(const int vadDecision)
|
||||
{
|
||||
@ -510,29 +488,6 @@ Channel::IncomingRTCPPacket(const WebRtc_Word8* incomingRtcpPacket,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Channel::OnReceivedTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
const bool endOfEvent)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::OnReceivedTelephoneEvent(id=%d, event=%u,"
|
||||
" endOfEvent=%d)", id, event, endOfEvent);
|
||||
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
if (_outOfBandTelephoneEventDetecion)
|
||||
{
|
||||
CriticalSectionScoped cs(&_callbackCritSect);
|
||||
|
||||
if (_telephoneEventDetectionPtr)
|
||||
{
|
||||
_telephoneEventDetectionPtr->OnReceivedTelephoneEventOutOfBand(
|
||||
_channelId, event, endOfEvent);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Channel::OnPlayTelephoneEvent(const WebRtc_Word32 id,
|
||||
const WebRtc_UWord8 event,
|
||||
@ -1123,9 +1078,6 @@ Channel::Channel(const WebRtc_Word32 channelId,
|
||||
_encryptionPtr(NULL),
|
||||
_rtpAudioProc(NULL),
|
||||
_rxAudioProcessingModulePtr(NULL),
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
_telephoneEventDetectionPtr(NULL),
|
||||
#endif
|
||||
_rxVadObserverPtr(NULL),
|
||||
_oldVadDecision(-1),
|
||||
_sendFrameType(0),
|
||||
@ -1149,8 +1101,6 @@ Channel::Channel(const WebRtc_Word32 channelId,
|
||||
_decrypting(false),
|
||||
_playOutbandDtmfEvent(false),
|
||||
_playInbandDtmfEvent(false),
|
||||
_inbandTelephoneEventDetection(false),
|
||||
_outOfBandTelephoneEventDetecion(false),
|
||||
_extraPayloadType(0),
|
||||
_insertExtraRTPPacket(false),
|
||||
_extraMarkerBit(false),
|
||||
@ -1268,15 +1218,6 @@ Channel::~Channel()
|
||||
"~Channel() failed to de-register VAD callback"
|
||||
" (Audio coding module)");
|
||||
}
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
if (_audioCodingModule.RegisterIncomingMessagesCallback(NULL) == -1)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceVoice,
|
||||
VoEId(_instanceId,_channelId),
|
||||
"~Channel() failed to de-register incoming messages "
|
||||
"callback (Audio coding module)");
|
||||
}
|
||||
#endif
|
||||
// De-register modules in process thread
|
||||
#ifndef WEBRTC_EXTERNAL_TRANSPORT
|
||||
if (_moduleProcessThreadPtr->DeRegisterModule(&_socketTransportModule)
|
||||
@ -1380,7 +1321,7 @@ Channel::Init()
|
||||
// be transmitted since the Transport object will then be invalid.
|
||||
|
||||
const bool rtpRtcpFail =
|
||||
((_rtpRtcpModule->SetTelephoneEventStatus(false, true, true) == -1) ||
|
||||
((_rtpRtcpModule->SetTelephoneEventForwardToDecoder(true) == -1) ||
|
||||
// RTCP is enabled by default
|
||||
(_rtpRtcpModule->SetRTCPStatus(kRtcpCompound) == -1));
|
||||
if (rtpRtcpFail)
|
||||
@ -1768,10 +1709,8 @@ Channel::StopReceiving()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bool dtmfDetection = _rtpRtcpModule->TelephoneEvent();
|
||||
// Recover DTMF detection status.
|
||||
WebRtc_Word32 ret = _rtpRtcpModule->SetTelephoneEventStatus(dtmfDetection,
|
||||
true, true);
|
||||
WebRtc_Word32 ret = _rtpRtcpModule->SetTelephoneEventForwardToDecoder(true);
|
||||
if (ret != 0) {
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
VE_INVALID_OPERATION, kTraceWarning,
|
||||
@ -4455,144 +4394,6 @@ Channel::GetSendTelephoneEventPayloadType(unsigned char& type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
|
||||
WebRtc_Word32
|
||||
Channel::RegisterTelephoneEventDetection(
|
||||
TelephoneEventDetectionMethods detectionMethod,
|
||||
VoETelephoneEventObserver& observer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
|
||||
"Channel::RegisterTelephoneEventDetection()");
|
||||
CriticalSectionScoped cs(&_callbackCritSect);
|
||||
|
||||
if (_telephoneEventDetectionPtr)
|
||||
{
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
VE_INVALID_OPERATION, kTraceError,
|
||||
"RegisterTelephoneEventDetection() detection already enabled");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_telephoneEventDetectionPtr = &observer;
|
||||
|
||||
switch (detectionMethod)
|
||||
{
|
||||
case kInBand:
|
||||
_inbandTelephoneEventDetection = true;
|
||||
_outOfBandTelephoneEventDetecion = false;
|
||||
break;
|
||||
case kOutOfBand:
|
||||
_inbandTelephoneEventDetection = false;
|
||||
_outOfBandTelephoneEventDetecion = true;
|
||||
break;
|
||||
case kInAndOutOfBand:
|
||||
_inbandTelephoneEventDetection = true;
|
||||
_outOfBandTelephoneEventDetecion = true;
|
||||
break;
|
||||
default:
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
VE_INVALID_ARGUMENT, kTraceError,
|
||||
"RegisterTelephoneEventDetection() invalid detection method");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_inbandTelephoneEventDetection)
|
||||
{
|
||||
// Enable in-band Dtmf detectin in the ACM.
|
||||
if (_audioCodingModule.RegisterIncomingMessagesCallback(this) != 0)
|
||||
{
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
VE_AUDIO_CODING_MODULE_ERROR, kTraceError,
|
||||
"RegisterTelephoneEventDetection() failed to enable Dtmf "
|
||||
"detection");
|
||||
}
|
||||
}
|
||||
|
||||
// Enable/disable out-of-band detection of received telephone-events.
|
||||
// When enabled, RtpAudioFeedback::OnReceivedTelephoneEvent() will be
|
||||
// called two times by the RTP/RTCP module (start & end).
|
||||
const bool forwardToDecoder =
|
||||
_rtpRtcpModule->TelephoneEventForwardToDecoder();
|
||||
const bool detectEndOfTone = true;
|
||||
_rtpRtcpModule->SetTelephoneEventStatus(_outOfBandTelephoneEventDetecion,
|
||||
forwardToDecoder,
|
||||
detectEndOfTone);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Channel::DeRegisterTelephoneEventDetection()
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
|
||||
"Channel::DeRegisterTelephoneEventDetection()");
|
||||
|
||||
CriticalSectionScoped cs(&_callbackCritSect);
|
||||
|
||||
if (!_telephoneEventDetectionPtr)
|
||||
{
|
||||
_engineStatisticsPtr->SetLastError(
|
||||
VE_INVALID_OPERATION,
|
||||
kTraceWarning,
|
||||
"DeRegisterTelephoneEventDetection() detection already disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Disable out-of-band event detection
|
||||
const bool forwardToDecoder =
|
||||
_rtpRtcpModule->TelephoneEventForwardToDecoder();
|
||||
_rtpRtcpModule->SetTelephoneEventStatus(false, forwardToDecoder);
|
||||
|
||||
// Disable in-band Dtmf detection
|
||||
_audioCodingModule.RegisterIncomingMessagesCallback(NULL);
|
||||
|
||||
_inbandTelephoneEventDetection = false;
|
||||
_outOfBandTelephoneEventDetecion = false;
|
||||
_telephoneEventDetectionPtr = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Channel::GetTelephoneEventDetectionStatus(
|
||||
bool& enabled,
|
||||
TelephoneEventDetectionMethods& detectionMethod)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId),
|
||||
"Channel::GetTelephoneEventDetectionStatus()");
|
||||
|
||||
{
|
||||
CriticalSectionScoped cs(&_callbackCritSect);
|
||||
enabled = (_telephoneEventDetectionPtr != NULL);
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
if (_inbandTelephoneEventDetection && !_outOfBandTelephoneEventDetecion)
|
||||
detectionMethod = kInBand;
|
||||
else if (!_inbandTelephoneEventDetection
|
||||
&& _outOfBandTelephoneEventDetecion)
|
||||
detectionMethod = kOutOfBand;
|
||||
else if (_inbandTelephoneEventDetection
|
||||
&& _outOfBandTelephoneEventDetecion)
|
||||
detectionMethod = kInAndOutOfBand;
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId, _channelId),
|
||||
"GetTelephoneEventDetectionStatus() => enabled=%d,"
|
||||
"detectionMethod=%d", enabled, detectionMethod);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // #ifdef WEBRTC_DTMF_DETECTION
|
||||
|
||||
int
|
||||
Channel::UpdateRxVadDetection(AudioFrame& audioFrame)
|
||||
{
|
||||
|
@ -73,9 +73,6 @@ class Channel:
|
||||
public RtpAudioFeedback,
|
||||
public AudioPacketizationCallback, // receive encoded packets from the ACM
|
||||
public ACMVADCallback, // receive voice activity from the ACM
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
public AudioCodingFeedback, // inband Dtmf detection in the ACM
|
||||
#endif
|
||||
public MixerParticipant // supplies output mixer with audio frames
|
||||
{
|
||||
public:
|
||||
@ -296,15 +293,6 @@ public:
|
||||
bool DtmfPlayoutStatus() const;
|
||||
int SetSendTelephoneEventPayloadType(unsigned char type);
|
||||
int GetSendTelephoneEventPayloadType(unsigned char& type);
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
int RegisterTelephoneEventDetection(
|
||||
TelephoneEventDetectionMethods detectionMethod,
|
||||
VoETelephoneEventObserver& observer);
|
||||
int DeRegisterTelephoneEventDetection();
|
||||
int GetTelephoneEventDetectionStatus(
|
||||
bool& enabled,
|
||||
TelephoneEventDetectionMethods& detectionMethod);
|
||||
#endif
|
||||
|
||||
// VoEAudioProcessingImpl
|
||||
int UpdateRxVadDetection(AudioFrame& audioFrame);
|
||||
@ -372,11 +360,6 @@ public:
|
||||
// From ACMVADCallback in the ACM
|
||||
WebRtc_Word32 InFrameType(WebRtc_Word16 frameType);
|
||||
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
public: // From AudioCodingFeedback in the ACM
|
||||
int IncomingDtmf(const WebRtc_UWord8 digitDtmf, const bool end);
|
||||
#endif
|
||||
|
||||
public:
|
||||
WebRtc_Word32 OnRxVadDetected(const int vadDecision);
|
||||
|
||||
@ -603,9 +586,6 @@ private:
|
||||
Encryption* _encryptionPtr; // WebRtc SRTP or external encryption
|
||||
scoped_ptr<AudioProcessing> _rtpAudioProc;
|
||||
AudioProcessing* _rxAudioProcessingModulePtr; // far end AudioProcessing
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
VoETelephoneEventObserver* _telephoneEventDetectionPtr;
|
||||
#endif
|
||||
VoERxVadCallback* _rxVadObserverPtr;
|
||||
WebRtc_Word32 _oldVadDecision;
|
||||
WebRtc_Word32 _sendFrameType; // Send data is voice, 1-voice, 0-otherwise
|
||||
@ -634,8 +614,6 @@ private:
|
||||
// VoEDtmf
|
||||
bool _playOutbandDtmfEvent;
|
||||
bool _playInbandDtmfEvent;
|
||||
bool _inbandTelephoneEventDetection;
|
||||
bool _outOfBandTelephoneEventDetecion;
|
||||
// VoeRTP_RTCP
|
||||
WebRtc_UWord8 _extraPayloadType;
|
||||
bool _insertExtraRTPPacket;
|
||||
|
@ -33,35 +33,12 @@
|
||||
#ifndef WEBRTC_VOICE_ENGINE_VOE_DTMF_H
|
||||
#define WEBRTC_VOICE_ENGINE_VOE_DTMF_H
|
||||
|
||||
#include "common_types.h"
|
||||
#include "webrtc/common_types.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class VoiceEngine;
|
||||
|
||||
// VoETelephoneEventObserver
|
||||
class WEBRTC_DLLEXPORT VoETelephoneEventObserver
|
||||
{
|
||||
public:
|
||||
// This method will be called after the detection of an inband
|
||||
// telephone event. The event code is given as output in the
|
||||
// |eventCode| parameter.
|
||||
virtual void OnReceivedTelephoneEventInband(int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent) = 0;
|
||||
|
||||
// This method will be called after the detection of an out-of-band
|
||||
// telephone event. The event code is given as output in the
|
||||
// |eventCode| parameter.
|
||||
virtual void OnReceivedTelephoneEventOutOfBand(
|
||||
int channel,
|
||||
int eventCode,
|
||||
bool endOfEvent) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~VoETelephoneEventObserver() {}
|
||||
};
|
||||
|
||||
// VoEDtmf
|
||||
class WEBRTC_DLLEXPORT VoEDtmf
|
||||
{
|
||||
@ -122,22 +99,6 @@ public:
|
||||
// Stops playing out a DTMF feedback tone locally.
|
||||
virtual int StopPlayingDtmfTone() = 0;
|
||||
|
||||
// Installs an instance of a VoETelephoneEventObserver derived class and
|
||||
// activates detection of telephone events for the specified |channel|.
|
||||
virtual int RegisterTelephoneEventDetection(
|
||||
int channel, TelephoneEventDetectionMethods detectionMethod,
|
||||
VoETelephoneEventObserver& observer) = 0;
|
||||
|
||||
// Removes an instance of a VoETelephoneEventObserver derived class and
|
||||
// disables detection of telephone events for the specified |channel|.
|
||||
virtual int DeRegisterTelephoneEventDetection(int channel) = 0;
|
||||
|
||||
// Gets the current telephone-event detection status for a specified
|
||||
// |channel|.
|
||||
virtual int GetTelephoneEventDetectionStatus(
|
||||
int channel, bool& enabled,
|
||||
TelephoneEventDetectionMethods& detectionMethod) = 0;
|
||||
|
||||
protected:
|
||||
VoEDtmf() {}
|
||||
virtual ~VoEDtmf() {}
|
||||
|
@ -3319,71 +3319,6 @@ int VoEExtendedTest::TestDtmf() {
|
||||
AOK();
|
||||
ANL();
|
||||
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
TEST(RegisterTelephoneEventDetection - several channels); ANL();
|
||||
|
||||
ci.channels = 1;
|
||||
ci.pacsize = 160;
|
||||
ci.plfreq = 8000;
|
||||
ci.pltype = 0;
|
||||
ci.rate = 64000;
|
||||
strcpy(ci.plname, "PCMU");
|
||||
TEST_MUSTPASS(codec->SetSendCodec(0, ci));
|
||||
|
||||
int ch2 = voe_base_->CreateChannel();
|
||||
TEST_MUSTPASS(voe_base_->SetSendDestination(ch2, 8002, "127.0.0.1"));
|
||||
TEST_MUSTPASS(voe_base_->SetLocalReceiver(ch2, 8002));
|
||||
TEST_MUSTPASS(voe_base_->StartReceive(ch2));
|
||||
TEST_MUSTPASS(codec->SetSendCodec(ch2, ci));
|
||||
TEST_MUSTPASS(voe_base_->StartPlayout(ch2));
|
||||
TEST_MUSTPASS(voe_base_->StartSend(ch2));
|
||||
MARK();
|
||||
|
||||
DtmfCallback *d = new DtmfCallback();
|
||||
TEST_MUSTPASS(dtmf->SetDtmfFeedbackStatus(false));
|
||||
|
||||
TEST_MUSTPASS(voe_base_->StopSend(0));
|
||||
TEST_MUSTPASS(voe_base_->StopPlayout(0));
|
||||
TEST_MUSTPASS(voe_base_->StartSend(0));
|
||||
TEST_MUSTPASS(voe_base_->StartPlayout(0));
|
||||
|
||||
// In-band
|
||||
TEST_MUSTPASS(dtmf->RegisterTelephoneEventDetection(0, kInBand, *d));
|
||||
TEST_MUSTPASS(dtmf->RegisterTelephoneEventDetection(ch2, kInBand, *d));
|
||||
TEST_LOG("\nSending in-band telephone events:");
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
TEST_LOG("\n %d ", i); fflush(NULL);
|
||||
TEST_MUSTPASS(dtmf->SendTelephoneEvent(0, i, false, 160, 10));
|
||||
TEST_MUSTPASS(dtmf->SendTelephoneEvent(ch2, i, false, 160, 10));
|
||||
SleepMs(500);
|
||||
}
|
||||
TEST_LOG("\nDetected %d events \n", d->counter);
|
||||
TEST_MUSTPASS(d->counter != 32);
|
||||
TEST_MUSTPASS(dtmf->DeRegisterTelephoneEventDetection(0));
|
||||
TEST_MUSTPASS(dtmf->DeRegisterTelephoneEventDetection(ch2));
|
||||
|
||||
// Out-of-band
|
||||
d->counter = 0;
|
||||
TEST_MUSTPASS(dtmf->RegisterTelephoneEventDetection(0, kOutOfBand, *d));
|
||||
TEST_MUSTPASS(dtmf->RegisterTelephoneEventDetection(ch2, kOutOfBand, *d));
|
||||
TEST_LOG("\nSending out-band telephone events:");
|
||||
for(int i = 0; i < 16; i++)
|
||||
{
|
||||
TEST_LOG("\n %d ", i); fflush(NULL);
|
||||
TEST_MUSTPASS(dtmf->SendTelephoneEvent(0, i, true, 160, 10));
|
||||
TEST_MUSTPASS(dtmf->SendTelephoneEvent(ch2, i, true, 160, 10));
|
||||
SleepMs(500);
|
||||
}
|
||||
TEST_LOG("\nDetected %d events \n", d->counter);
|
||||
TEST_MUSTPASS(d->counter != 32);
|
||||
TEST_MUSTPASS(dtmf->DeRegisterTelephoneEventDetection(0));
|
||||
TEST_MUSTPASS(dtmf->DeRegisterTelephoneEventDetection(ch2));
|
||||
delete d;
|
||||
|
||||
AOK(); ANL();
|
||||
#endif
|
||||
|
||||
TEST_MUSTPASS(dtmf->SetDtmfFeedbackStatus(true, false));
|
||||
TEST_MUSTPASS(voe_base_->StopSend(0));
|
||||
TEST_MUSTPASS(voe_base_->StopPlayout(0));
|
||||
|
@ -8,15 +8,15 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "voe_dtmf_impl.h"
|
||||
#include "webrtc/voice_engine/voe_dtmf_impl.h"
|
||||
|
||||
#include "channel.h"
|
||||
#include "critical_section_wrapper.h"
|
||||
#include "output_mixer.h"
|
||||
#include "trace.h"
|
||||
#include "transmit_mixer.h"
|
||||
#include "voe_errors.h"
|
||||
#include "voice_engine_impl.h"
|
||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||
#include "webrtc/system_wrappers/interface/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 {
|
||||
|
||||
@ -271,94 +271,6 @@ int VoEDtmfImpl::StopPlayingDtmfTone()
|
||||
return _shared->output_mixer()->StopPlayingDtmfTone();
|
||||
}
|
||||
|
||||
int VoEDtmfImpl::RegisterTelephoneEventDetection(
|
||||
int channel,
|
||||
TelephoneEventDetectionMethods detectionMethod,
|
||||
VoETelephoneEventObserver& observer)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"RegisterTelephoneEventDetection(channel=%d, detectionMethod=%d,"
|
||||
"observer=0x%x)", channel, detectionMethod, &observer);
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"RegisterTelephoneEventDetection() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->RegisterTelephoneEventDetection(detectionMethod,
|
||||
observer);
|
||||
#else
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
||||
"SetTelephoneEventDetectionStatus() Dtmf detection is not supported");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEDtmfImpl::DeRegisterTelephoneEventDetection(int channel)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"DeRegisterTelephoneEventDetection(channel=%d)", channel);
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"DeRegisterTelephoneEventDe tection() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->DeRegisterTelephoneEventDetection();
|
||||
#else
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
||||
"DeRegisterTelephoneEventDetection() Dtmf detection is not supported");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int VoEDtmfImpl::GetTelephoneEventDetectionStatus(
|
||||
int channel,
|
||||
bool& enabled,
|
||||
TelephoneEventDetectionMethods& detectionMethod)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
"GetTelephoneEventDetectionStatus(channel=%d)", channel);
|
||||
#ifdef WEBRTC_DTMF_DETECTION
|
||||
if (!_shared->statistics().Initialized())
|
||||
{
|
||||
_shared->SetLastError(VE_NOT_INITED, kTraceError);
|
||||
return -1;
|
||||
}
|
||||
voe::ScopedChannel sc(_shared->channel_manager(), channel);
|
||||
voe::Channel* channelPtr = sc.ChannelPtr();
|
||||
if (channelPtr == NULL)
|
||||
{
|
||||
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
|
||||
"GetTelephoneEventDetectionStatus() failed to locate channel");
|
||||
return -1;
|
||||
}
|
||||
return channelPtr->GetTelephoneEventDetectionStatus(enabled,
|
||||
detectionMethod);
|
||||
#else
|
||||
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
|
||||
"GetTelephoneEventDetectionStatus() Dtmf detection is not supported");
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int VoEDtmfImpl::SetDtmfFeedbackStatus(bool enable, bool directFeedback)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
|
||||
|
@ -11,9 +11,8 @@
|
||||
#ifndef WEBRTC_VOICE_ENGINE_VOE_DTMF_IMPL_H
|
||||
#define WEBRTC_VOICE_ENGINE_VOE_DTMF_IMPL_H
|
||||
|
||||
#include "voe_dtmf.h"
|
||||
|
||||
#include "shared_data.h"
|
||||
#include "webrtc/voice_engine/include/voe_dtmf.h"
|
||||
#include "webrtc/voice_engine/shared_data.h"
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
@ -48,18 +47,6 @@ public:
|
||||
|
||||
virtual int StopPlayingDtmfTone();
|
||||
|
||||
virtual int RegisterTelephoneEventDetection(
|
||||
int channel,
|
||||
TelephoneEventDetectionMethods detectionMethod,
|
||||
VoETelephoneEventObserver& observer);
|
||||
|
||||
virtual int DeRegisterTelephoneEventDetection(int channel);
|
||||
|
||||
virtual int GetTelephoneEventDetectionStatus(
|
||||
int channel,
|
||||
bool& enabled,
|
||||
TelephoneEventDetectionMethods& detectionMethod);
|
||||
|
||||
virtual int SetDtmfPlayoutStatus(int channel, bool enable);
|
||||
|
||||
virtual int GetDtmfPlayoutStatus(int channel, bool& enabled);
|
||||
|
Loading…
x
Reference in New Issue
Block a user