Revert of Remove unnecessary interface TelephoneEventHandler (patchset #3 id:40001 of https://codereview.webrtc.org/2357583002/ )
Reason for revert: breaks downstream code Original issue's description: > Remove unnecessary interface TelephoneEventHandler. > > BUG=webrtc:2795 > > Committed: https://crrev.com/2beb42983ca24e1326a9a7f2c06b3ad740eea2c3 > Cr-Commit-Position: refs/heads/master@{#14346} TBR=henrik.lundin@webrtc.org,solenberg@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:2795 Review-Url: https://codereview.webrtc.org/2362673002 Cr-Commit-Position: refs/heads/master@{#14348}
This commit is contained in:
@ -18,6 +18,21 @@ namespace webrtc {
|
|||||||
|
|
||||||
class RTPPayloadRegistry;
|
class RTPPayloadRegistry;
|
||||||
|
|
||||||
|
class TelephoneEventHandler {
|
||||||
|
public:
|
||||||
|
virtual ~TelephoneEventHandler() {}
|
||||||
|
|
||||||
|
// The following three methods implement the TelephoneEventHandler interface.
|
||||||
|
// Forward DTMFs to decoder for playout.
|
||||||
|
virtual void SetTelephoneEventForwardToDecoder(bool forward_to_decoder) = 0;
|
||||||
|
|
||||||
|
// Is forwarding of outband telephone events turned on/off?
|
||||||
|
virtual bool TelephoneEventForwardToDecoder() const = 0;
|
||||||
|
|
||||||
|
// Is TelephoneEvent configured with payload type payload_type
|
||||||
|
virtual bool TelephoneEventPayloadType(const int8_t payload_type) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class RtpReceiver {
|
class RtpReceiver {
|
||||||
public:
|
public:
|
||||||
// Creates a video-enabled RTP receiver.
|
// Creates a video-enabled RTP receiver.
|
||||||
@ -36,6 +51,9 @@ class RtpReceiver {
|
|||||||
|
|
||||||
virtual ~RtpReceiver() {}
|
virtual ~RtpReceiver() {}
|
||||||
|
|
||||||
|
// Returns a TelephoneEventHandler if available.
|
||||||
|
virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0;
|
||||||
|
|
||||||
// Registers a receive payload in the payload registry and notifies the media
|
// Registers a receive payload in the payload registry and notifies the media
|
||||||
// receiver strategy.
|
// receiver strategy.
|
||||||
virtual int32_t RegisterReceivePayload(
|
virtual int32_t RegisterReceivePayload(
|
||||||
|
|||||||
@ -25,7 +25,9 @@ RTPReceiverStrategy* RTPReceiverStrategy::CreateAudioStrategy(
|
|||||||
|
|
||||||
RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
|
RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
|
||||||
: RTPReceiverStrategy(data_callback),
|
: RTPReceiverStrategy(data_callback),
|
||||||
|
TelephoneEventHandler(),
|
||||||
last_received_frequency_(8000),
|
last_received_frequency_(8000),
|
||||||
|
telephone_event_forward_to_decoder_(false),
|
||||||
telephone_event_payload_type_(-1),
|
telephone_event_payload_type_(-1),
|
||||||
cng_nb_payload_type_(-1),
|
cng_nb_payload_type_(-1),
|
||||||
cng_wb_payload_type_(-1),
|
cng_wb_payload_type_(-1),
|
||||||
@ -40,6 +42,19 @@ RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
|
|||||||
memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
|
memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Outband TelephoneEvent(DTMF) detection
|
||||||
|
void RTPReceiverAudio::SetTelephoneEventForwardToDecoder(
|
||||||
|
bool forward_to_decoder) {
|
||||||
|
rtc::CritScope lock(&crit_sect_);
|
||||||
|
telephone_event_forward_to_decoder_ = forward_to_decoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is forwarding of outband telephone events turned on/off?
|
||||||
|
bool RTPReceiverAudio::TelephoneEventForwardToDecoder() const {
|
||||||
|
rtc::CritScope lock(&crit_sect_);
|
||||||
|
return telephone_event_forward_to_decoder_;
|
||||||
|
}
|
||||||
|
|
||||||
bool RTPReceiverAudio::TelephoneEventPayloadType(
|
bool RTPReceiverAudio::TelephoneEventPayloadType(
|
||||||
int8_t payload_type) const {
|
int8_t payload_type) const {
|
||||||
rtc::CritScope lock(&crit_sect_);
|
rtc::CritScope lock(&crit_sect_);
|
||||||
@ -341,6 +356,10 @@ int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
|
|||||||
|
|
||||||
// check if it's a DTMF event, hence something we can playout
|
// check if it's a DTMF event, hence something we can playout
|
||||||
if (telephone_event_packet) {
|
if (telephone_event_packet) {
|
||||||
|
if (!telephone_event_forward_to_decoder_) {
|
||||||
|
// don't forward event to decoder
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
std::set<uint8_t>::iterator first =
|
std::set<uint8_t>::iterator first =
|
||||||
telephone_event_reported_.begin();
|
telephone_event_reported_.begin();
|
||||||
if (first != telephone_event_reported_.end() && *first > 15) {
|
if (first != telephone_event_reported_.end() && *first > 15) {
|
||||||
|
|||||||
@ -23,13 +23,23 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// Handles audio RTP packets. This class is thread-safe.
|
// Handles audio RTP packets. This class is thread-safe.
|
||||||
class RTPReceiverAudio : public RTPReceiverStrategy {
|
class RTPReceiverAudio : public RTPReceiverStrategy,
|
||||||
|
public TelephoneEventHandler {
|
||||||
public:
|
public:
|
||||||
explicit RTPReceiverAudio(RtpData* data_callback);
|
explicit RTPReceiverAudio(RtpData* data_callback);
|
||||||
virtual ~RTPReceiverAudio() {}
|
virtual ~RTPReceiverAudio() {}
|
||||||
|
|
||||||
|
// The following three methods implement the TelephoneEventHandler interface.
|
||||||
|
// Forward DTMFs to decoder for playout.
|
||||||
|
void SetTelephoneEventForwardToDecoder(bool forward_to_decoder) override;
|
||||||
|
|
||||||
|
// Is forwarding of outband telephone events turned on/off?
|
||||||
|
bool TelephoneEventForwardToDecoder() const override;
|
||||||
|
|
||||||
// Is TelephoneEvent configured with payload type payload_type
|
// Is TelephoneEvent configured with payload type payload_type
|
||||||
bool TelephoneEventPayloadType(const int8_t payload_type) const;
|
bool TelephoneEventPayloadType(const int8_t payload_type) const override;
|
||||||
|
|
||||||
|
TelephoneEventHandler* GetTelephoneEventHandler() override { return this; }
|
||||||
|
|
||||||
// Returns true if CNG is configured with payload type payload_type. If so,
|
// Returns true if CNG is configured with payload type payload_type. If so,
|
||||||
// the frequency and cng_payload_type_has_changed are filled in.
|
// the frequency and cng_payload_type_has_changed are filled in.
|
||||||
|
|||||||
@ -200,6 +200,10 @@ bool RtpReceiverImpl::IncomingRtpPacket(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TelephoneEventHandler* RtpReceiverImpl::GetTelephoneEventHandler() {
|
||||||
|
return rtp_media_receiver_->GetTelephoneEventHandler();
|
||||||
|
}
|
||||||
|
|
||||||
bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const {
|
bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const {
|
||||||
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
rtc::CritScope lock(&critical_section_rtp_receiver_);
|
||||||
if (!HaveReceivedFrame())
|
if (!HaveReceivedFrame())
|
||||||
|
|||||||
@ -57,6 +57,8 @@ class RtpReceiverImpl : public RtpReceiver {
|
|||||||
|
|
||||||
int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
|
int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
|
||||||
|
|
||||||
|
TelephoneEventHandler* GetTelephoneEventHandler() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool HaveReceivedFrame() const;
|
bool HaveReceivedFrame() const;
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,8 @@ class RTPReceiverStrategy {
|
|||||||
int64_t timestamp_ms,
|
int64_t timestamp_ms,
|
||||||
bool is_first_packet) = 0;
|
bool is_first_packet) = 0;
|
||||||
|
|
||||||
|
virtual TelephoneEventHandler* GetTelephoneEventHandler() = 0;
|
||||||
|
|
||||||
// Retrieves the last known applicable frequency.
|
// Retrieves the last known applicable frequency.
|
||||||
virtual int GetPayloadTypeFrequency() const = 0;
|
virtual int GetPayloadTypeFrequency() const = 0;
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,8 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
|
|||||||
int64_t timestamp,
|
int64_t timestamp,
|
||||||
bool is_first_packet) override;
|
bool is_first_packet) override;
|
||||||
|
|
||||||
|
TelephoneEventHandler* GetTelephoneEventHandler() override { return NULL; }
|
||||||
|
|
||||||
int GetPayloadTypeFrequency() const override;
|
int GetPayloadTypeFrequency() const override;
|
||||||
|
|
||||||
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;
|
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;
|
||||||
|
|||||||
@ -162,6 +162,9 @@ TEST_F(RtpRtcpAudioTest, Basic) {
|
|||||||
module1->SetSSRC(test_ssrc);
|
module1->SetSSRC(test_ssrc);
|
||||||
module1->SetStartTimestamp(test_timestamp);
|
module1->SetStartTimestamp(test_timestamp);
|
||||||
|
|
||||||
|
// Test detection at the end of a DTMF tone.
|
||||||
|
// EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true));
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
||||||
|
|
||||||
// Start basic RTP test.
|
// Start basic RTP test.
|
||||||
|
|||||||
@ -809,6 +809,7 @@ Channel::Channel(int32_t channelId,
|
|||||||
this,
|
this,
|
||||||
this,
|
this,
|
||||||
rtp_payload_registry_.get())),
|
rtp_payload_registry_.get())),
|
||||||
|
telephone_event_handler_(rtp_receiver_->GetTelephoneEventHandler()),
|
||||||
_outputAudioLevel(),
|
_outputAudioLevel(),
|
||||||
_externalTransport(false),
|
_externalTransport(false),
|
||||||
// Avoid conflict with other channels by adding 1024 - 1026,
|
// Avoid conflict with other channels by adding 1024 - 1026,
|
||||||
@ -978,6 +979,7 @@ int32_t Channel::Init() {
|
|||||||
// disabled by the user.
|
// disabled by the user.
|
||||||
// After StopListen (when no sockets exists), RTCP packets will no longer
|
// After StopListen (when no sockets exists), RTCP packets will no longer
|
||||||
// be transmitted since the Transport object will then be invalid.
|
// be transmitted since the Transport object will then be invalid.
|
||||||
|
telephone_event_handler_->SetTelephoneEventForwardToDecoder(true);
|
||||||
// RTCP is enabled by default.
|
// RTCP is enabled by default.
|
||||||
_rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound);
|
_rtpRtcpModule->SetRTCPStatus(RtcpMode::kCompound);
|
||||||
// --- Register all permanent callbacks
|
// --- Register all permanent callbacks
|
||||||
|
|||||||
@ -458,6 +458,7 @@ class Channel
|
|||||||
std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
|
std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
|
||||||
std::unique_ptr<StatisticsProxy> statistics_proxy_;
|
std::unique_ptr<StatisticsProxy> statistics_proxy_;
|
||||||
std::unique_ptr<RtpReceiver> rtp_receiver_;
|
std::unique_ptr<RtpReceiver> rtp_receiver_;
|
||||||
|
TelephoneEventHandler* telephone_event_handler_;
|
||||||
std::unique_ptr<RtpRtcp> _rtpRtcpModule;
|
std::unique_ptr<RtpRtcp> _rtpRtcpModule;
|
||||||
std::unique_ptr<AudioCodingModule> audio_coding_;
|
std::unique_ptr<AudioCodingModule> audio_coding_;
|
||||||
acm2::CodecManager codec_manager_;
|
acm2::CodecManager codec_manager_;
|
||||||
|
|||||||
Reference in New Issue
Block a user