- Make RtpSenderAudio not inherit from DtmfQueue.
- Remove unused method DtmfQueue::ResetDTMF() BUG=webrtc:2795 Review-Url: https://codereview.webrtc.org/2365873002 Cr-Commit-Position: refs/heads/master@{#14376}
This commit is contained in:
parent
92ea601e90
commit
d3d230f788
@ -59,9 +59,4 @@ bool DTMFqueue::PendingDTMF() {
|
||||
rtc::CritScope lock(&dtmf_critsect_);
|
||||
return next_empty_index_ > 0;
|
||||
}
|
||||
|
||||
void DTMFqueue::ResetDTMF() {
|
||||
rtc::CritScope lock(&dtmf_critsect_);
|
||||
next_empty_index_ = 0;
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -19,12 +19,11 @@ namespace webrtc {
|
||||
class DTMFqueue {
|
||||
public:
|
||||
DTMFqueue();
|
||||
virtual ~DTMFqueue();
|
||||
~DTMFqueue();
|
||||
|
||||
int32_t AddDTMF(uint8_t dtmf_key, uint16_t len, uint8_t level);
|
||||
int8_t NextDTMF(uint8_t* dtmf_key, uint16_t* len, uint8_t* level);
|
||||
bool PendingDTMF();
|
||||
void ResetDTMF();
|
||||
|
||||
private:
|
||||
rtc::CriticalSection dtmf_critsect_;
|
||||
|
||||
@ -169,14 +169,14 @@ bool RTPSenderAudio::SendAudio(FrameType frame_type,
|
||||
}
|
||||
|
||||
// Check if we have pending DTMFs to send
|
||||
if (!dtmf_event_is_on_ && PendingDTMF()) {
|
||||
if (!dtmf_event_is_on_ && dtmf_queue_.PendingDTMF()) {
|
||||
int64_t delaySinceLastDTMF =
|
||||
clock_->TimeInMilliseconds() - dtmf_time_last_sent_;
|
||||
|
||||
if (delaySinceLastDTMF > 100) {
|
||||
// New tone to play
|
||||
dtmf_timestamp_ = rtp_timestamp;
|
||||
if (NextDTMF(&key, &dtmf_length_ms, &dtmf_level_) >= 0) {
|
||||
if (dtmf_queue_.NextDTMF(&key, &dtmf_length_ms, &dtmf_level_) >= 0) {
|
||||
dtmf_event_first_packet_sent_ = false;
|
||||
dtmf_key_ = key;
|
||||
dtmf_length_samples_ = (kDtmfFrequencyHz / 1000) * dtmf_length_ms;
|
||||
@ -310,7 +310,7 @@ int32_t RTPSenderAudio::SendTelephoneEvent(uint8_t key,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return AddDTMF(key, time_ms, level);
|
||||
return dtmf_queue_.AddDTMF(key, time_ms, level);
|
||||
}
|
||||
|
||||
bool RTPSenderAudio::SendTelephoneEventPacket(bool ended,
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_SENDER_AUDIO_H_
|
||||
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/onetimeevent.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h"
|
||||
@ -22,10 +23,10 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RTPSenderAudio : public DTMFqueue {
|
||||
class RTPSenderAudio {
|
||||
public:
|
||||
RTPSenderAudio(Clock* clock, RTPSender* rtp_sender);
|
||||
virtual ~RTPSenderAudio();
|
||||
~RTPSenderAudio();
|
||||
|
||||
int32_t RegisterAudioPayload(const char payloadName[RTP_PAYLOAD_NAME_SIZE],
|
||||
int8_t payload_type,
|
||||
@ -83,6 +84,7 @@ class RTPSenderAudio : public DTMFqueue {
|
||||
uint8_t dtmf_level_;
|
||||
int64_t dtmf_time_last_sent_;
|
||||
uint32_t dtmf_timestamp_last_sent_;
|
||||
DTMFqueue dtmf_queue_;
|
||||
|
||||
// VAD detection, used for marker bit.
|
||||
bool inband_vad_active_ GUARDED_BY(send_audio_critsect_);
|
||||
@ -96,6 +98,8 @@ class RTPSenderAudio : public DTMFqueue {
|
||||
// (https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/)
|
||||
uint8_t audio_level_dbov_ GUARDED_BY(send_audio_critsect_);
|
||||
OneTimeEvent first_packet_sent_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RTPSenderAudio);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user