Delete RTPReceiverStrategy::OnNewPayloadTypeCreated and related code.

Bug: webrtc:7135
Change-Id: Ic20d98cbfb8154f5abbc2501cbcccb950148e732
Reviewed-on: https://webrtc-review.googlesource.com/92396
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24219}
This commit is contained in:
Niels Möller
2018-08-06 17:12:27 +02:00
committed by Commit Bot
parent c1c8b8e836
commit 3ed46bd83b
7 changed files with 1 additions and 111 deletions

View File

@ -89,8 +89,6 @@ class PayloadUnion {
absl::variant<AudioPayload, VideoPayload> payload_;
};
enum RTPAliveType { kRtpDead = 0, kRtpNoRtp = 1, kRtpAlive = 2 };
enum ProtectionType { kUnprotectedPacket, kProtectedPacket };
enum StorageType { kDontRetransmit, kAllowRetransmission };

View File

@ -25,28 +25,10 @@ RTPReceiverStrategy* RTPReceiverStrategy::CreateAudioStrategy(
}
RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
: RTPReceiverStrategy(data_callback),
telephone_event_payload_type_(-1),
cng_nb_payload_type_(-1),
cng_wb_payload_type_(-1),
cng_swb_payload_type_(-1),
cng_fb_payload_type_(-1) {}
: RTPReceiverStrategy(data_callback) {}
RTPReceiverAudio::~RTPReceiverAudio() = default;
bool RTPReceiverAudio::TelephoneEventPayloadType(int8_t payload_type) const {
rtc::CritScope lock(&crit_sect_);
return telephone_event_payload_type_ == payload_type;
}
bool RTPReceiverAudio::CNGPayloadType(int8_t payload_type) {
rtc::CritScope lock(&crit_sect_);
return payload_type == cng_nb_payload_type_ ||
payload_type == cng_wb_payload_type_ ||
payload_type == cng_swb_payload_type_ ||
payload_type == cng_fb_payload_type_;
}
// - Sample based or frame based codecs based on RFC 3551
// -
// - NOTE! There is one error in the RFC, stating G.722 uses 8 bits/samples.
@ -79,32 +61,6 @@ bool RTPReceiverAudio::CNGPayloadType(int8_t payload_type) {
// - MPA frame N/A var. var.
// -
// - G7221 frame N/A
int32_t RTPReceiverAudio::OnNewPayloadTypeCreated(
int payload_type,
const SdpAudioFormat& audio_format) {
rtc::CritScope lock(&crit_sect_);
if (RtpUtility::StringCompare(audio_format.name.c_str(), "telephone-event",
15)) {
telephone_event_payload_type_ = payload_type;
}
if (RtpUtility::StringCompare(audio_format.name.c_str(), "cn", 2)) {
// We support comfort noise at four different frequencies.
if (audio_format.clockrate_hz == 8000) {
cng_nb_payload_type_ = payload_type;
} else if (audio_format.clockrate_hz == 16000) {
cng_wb_payload_type_ = payload_type;
} else if (audio_format.clockrate_hz == 32000) {
cng_swb_payload_type_ = payload_type;
} else if (audio_format.clockrate_hz == 48000) {
cng_fb_payload_type_ = payload_type;
} else {
assert(false);
return -1;
}
}
return 0;
}
int32_t RTPReceiverAudio::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
const PayloadUnion& specific_payload,
@ -119,17 +75,6 @@ int32_t RTPReceiverAudio::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
specific_payload.audio_payload());
}
RTPAliveType RTPReceiverAudio::ProcessDeadOrAlive(
uint16_t last_payload_length) const {
// Our CNG is 9 bytes; if it's a likely CNG the receiver needs to check
// kRtpNoRtp against NetEq speech_type kOutputPLCtoCNG.
if (last_payload_length < 10) { // our CNG is 9 bytes
return kRtpNoRtp;
} else {
return kRtpDead;
}
}
// We are not allowed to have any critsects when calling data_callback.
int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
WebRtcRTPHeader* rtp_header,

View File

@ -27,36 +27,18 @@ class RTPReceiverAudio : public RTPReceiverStrategy {
explicit RTPReceiverAudio(RtpData* data_callback);
~RTPReceiverAudio() override;
// Returns true if CNG is configured with |payload_type|.
bool CNGPayloadType(const int8_t payload_type);
int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header,
const PayloadUnion& specific_payload,
const uint8_t* packet,
size_t payload_length,
int64_t timestamp_ms) override;
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;
int32_t OnNewPayloadTypeCreated(int payload_type,
const SdpAudioFormat& audio_format) override;
private:
int32_t ParseAudioCodecSpecific(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
size_t payload_length,
const AudioPayload& audio_specific);
// Is TelephoneEvent configured with |payload_type|.
bool TelephoneEventPayloadType(const int8_t payload_type) const;
int8_t telephone_event_payload_type_;
int8_t cng_nb_payload_type_;
int8_t cng_wb_payload_type_;
int8_t cng_swb_payload_type_;
int8_t cng_fb_payload_type_;
ThreadUnsafeOneTimeEvent first_packet_received_;
};
} // namespace webrtc

View File

@ -105,14 +105,6 @@ int32_t RtpReceiverImpl::RegisterReceivePayload(
bool created_new_payload = false;
int32_t result = rtp_payload_registry_->RegisterReceivePayload(
payload_type, audio_format, &created_new_payload);
if (created_new_payload) {
if (rtp_media_receiver_->OnNewPayloadTypeCreated(payload_type,
audio_format) != 0) {
RTC_LOG(LS_ERROR) << "Failed to register payload: " << audio_format.name
<< "/" << payload_type;
return -1;
}
}
return result;
}

View File

@ -40,16 +40,6 @@ class RTPReceiverStrategy {
size_t payload_length,
int64_t timestamp_ms) = 0;
// Computes the current dead-or-alive state.
virtual RTPAliveType ProcessDeadOrAlive(
uint16_t last_payload_length) const = 0;
// Notifies the strategy that we have created a new non-RED audio payload type
// in the payload registry.
virtual int32_t OnNewPayloadTypeCreated(
int payload_type,
const SdpAudioFormat& audio_format) = 0;
protected:
// The data callback is where we should send received payload data.
// See ParseRtpPacket. This class does not claim ownership of the callback.

View File

@ -36,13 +36,6 @@ RTPReceiverVideo::RTPReceiverVideo(RtpData* data_callback)
RTPReceiverVideo::~RTPReceiverVideo() {}
int32_t RTPReceiverVideo::OnNewPayloadTypeCreated(
int payload_type,
const SdpAudioFormat& audio_format) {
RTC_NOTREACHED();
return 0;
}
int32_t RTPReceiverVideo::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
const PayloadUnion& specific_payload,
const uint8_t* payload,
@ -108,9 +101,4 @@ int32_t RTPReceiverVideo::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
: -1;
}
RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive(
uint16_t last_payload_length) const {
return kRtpDead;
}
} // namespace webrtc

View File

@ -30,11 +30,6 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
size_t packet_length,
int64_t timestamp) override;
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;
int32_t OnNewPayloadTypeCreated(int payload_type,
const SdpAudioFormat& audio_format) override;
void SetPacketOverHead(uint16_t packet_over_head);
private: