Clean away use of RtpAudioFeedback interface from RTP/RTCP receiver code.

BUG=webrtc:4690

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

Cr-Commit-Position: refs/heads/master@{#12015}
This commit is contained in:
solenberg
2016-03-16 05:58:57 -07:00
committed by Commit bot
parent bf31d3c779
commit 69a81999ac
13 changed files with 14 additions and 64 deletions

View File

@ -45,7 +45,6 @@ class RtpReceiver {
// Creates an audio-enabled RTP receiver.
static RtpReceiver* CreateAudioReceiver(
Clock* clock,
RtpAudioFeedback* incoming_audio_feedback,
RtpData* incoming_payload_callback,
RtpFeedback* incoming_messages_callback,
RTPPayloadRegistry* rtp_payload_registry);

View File

@ -217,16 +217,6 @@ class RtpFeedback {
virtual void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) = 0;
};
class RtpAudioFeedback {
public:
virtual void OnPlayTelephoneEvent(const uint8_t event,
const uint16_t lengthMs,
const uint8_t volume) = 0;
protected:
virtual ~RtpAudioFeedback() {}
};
class RtcpIntraFrameObserver {
public:
virtual void OnReceivedIntraFrameRequest(uint32_t ssrc) = 0;
@ -357,16 +347,6 @@ class NullRtpData : public RtpData {
}
};
// Null object version of RtpAudioFeedback.
class NullRtpAudioFeedback : public RtpAudioFeedback {
public:
virtual ~NullRtpAudioFeedback() {}
void OnPlayTelephoneEvent(const uint8_t event,
const uint16_t lengthMs,
const uint8_t volume) override {}
};
// Statistics about packet loss for a single directional connection. All values
// are totals since the connection initiated.
struct RtpPacketLossStats {

View File

@ -20,13 +20,11 @@
namespace webrtc {
RTPReceiverStrategy* RTPReceiverStrategy::CreateAudioStrategy(
RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback) {
return new RTPReceiverAudio(data_callback, incoming_messages_callback);
RtpData* data_callback) {
return new RTPReceiverAudio(data_callback);
}
RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback)
RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
: RTPReceiverStrategy(data_callback),
TelephoneEventHandler(),
last_received_frequency_(8000),
@ -40,8 +38,7 @@ RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback,
g722_payload_type_(-1),
last_received_g722_(false),
num_energy_(0),
current_remote_energy_(),
cb_audio_feedback_(incoming_messages_callback) {
current_remote_energy_() {
last_payload_.Audio.channels = 1;
memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
}

View File

@ -28,8 +28,7 @@ class CriticalSectionWrapper;
class RTPReceiverAudio : public RTPReceiverStrategy,
public TelephoneEventHandler {
public:
RTPReceiverAudio(RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback);
explicit RTPReceiverAudio(RtpData* data_callback);
virtual ~RTPReceiverAudio() {}
// The following three methods implement the TelephoneEventHandler interface.
@ -119,8 +118,6 @@ class RTPReceiverAudio : public RTPReceiverStrategy,
uint8_t num_energy_;
uint8_t current_remote_energy_[kRtpCsrcSize];
RtpAudioFeedback* cb_audio_feedback_;
};
} // namespace webrtc

View File

@ -34,33 +34,26 @@ RtpReceiver* RtpReceiver::CreateVideoReceiver(
if (!incoming_messages_callback)
incoming_messages_callback = NullObjectRtpFeedback();
return new RtpReceiverImpl(
clock, NullObjectRtpAudioFeedback(), incoming_messages_callback,
rtp_payload_registry,
clock, incoming_messages_callback, rtp_payload_registry,
RTPReceiverStrategy::CreateVideoStrategy(incoming_payload_callback));
}
RtpReceiver* RtpReceiver::CreateAudioReceiver(
Clock* clock,
RtpAudioFeedback* incoming_audio_feedback,
RtpData* incoming_payload_callback,
RtpFeedback* incoming_messages_callback,
RTPPayloadRegistry* rtp_payload_registry) {
if (!incoming_audio_feedback)
incoming_audio_feedback = NullObjectRtpAudioFeedback();
if (!incoming_payload_callback)
incoming_payload_callback = NullObjectRtpData();
if (!incoming_messages_callback)
incoming_messages_callback = NullObjectRtpFeedback();
return new RtpReceiverImpl(
clock, incoming_audio_feedback, incoming_messages_callback,
rtp_payload_registry,
RTPReceiverStrategy::CreateAudioStrategy(incoming_payload_callback,
incoming_audio_feedback));
clock, incoming_messages_callback, rtp_payload_registry,
RTPReceiverStrategy::CreateAudioStrategy(incoming_payload_callback));
}
RtpReceiverImpl::RtpReceiverImpl(
Clock* clock,
RtpAudioFeedback* incoming_audio_messages_callback,
RtpFeedback* incoming_messages_callback,
RTPPayloadRegistry* rtp_payload_registry,
RTPReceiverStrategy* rtp_media_receiver)
@ -79,7 +72,6 @@ RtpReceiverImpl::RtpReceiverImpl(
last_received_frame_time_ms_(-1),
last_received_sequence_number_(0),
nack_method_(kNackOff) {
assert(incoming_audio_messages_callback);
assert(incoming_messages_callback);
memset(current_remote_csrc_, 0, sizeof(current_remote_csrc_));

View File

@ -26,7 +26,6 @@ class RtpReceiverImpl : public RtpReceiver {
// want callbacks to do nothing). This class takes ownership of the media
// receiver but nothing else.
RtpReceiverImpl(Clock* clock,
RtpAudioFeedback* incoming_audio_messages_callback,
RtpFeedback* incoming_messages_callback,
RTPPayloadRegistry* rtp_payload_registry,
RTPReceiverStrategy* rtp_media_receiver);

View File

@ -27,9 +27,7 @@ class TelephoneEventHandler;
class RTPReceiverStrategy {
public:
static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback);
static RTPReceiverStrategy* CreateAudioStrategy(
RtpData* data_callback,
RtpAudioFeedback* incoming_messages_callback);
static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback);
virtual ~RTPReceiverStrategy() {}

View File

@ -27,11 +27,6 @@ RtpFeedback* NullObjectRtpFeedback() {
return &null_rtp_feedback;
}
RtpAudioFeedback* NullObjectRtpAudioFeedback() {
static NullRtpAudioFeedback null_rtp_audio_feedback;
return &null_rtp_audio_feedback;
}
ReceiveStatistics* NullObjectReceiveStatistics() {
static NullReceiveStatistics null_receive_statistics;
return &null_receive_statistics;

View File

@ -26,7 +26,6 @@ const uint8_t kRtpMarkerBitMask = 0x80;
RtpData* NullObjectRtpData();
RtpFeedback* NullObjectRtpFeedback();
RtpAudioFeedback* NullObjectRtpAudioFeedback();
ReceiveStatistics* NullObjectReceiveStatistics();
namespace RtpUtility {

View File

@ -97,7 +97,7 @@ class RtpRtcpAPITest : public ::testing::Test {
rtp_payload_registry_.reset(new RTPPayloadRegistry(
RTPPayloadStrategy::CreateStrategy(true)));
rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver(
&fake_clock_, NULL, NULL, NULL, rtp_payload_registry_.get()));
&fake_clock_, NULL, NULL, rtp_payload_registry_.get()));
}
rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;

View File

@ -86,7 +86,6 @@ class RtpRtcpAudioTest : public ::testing::Test {
~RtpRtcpAudioTest() {}
void SetUp() override {
audioFeedback = new NullRtpAudioFeedback();
data_receiver1 = new VerifyingAudioReceiver();
data_receiver2 = new VerifyingAudioReceiver();
rtp_callback = new RTPCallback();
@ -109,16 +108,14 @@ class RtpRtcpAudioTest : public ::testing::Test {
module1 = RtpRtcp::CreateRtpRtcp(configuration);
rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver(
&fake_clock, audioFeedback, data_receiver1, NULL,
rtp_payload_registry1_.get()));
&fake_clock, data_receiver1, NULL, rtp_payload_registry1_.get()));
configuration.receive_statistics = receive_statistics2_.get();
configuration.outgoing_transport = transport2;
module2 = RtpRtcp::CreateRtpRtcp(configuration);
rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver(
&fake_clock, audioFeedback, data_receiver2, NULL,
rtp_payload_registry2_.get()));
&fake_clock, data_receiver2, NULL, rtp_payload_registry2_.get()));
transport1->SetSendModule(module2, rtp_payload_registry2_.get(),
rtp_receiver2_.get(), receive_statistics2_.get());
@ -131,7 +128,6 @@ class RtpRtcpAudioTest : public ::testing::Test {
delete module2;
delete transport1;
delete transport2;
delete audioFeedback;
delete data_receiver1;
delete data_receiver2;
delete rtp_callback;
@ -149,7 +145,6 @@ class RtpRtcpAudioTest : public ::testing::Test {
VerifyingAudioReceiver* data_receiver2;
LoopBackTransport* transport1;
LoopBackTransport* transport2;
NullRtpAudioFeedback* audioFeedback;
RTPCallback* rtp_callback;
uint32_t test_ssrc;
uint32_t test_timestamp;

View File

@ -101,7 +101,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
rtp_feedback1_.reset(new TestRtpFeedback(module1));
rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver(
&fake_clock, NULL, receiver, rtp_feedback1_.get(),
&fake_clock, receiver, rtp_feedback1_.get(),
rtp_payload_registry1_.get()));
configuration.receive_statistics = receive_statistics2_.get();
@ -113,7 +113,7 @@ class RtpRtcpRtcpTest : public ::testing::Test {
rtp_feedback2_.reset(new TestRtpFeedback(module2));
rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver(
&fake_clock, NULL, receiver, rtp_feedback2_.get(),
&fake_clock, receiver, rtp_feedback2_.get(),
rtp_payload_registry2_.get()));
transport1->SetSendModule(module2, rtp_payload_registry2_.get(),

View File

@ -722,7 +722,6 @@ Channel::Channel(int32_t channelId,
ReceiveStatistics::Create(Clock::GetRealTimeClock())),
rtp_receiver_(
RtpReceiver::CreateAudioReceiver(Clock::GetRealTimeClock(),
nullptr,
this,
this,
rtp_payload_registry_.get())),