Delete obsolete method RtpFeedback::OnInitializeDecoder.

Bug: None
Change-Id: I55e01e5ff1c54c76c43b378414a31fc43c9aa444
Reviewed-on: https://webrtc-review.googlesource.com/62142
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22561}
This commit is contained in:
Niels Möller
2018-03-22 12:20:38 +01:00
committed by Commit Bot
parent 2fee4d61ba
commit 9cfb18c5b3
12 changed files with 4 additions and 123 deletions

View File

@ -394,19 +394,6 @@ void Channel::OnIncomingCSRCChanged(uint32_t CSRC, bool added) {
// TODO(saza): remove.
}
int32_t Channel::OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) {
if (!audio_coding_->RegisterReceiveCodec(payload_type, audio_format)) {
RTC_DLOG(LS_WARNING) << "Channel::OnInitializeDecoder() invalid codec (pt="
<< payload_type << ", " << audio_format
<< ") received -1";
return -1;
}
return 0;
}
int32_t Channel::OnReceivedPayloadData(const uint8_t* payloadData,
size_t payloadSize,
const WebRtcRTPHeader* rtpHeader) {

View File

@ -247,9 +247,6 @@ class Channel
const WebRtcRTPHeader* rtpHeader) override;
// From RtpFeedback in the RTP/RTCP module
int32_t OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) override;
void OnIncomingSSRCChanged(uint32_t ssrc) override;
void OnIncomingCSRCChanged(uint32_t CSRC, bool added) override;

View File

@ -256,14 +256,6 @@ class RtpFeedback {
public:
virtual ~RtpFeedback() {}
// Receiving payload change or SSRC change. (return success!)
/*
* channels - number of channels in codec (1 = mono, 2 = stereo)
*/
virtual int32_t OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) = 0;
virtual void OnIncomingSSRCChanged(uint32_t ssrc) = 0;
virtual void OnIncomingCSRCChanged(uint32_t csrc, bool added) = 0;
@ -450,21 +442,10 @@ class NullRtpFeedback : public RtpFeedback {
public:
~NullRtpFeedback() override {}
int32_t OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) override;
void OnIncomingSSRCChanged(uint32_t ssrc) override {}
void OnIncomingCSRCChanged(uint32_t csrc, bool added) override {}
};
inline int32_t NullRtpFeedback::OnInitializeDecoder(
int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) {
return 0;
}
// Statistics about packet loss for a single directional connection. All values
// are totals since the connection initiated.
struct RtpPacketLossStats {

View File

@ -191,20 +191,6 @@ int RTPReceiverAudio::Energy(uint8_t array_of_energy[kRtpCsrcSize]) const {
return num_energy_;
}
int32_t RTPReceiverAudio::InvokeOnInitializeDecoder(
RtpFeedback* callback,
int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const PayloadUnion& specific_payload) const {
const auto& ap = specific_payload.audio_payload();
if (callback->OnInitializeDecoder(payload_type, ap.format, ap.rate) == -1) {
RTC_LOG(LS_ERROR) << "Failed to create decoder for payload type: "
<< payload_name << "/" << static_cast<int>(payload_type);
return -1;
}
return 0;
}
// We are not allowed to have any critsects when calling data_callback.
int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
WebRtcRTPHeader* rtp_header,

View File

@ -57,12 +57,6 @@ class RTPReceiverAudio : public RTPReceiverStrategy,
int32_t OnNewPayloadTypeCreated(int payload_type,
const SdpAudioFormat& audio_format) override;
int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const PayloadUnion& specific_payload) const override;
// We need to look out for special payload types here and sometimes reset
// statistics. In addition we sometimes need to tweak the frequency.
void CheckPayloadChanged(int8_t payload_type,

View File

@ -272,6 +272,7 @@ bool RtpReceiverImpl::GetLatestTimestamps(uint32_t* timestamp,
// Implementation note: must not hold critsect when called.
void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
bool new_ssrc = false;
// TODO(nisse): This is unused, delete any corresponding dead code.
rtc::Optional<AudioPayload> reinitialize_audio_payload;
{
@ -313,16 +314,6 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
// We need to do this outside critical section.
cb_rtp_feedback_->OnIncomingSSRCChanged(rtp_header.ssrc);
}
if (reinitialize_audio_payload) {
if (-1 == cb_rtp_feedback_->OnInitializeDecoder(
rtp_header.payloadType, reinitialize_audio_payload->format,
reinitialize_audio_payload->rate)) {
// New stream, same codec.
RTC_LOG(LS_ERROR) << "Failed to create decoder for payload type: "
<< static_cast<int>(rtp_header.payloadType);
}
}
}
// Implementation note: must not hold critsect when called.
@ -335,9 +326,10 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
const int8_t first_payload_byte,
PayloadUnion* specific_payload) {
// TODO(nisse): re_initialize_decoder is unused, and most or all of
// this code can likely be deleted.
bool re_initialize_decoder = false;
char payload_name[RTP_PAYLOAD_NAME_SIZE];
int8_t payload_type = rtp_header.payloadType;
{
@ -364,9 +356,6 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
// Not a registered payload type.
return -1;
}
payload_name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload_name, payload->name, RTP_PAYLOAD_NAME_SIZE - 1);
rtp_payload_registry_->set_last_received_payload_type(payload_type);
re_initialize_decoder = true;
@ -387,13 +376,6 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
}
} // End critsect.
if (re_initialize_decoder) {
if (-1 ==
rtp_media_receiver_->InvokeOnInitializeDecoder(
cb_rtp_feedback_, payload_type, payload_name, *specific_payload)) {
return -1; // Wrong payload type.
}
}
return 0;
}

