RtpRtcp: Remove the SetSendREDPayloadType and SendREDPayloadType methods
The last in-tree call site recently disappeared, so they were unused. BUG=webrtc:5922 Review-Url: https://codereview.webrtc.org/2066473002 Cr-Commit-Position: refs/heads/master@{#13751}
This commit is contained in:
@ -442,14 +442,6 @@ class RtpRtcp : public Module {
|
|||||||
uint16_t time_ms,
|
uint16_t time_ms,
|
||||||
uint8_t level) = 0;
|
uint8_t level) = 0;
|
||||||
|
|
||||||
// Sets payload type for Redundant Audio Data RFC 2198.
|
|
||||||
// Returns -1 on failure else 0.
|
|
||||||
virtual int32_t SetSendREDPayloadType(int8_t payload_type) = 0;
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198.
|
|
||||||
// Returns -1 on failure else 0.
|
|
||||||
virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0;
|
|
||||||
|
|
||||||
// Store the audio level in dBov for header-extension-for-audio-level-
|
// Store the audio level in dBov for header-extension-for-audio-level-
|
||||||
// indication.
|
// indication.
|
||||||
// This API shall be called before transmision of an RTP packet to ensure
|
// This API shall be called before transmision of an RTP packet to ensure
|
||||||
|
|||||||
@ -786,17 +786,6 @@ int32_t ModuleRtpRtcpImpl::SetAudioLevel(
|
|||||||
return rtp_sender_.SetAudioLevel(level_d_bov);
|
return rtp_sender_.SetAudioLevel(level_d_bov);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetSendREDPayloadType(
|
|
||||||
const int8_t payload_type) {
|
|
||||||
return rtp_sender_.SetRED(payload_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(int8_t* payload_type) const {
|
|
||||||
return rtp_sender_.RED(payload_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
|
int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
|
||||||
const KeyFrameRequestMethod method) {
|
const KeyFrameRequestMethod method) {
|
||||||
key_frame_req_method_ = method;
|
key_frame_req_method_ = method;
|
||||||
|
|||||||
@ -266,12 +266,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
|
|||||||
uint16_t time_ms,
|
uint16_t time_ms,
|
||||||
uint8_t level) override;
|
uint8_t level) override;
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t SetSendREDPayloadType(int8_t payload_type) override;
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t SendREDPayloadType(int8_t* payload_type) const override;
|
|
||||||
|
|
||||||
// Store the audio level in d_bov for header-extension-for-audio-level-
|
// Store the audio level in d_bov for header-extension-for-audio-level-
|
||||||
// indication.
|
// indication.
|
||||||
int32_t SetAudioLevel(uint8_t level_d_bov) override;
|
int32_t SetAudioLevel(uint8_t level_d_bov) override;
|
||||||
|
|||||||
@ -392,16 +392,6 @@ int32_t RTPSender::CheckPayloadType(int8_t payload_type,
|
|||||||
LOG(LS_ERROR) << "Invalid payload_type " << payload_type;
|
LOG(LS_ERROR) << "Invalid payload_type " << payload_type;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (audio_configured_) {
|
|
||||||
int8_t red_pl_type = -1;
|
|
||||||
if (audio_->RED(&red_pl_type) == 0) {
|
|
||||||
// We have configured RED.
|
|
||||||
if (red_pl_type == payload_type) {
|
|
||||||
// And it's a match...
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (payload_type_ == payload_type) {
|
if (payload_type_ == payload_type) {
|
||||||
if (!audio_configured_) {
|
if (!audio_configured_) {
|
||||||
*video_type = video_->VideoCodecType();
|
*video_type = video_->VideoCodecType();
|
||||||
@ -1624,20 +1614,6 @@ int32_t RTPSender::SetAudioLevel(uint8_t level_d_bov) {
|
|||||||
return audio_->SetAudioLevel(level_d_bov);
|
return audio_->SetAudioLevel(level_d_bov);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t RTPSender::SetRED(int8_t payload_type) {
|
|
||||||
if (!audio_configured_) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return audio_->SetRED(payload_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t RTPSender::RED(int8_t *payload_type) const {
|
|
||||||
if (!audio_configured_) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return audio_->RED(payload_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
RtpVideoCodecTypes RTPSender::VideoCodecType() const {
|
RtpVideoCodecTypes RTPSender::VideoCodecType() const {
|
||||||
assert(!audio_configured_ && "Sender is an audio stream!");
|
assert(!audio_configured_ && "Sender is an audio stream!");
|
||||||
return video_->VideoCodecType();
|
return video_->VideoCodecType();
|
||||||
|
|||||||
@ -250,12 +250,6 @@ class RTPSender {
|
|||||||
// header-extension-for-audio-level-indication.
|
// header-extension-for-audio-level-indication.
|
||||||
int32_t SetAudioLevel(uint8_t level_d_bov);
|
int32_t SetAudioLevel(uint8_t level_d_bov);
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t SetRED(int8_t payload_type);
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198.
|
|
||||||
int32_t RED(int8_t *payload_type) const;
|
|
||||||
|
|
||||||
RtpVideoCodecTypes VideoCodecType() const;
|
RtpVideoCodecTypes VideoCodecType() const;
|
||||||
|
|
||||||
uint32_t MaxConfiguredBitrateVideo() const;
|
uint32_t MaxConfiguredBitrateVideo() const;
|
||||||
|
|||||||
@ -35,7 +35,6 @@ RTPSenderAudio::RTPSenderAudio(Clock* clock, RTPSender* rtp_sender)
|
|||||||
dtmf_level_(0),
|
dtmf_level_(0),
|
||||||
dtmf_time_last_sent_(0),
|
dtmf_time_last_sent_(0),
|
||||||
dtmf_timestamp_last_sent_(0),
|
dtmf_timestamp_last_sent_(0),
|
||||||
red_payload_type_(-1),
|
|
||||||
inband_vad_active_(false),
|
inband_vad_active_(false),
|
||||||
cngnb_payload_type_(-1),
|
cngnb_payload_type_(-1),
|
||||||
cngwb_payload_type_(-1),
|
cngwb_payload_type_(-1),
|
||||||
@ -156,13 +155,11 @@ bool RTPSenderAudio::SendAudio(FrameType frame_type,
|
|||||||
size_t max_payload_length = rtp_sender_->MaxPayloadLength();
|
size_t max_payload_length = rtp_sender_->MaxPayloadLength();
|
||||||
uint16_t dtmf_length_ms = 0;
|
uint16_t dtmf_length_ms = 0;
|
||||||
uint8_t key = 0;
|
uint8_t key = 0;
|
||||||
int red_payload_type;
|
|
||||||
uint8_t audio_level_dbov;
|
uint8_t audio_level_dbov;
|
||||||
int8_t dtmf_payload_type;
|
int8_t dtmf_payload_type;
|
||||||
uint16_t packet_size_samples;
|
uint16_t packet_size_samples;
|
||||||
{
|
{
|
||||||
rtc::CritScope cs(&send_audio_critsect_);
|
rtc::CritScope cs(&send_audio_critsect_);
|
||||||
red_payload_type = red_payload_type_;
|
|
||||||
audio_level_dbov = audio_level_dbov_;
|
audio_level_dbov = audio_level_dbov_;
|
||||||
dtmf_payload_type = dtmf_payload_type_;
|
dtmf_payload_type = dtmf_payload_type_;
|
||||||
packet_size_samples = packet_size_samples_;
|
packet_size_samples = packet_size_samples_;
|
||||||
@ -251,23 +248,10 @@ bool RTPSenderAudio::SendAudio(FrameType frame_type,
|
|||||||
bool marker_bit = MarkerBit(frame_type, payload_type);
|
bool marker_bit = MarkerBit(frame_type, payload_type);
|
||||||
|
|
||||||
int32_t rtpHeaderLength = 0;
|
int32_t rtpHeaderLength = 0;
|
||||||
uint16_t timestampOffset = 0;
|
|
||||||
|
|
||||||
if (red_payload_type >= 0 && fragmentation && !marker_bit &&
|
|
||||||
fragmentation->fragmentationVectorSize > 1) {
|
|
||||||
// have we configured RED? use its payload type
|
|
||||||
// we need to get the current timestamp to calc the diff
|
|
||||||
uint32_t old_timestamp = rtp_sender_->Timestamp();
|
|
||||||
rtpHeaderLength = rtp_sender_->BuildRtpHeader(data_buffer, red_payload_type,
|
|
||||||
marker_bit, capture_timestamp,
|
|
||||||
clock_->TimeInMilliseconds());
|
|
||||||
|
|
||||||
timestampOffset = uint16_t(rtp_sender_->Timestamp() - old_timestamp);
|
|
||||||
} else {
|
|
||||||
rtpHeaderLength = rtp_sender_->BuildRtpHeader(data_buffer, payload_type,
|
rtpHeaderLength = rtp_sender_->BuildRtpHeader(data_buffer, payload_type,
|
||||||
marker_bit, capture_timestamp,
|
marker_bit, capture_timestamp,
|
||||||
clock_->TimeInMilliseconds());
|
clock_->TimeInMilliseconds());
|
||||||
}
|
|
||||||
if (rtpHeaderLength <= 0) {
|
if (rtpHeaderLength <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -275,52 +259,6 @@ bool RTPSenderAudio::SendAudio(FrameType frame_type,
|
|||||||
// Too large payload buffer.
|
// Too large payload buffer.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (red_payload_type >= 0 && // Have we configured RED?
|
|
||||||
fragmentation && fragmentation->fragmentationVectorSize > 1 &&
|
|
||||||
!marker_bit) {
|
|
||||||
if (timestampOffset <= 0x3fff) {
|
|
||||||
if (fragmentation->fragmentationVectorSize != 2) {
|
|
||||||
// we only support 2 codecs when using RED
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// only 0x80 if we have multiple blocks
|
|
||||||
data_buffer[rtpHeaderLength++] =
|
|
||||||
0x80 + fragmentation->fragmentationPlType[1];
|
|
||||||
size_t blockLength = fragmentation->fragmentationLength[1];
|
|
||||||
|
|
||||||
// sanity blockLength
|
|
||||||
if (blockLength > 0x3ff) { // block length 10 bits 1023 bytes
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
uint32_t REDheader = (timestampOffset << 10) + blockLength;
|
|
||||||
ByteWriter<uint32_t>::WriteBigEndian(data_buffer + rtpHeaderLength,
|
|
||||||
REDheader);
|
|
||||||
rtpHeaderLength += 3;
|
|
||||||
|
|
||||||
data_buffer[rtpHeaderLength++] = fragmentation->fragmentationPlType[0];
|
|
||||||
// copy the RED data
|
|
||||||
memcpy(data_buffer + rtpHeaderLength,
|
|
||||||
payload_data + fragmentation->fragmentationOffset[1],
|
|
||||||
fragmentation->fragmentationLength[1]);
|
|
||||||
|
|
||||||
// copy the normal data
|
|
||||||
memcpy(
|
|
||||||
data_buffer + rtpHeaderLength + fragmentation->fragmentationLength[1],
|
|
||||||
payload_data + fragmentation->fragmentationOffset[0],
|
|
||||||
fragmentation->fragmentationLength[0]);
|
|
||||||
|
|
||||||
payload_size = fragmentation->fragmentationLength[0] +
|
|
||||||
fragmentation->fragmentationLength[1];
|
|
||||||
} else {
|
|
||||||
// silence for too long send only new data
|
|
||||||
data_buffer[rtpHeaderLength++] = fragmentation->fragmentationPlType[0];
|
|
||||||
memcpy(data_buffer + rtpHeaderLength,
|
|
||||||
payload_data + fragmentation->fragmentationOffset[0],
|
|
||||||
fragmentation->fragmentationLength[0]);
|
|
||||||
|
|
||||||
payload_size = fragmentation->fragmentationLength[0];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (fragmentation && fragmentation->fragmentationVectorSize > 0) {
|
if (fragmentation && fragmentation->fragmentationVectorSize > 0) {
|
||||||
// use the fragment info if we have one
|
// use the fragment info if we have one
|
||||||
data_buffer[rtpHeaderLength++] = fragmentation->fragmentationPlType[0];
|
data_buffer[rtpHeaderLength++] = fragmentation->fragmentationPlType[0];
|
||||||
@ -332,7 +270,6 @@ bool RTPSenderAudio::SendAudio(FrameType frame_type,
|
|||||||
} else {
|
} else {
|
||||||
memcpy(data_buffer + rtpHeaderLength, payload_data, payload_size);
|
memcpy(data_buffer + rtpHeaderLength, payload_data, payload_size);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
rtc::CritScope cs(&send_audio_critsect_);
|
rtc::CritScope cs(&send_audio_critsect_);
|
||||||
@ -368,27 +305,6 @@ int32_t RTPSenderAudio::SetAudioLevel(uint8_t level_dbov) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198
|
|
||||||
int32_t RTPSenderAudio::SetRED(int8_t payload_type) {
|
|
||||||
if (payload_type < -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
rtc::CritScope cs(&send_audio_critsect_);
|
|
||||||
red_payload_type_ = payload_type;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198
|
|
||||||
int32_t RTPSenderAudio::RED(int8_t* payload_type) const {
|
|
||||||
rtc::CritScope cs(&send_audio_critsect_);
|
|
||||||
if (red_payload_type_ == -1) {
|
|
||||||
// not configured
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*payload_type = red_payload_type_;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a TelephoneEvent tone using RFC 2833 (4733)
|
// Send a TelephoneEvent tone using RFC 2833 (4733)
|
||||||
int32_t RTPSenderAudio::SendTelephoneEvent(uint8_t key,
|
int32_t RTPSenderAudio::SendTelephoneEvent(uint8_t key,
|
||||||
uint16_t time_ms,
|
uint16_t time_ms,
|
||||||
|
|||||||
@ -55,12 +55,6 @@ class RTPSenderAudio : public DTMFqueue {
|
|||||||
|
|
||||||
int AudioFrequency() const;
|
int AudioFrequency() const;
|
||||||
|
|
||||||
// Set payload type for Redundant Audio Data RFC 2198
|
|
||||||
int32_t SetRED(int8_t payload_type);
|
|
||||||
|
|
||||||
// Get payload type for Redundant Audio Data RFC 2198
|
|
||||||
int32_t RED(int8_t* payload_type) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool SendTelephoneEventPacket(
|
bool SendTelephoneEventPacket(
|
||||||
bool ended,
|
bool ended,
|
||||||
@ -90,8 +84,6 @@ class RTPSenderAudio : public DTMFqueue {
|
|||||||
int64_t dtmf_time_last_sent_;
|
int64_t dtmf_time_last_sent_;
|
||||||
uint32_t dtmf_timestamp_last_sent_;
|
uint32_t dtmf_timestamp_last_sent_;
|
||||||
|
|
||||||
int8_t red_payload_type_ GUARDED_BY(send_audio_critsect_);
|
|
||||||
|
|
||||||
// VAD detection, used for marker bit.
|
// VAD detection, used for marker bit.
|
||||||
bool inband_vad_active_ GUARDED_BY(send_audio_critsect_);
|
bool inband_vad_active_ GUARDED_BY(send_audio_critsect_);
|
||||||
int8_t cngnb_payload_type_ GUARDED_BY(send_audio_critsect_);
|
int8_t cngnb_payload_type_ GUARDED_BY(send_audio_critsect_);
|
||||||
|
|||||||
@ -208,79 +208,6 @@ TEST_F(RtpRtcpAudioTest, Basic) {
|
|||||||
EXPECT_EQ(test_timestamp, timestamp);
|
EXPECT_EQ(test_timestamp, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(RtpRtcpAudioTest, RED) {
|
|
||||||
CodecInst voice_codec;
|
|
||||||
memset(&voice_codec, 0, sizeof(voice_codec));
|
|
||||||
voice_codec.pltype = 96;
|
|
||||||
voice_codec.plfreq = 8000;
|
|
||||||
memcpy(voice_codec.plname, "PCMU", 5);
|
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
|
|
||||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
|
|
||||||
voice_codec.plname,
|
|
||||||
voice_codec.pltype,
|
|
||||||
voice_codec.plfreq,
|
|
||||||
voice_codec.channels,
|
|
||||||
(voice_codec.rate < 0) ? 0 : voice_codec.rate));
|
|
||||||
EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec));
|
|
||||||
voice_codec.rate = test_rate;
|
|
||||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
|
|
||||||
voice_codec.plname,
|
|
||||||
voice_codec.pltype,
|
|
||||||
voice_codec.plfreq,
|
|
||||||
voice_codec.channels,
|
|
||||||
(voice_codec.rate < 0) ? 0 : voice_codec.rate));
|
|
||||||
|
|
||||||
module1->SetSSRC(test_ssrc);
|
|
||||||
module1->SetStartTimestamp(test_timestamp);
|
|
||||||
EXPECT_EQ(0, module1->SetSendingStatus(true));
|
|
||||||
|
|
||||||
voice_codec.pltype = 127;
|
|
||||||
voice_codec.plfreq = 8000;
|
|
||||||
memcpy(voice_codec.plname, "RED", 4);
|
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->SetSendREDPayloadType(voice_codec.pltype));
|
|
||||||
int8_t red = 0;
|
|
||||||
EXPECT_EQ(0, module1->SendREDPayloadType(&red));
|
|
||||||
EXPECT_EQ(voice_codec.pltype, red);
|
|
||||||
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
|
|
||||||
voice_codec.plname,
|
|
||||||
voice_codec.pltype,
|
|
||||||
voice_codec.plfreq,
|
|
||||||
voice_codec.channels,
|
|
||||||
(voice_codec.rate < 0) ? 0 : voice_codec.rate));
|
|
||||||
EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
|
|
||||||
voice_codec.plname,
|
|
||||||
voice_codec.pltype,
|
|
||||||
voice_codec.plfreq,
|
|
||||||
voice_codec.channels,
|
|
||||||
(voice_codec.rate < 0) ? 0 : voice_codec.rate));
|
|
||||||
|
|
||||||
RTPFragmentationHeader fragmentation;
|
|
||||||
fragmentation.fragmentationVectorSize = 2;
|
|
||||||
fragmentation.fragmentationLength = new size_t[2];
|
|
||||||
fragmentation.fragmentationLength[0] = 4;
|
|
||||||
fragmentation.fragmentationLength[1] = 4;
|
|
||||||
fragmentation.fragmentationOffset = new size_t[2];
|
|
||||||
fragmentation.fragmentationOffset[0] = 0;
|
|
||||||
fragmentation.fragmentationOffset[1] = 4;
|
|
||||||
fragmentation.fragmentationTimeDiff = new uint16_t[2];
|
|
||||||
fragmentation.fragmentationTimeDiff[0] = 0;
|
|
||||||
fragmentation.fragmentationTimeDiff[1] = 0;
|
|
||||||
fragmentation.fragmentationPlType = new uint8_t[2];
|
|
||||||
fragmentation.fragmentationPlType[0] = 96;
|
|
||||||
fragmentation.fragmentationPlType[1] = 96;
|
|
||||||
|
|
||||||
const uint8_t test[5] = "test";
|
|
||||||
// Send a RTP packet.
|
|
||||||
EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 160, -1,
|
|
||||||
test, 4, &fragmentation, nullptr,
|
|
||||||
nullptr));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, module1->SetSendREDPayloadType(-1));
|
|
||||||
EXPECT_EQ(-1, module1->SendREDPayloadType(&red));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(RtpRtcpAudioTest, DTMF) {
|
TEST_F(RtpRtcpAudioTest, DTMF) {
|
||||||
CodecInst voice_codec;
|
CodecInst voice_codec;
|
||||||
memset(&voice_codec, 0, sizeof(voice_codec));
|
memset(&voice_codec, 0, sizeof(voice_codec));
|
||||||
|
|||||||
Reference in New Issue
Block a user