View File

@ -59,13 +59,6 @@ class RTPReceiverStrategy {
int payload_type,
const SdpAudioFormat& audio_format) = 0;
// Invokes the OnInitializeDecoder callback in a media-specific way.
virtual int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const PayloadUnion& specific_payload) const = 0;
// Checks if the payload type has changed, and returns whether we should
// reset statistics and/or discard this packet.
virtual void CheckPayloadChanged(int8_t payload_type,

View File

@ -127,14 +127,4 @@ RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive(
return kRtpDead;
}
int32_t RTPReceiverVideo::InvokeOnInitializeDecoder(
RtpFeedback* callback,
int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const PayloadUnion& specific_payload) const {
// TODO(pbos): Remove as soon as audio can handle a changing payload type
// without this callback.
return 0;
}
} // namespace webrtc

View File

@ -40,12 +40,6 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
int32_t OnNewPayloadTypeCreated(int payload_type,
const SdpAudioFormat& audio_format) override;
int32_t InvokeOnInitializeDecoder(
RtpFeedback* callback,
int8_t payload_type,
const char payload_name[RTP_PAYLOAD_NAME_SIZE],
const PayloadUnion& specific_payload) const override;
void SetPacketOverHead(uint16_t packet_over_head);
private:

View File

@ -69,16 +69,6 @@ class VerifyingAudioReceiver : public RtpData {
}
};
class RTPCallback : public NullRtpFeedback {
public:
int32_t OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) override {
EXPECT_EQ(0u, rate) << "The rate should be zero";
return 0;
}
};
} // namespace
class RtpRtcpAudioTest : public ::testing::Test {
@ -137,7 +127,7 @@ class RtpRtcpAudioTest : public ::testing::Test {
VerifyingAudioReceiver data_receiver1;
VerifyingAudioReceiver data_receiver2;
RTPCallback rtp_callback;
NullRtpFeedback rtp_callback;
std::unique_ptr<ReceiveStatistics> receive_statistics1_;
std::unique_ptr<ReceiveStatistics> receive_statistics2_;
std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry1_;

View File

@ -261,16 +261,6 @@ void RtpVideoStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet,
ReceivePacket(rtp_packet, rtp_packet_length, header);
}
// TODO(pbos): Remove as soon as audio can handle a changing payload type
// without this callback.
int32_t RtpVideoStreamReceiver::OnInitializeDecoder(
const int payload_type,
const SdpAudioFormat& audio_format,
const uint32_t rate) {
RTC_NOTREACHED();
return 0;
}
// This method handles both regular RTP packets and packets recovered
// via FlexFEC.
void RtpVideoStreamReceiver::OnRtpPacket(const RtpPacketReceived& packet) {

View File

@ -109,9 +109,6 @@ class RtpVideoStreamReceiver : public RtpData,
void OnRecoveredPacket(const uint8_t* packet, size_t packet_length) override;
// Implements RtpFeedback.
int32_t OnInitializeDecoder(int payload_type,
const SdpAudioFormat& audio_format,
uint32_t rate) override;
void OnIncomingSSRCChanged(uint32_t ssrc) override {}
void OnIncomingCSRCChanged(uint32_t CSRC, bool added) override {}