Clean up in module_common_types.h by removing the unused struct RTPAudioHeader.
By removing it we can in turn (next CL) get rid of RTPTypeHeader, which is a
union that cause some problems.
Bug: none
Change-Id: I9246ecbfe2c8b7eda27497cccbc5f438958b64bf
Reviewed-on: https://webrtc-review.googlesource.com/83985
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23666}
diff --git a/modules/audio_coding/acm2/acm_receive_test.cc b/modules/audio_coding/acm2/acm_receive_test.cc
index 6afc161..ba8937e 100644
--- a/modules/audio_coding/acm2/acm_receive_test.cc
+++ b/modules/audio_coding/acm2/acm_receive_test.cc
@@ -199,7 +199,6 @@
WebRtcRTPHeader header;
header.header = packet->header();
header.frameType = kAudioFrameSpeech;
- memset(&header.type.Audio, 0, sizeof(RTPAudioHeader));
EXPECT_EQ(0,
acm_->IncomingPacket(
packet->payload(),
diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc
index 350183b..d1cff23 100644
--- a/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc
@@ -82,7 +82,6 @@
rtp_header_.header.numCSRCs = 0;
rtp_header_.header.payloadType = 0;
rtp_header_.frameType = kAudioFrameSpeech;
- rtp_header_.type.Audio.isCNG = false;
}
void TearDown() override {}
@@ -135,10 +134,6 @@
rtp_header_.header.payloadType = payload_type;
rtp_header_.frameType = frame_type;
- if (frame_type == kAudioFrameSpeech)
- rtp_header_.type.Audio.isCNG = false;
- else
- rtp_header_.type.Audio.isCNG = true;
rtp_header_.header.timestamp = timestamp;
int ret_val = receiver_->InsertPacket(
diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
index 7592300..ce2832a 100644
--- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc
+++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
@@ -78,8 +78,6 @@
rtp_header->frameType = kAudioFrameSpeech;
rtp_header->header.payload_type_frequency = kSampleRateHz;
- rtp_header->type.Audio.channel = 1;
- rtp_header->type.Audio.isCNG = false;
}
void Forward(WebRtcRTPHeader* rtp_header) {
diff --git a/modules/audio_coding/test/Channel.cc b/modules/audio_coding/test/Channel.cc
index 8fdb677..bb970c1 100644
--- a/modules/audio_coding/test/Channel.cc
+++ b/modules/audio_coding/test/Channel.cc
@@ -40,11 +40,6 @@
? timeStamp
: static_cast<uint32_t>(external_send_timestamp_);
- if (frameType == kAudioFrameCN) {
- rtpInfo.type.Audio.isCNG = true;
- } else {
- rtpInfo.type.Audio.isCNG = false;
- }
if (frameType == kEmptyFrame) {
// When frame is empty, we should not transmit it. The frame size of the
// next non-empty frame will be based on the previous frame size.
@@ -52,7 +47,6 @@
return 0;
}
- rtpInfo.type.Audio.channel = 1;
// Treat fragmentation separately
if (fragmentation != NULL) {
// If silence for too long, send only new data.
@@ -89,11 +83,9 @@
if (_leftChannel) {
memcpy(&_rtpInfo, &rtpInfo, sizeof(WebRtcRTPHeader));
_leftChannel = false;
- rtpInfo.type.Audio.channel = 1;
} else {
memcpy(&rtpInfo, &_rtpInfo, sizeof(WebRtcRTPHeader));
_leftChannel = true;
- rtpInfo.type.Audio.channel = 2;
}
}
}
diff --git a/modules/audio_coding/test/RTPFile.cc b/modules/audio_coding/test/RTPFile.cc
index a1329e7..d058384 100644
--- a/modules/audio_coding/test/RTPFile.cc
+++ b/modules/audio_coding/test/RTPFile.cc
@@ -222,8 +222,6 @@
EXPECT_EQ(1u, fread(rtpHeader, 12, 1, _rtpFile));
ParseRTPHeader(rtpInfo, rtpHeader);
- rtpInfo->type.Audio.isCNG = false;
- rtpInfo->type.Audio.channel = 1;
EXPECT_EQ(lengthBytes, plen + 8);
if (plen == 0) {
diff --git a/modules/audio_coding/test/TestAllCodecs.cc b/modules/audio_coding/test/TestAllCodecs.cc
index df9c731..74de1d9 100644
--- a/modules/audio_coding/test/TestAllCodecs.cc
+++ b/modules/audio_coding/test/TestAllCodecs.cc
@@ -69,18 +69,13 @@
rtp_info.header.sequenceNumber = sequence_number_++;
rtp_info.header.payloadType = payload_type;
rtp_info.header.timestamp = timestamp;
- if (frame_type == kAudioFrameCN) {
- rtp_info.type.Audio.isCNG = true;
- } else {
- rtp_info.type.Audio.isCNG = false;
- }
+
if (frame_type == kEmptyFrame) {
// Skip this frame.
return 0;
}
// Only run mono for all test cases.
- rtp_info.type.Audio.channel = 1;
memcpy(payload_data_, payload_data, payload_size);
status = receiver_acm_->IncomingPacket(payload_data_, payload_size, rtp_info);
diff --git a/modules/audio_coding/test/TestStereo.cc b/modules/audio_coding/test/TestStereo.cc
index 2704d3d..31b1d07 100644
--- a/modules/audio_coding/test/TestStereo.cc
+++ b/modules/audio_coding/test/TestStereo.cc
@@ -63,13 +63,6 @@
}
if (lost_packet_ == false) {
- if (frame_type != kAudioFrameCN) {
- rtp_info.type.Audio.isCNG = false;
- rtp_info.type.Audio.channel = static_cast<int>(codec_mode_);
- } else {
- rtp_info.type.Audio.isCNG = true;
- rtp_info.type.Audio.channel = static_cast<int>(kMono);
- }
status =
receiver_acm_->IncomingPacket(payload_data, payload_size, rtp_info);
diff --git a/modules/audio_coding/test/target_delay_unittest.cc b/modules/audio_coding/test/target_delay_unittest.cc
index 7579d62..3b129ea 100644
--- a/modules/audio_coding/test/target_delay_unittest.cc
+++ b/modules/audio_coding/test/target_delay_unittest.cc
@@ -43,8 +43,6 @@
rtp_info_.header.ssrc = 0x12345678;
rtp_info_.header.markerBit = false;
rtp_info_.header.sequenceNumber = 0;
- rtp_info_.type.Audio.channel = 1;
- rtp_info_.type.Audio.isCNG = false;
rtp_info_.frameType = kAudioFrameSpeech;
int16_t audio[kFrameSizeSamples];
diff --git a/modules/include/module_common_types.h b/modules/include/module_common_types.h
index 08b36d1..6554adb 100644
--- a/modules/include/module_common_types.h
+++ b/modules/include/module_common_types.h
@@ -35,13 +35,6 @@
namespace webrtc {
-struct RTPAudioHeader {
- uint8_t numEnergy; // number of valid entries in arrOfEnergy
- uint8_t arrOfEnergy[kRtpCsrcSize]; // one energy byte (0-9) per channel
- bool isCNG; // is this CNG
- size_t channel; // number of channels 2 = stereo
-};
-
// TODO(nisse): Deprecated, use webrtc::VideoCodecType instead.
using RtpVideoCodecTypes = VideoCodecType;
@@ -71,7 +64,6 @@
RTPVideoTypeHeader codecHeader;
};
union RTPTypeHeader {
- RTPAudioHeader Audio;
RTPVideoHeader Video;
};
diff --git a/modules/rtp_rtcp/include/rtp_receiver.h b/modules/rtp_rtcp/include/rtp_receiver.h
index 52062a0..d2d73b4 100644
--- a/modules/rtp_rtcp/include/rtp_receiver.h
+++ b/modules/rtp_rtcp/include/rtp_receiver.h
@@ -101,9 +101,6 @@
// Returns the current remote CSRCs.
virtual int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const = 0;
- // Returns the current energy of the RTP stream received.
- virtual int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const = 0;
-
virtual std::vector<RtpSource> GetSources() const = 0;
};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_receiver_audio.cc b/modules/rtp_rtcp/source/rtp_receiver_audio.cc
index 3db5ef5..ac57138 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_audio.cc
+++ b/modules/rtp_rtcp/source/rtp_receiver_audio.cc
@@ -32,11 +32,7 @@
cng_nb_payload_type_(-1),
cng_wb_payload_type_(-1),
cng_swb_payload_type_(-1),
- cng_fb_payload_type_(-1),
- num_energy_(0),
- current_remote_energy_() {
- memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
-}
+ cng_fb_payload_type_(-1) {}
RTPReceiverAudio::~RTPReceiverAudio() = default;
@@ -134,14 +130,6 @@
const uint8_t* payload,
size_t payload_length,
int64_t timestamp_ms) {
- rtp_header->type.Audio.numEnergy = rtp_header->header.numCSRCs;
- num_energy_ = rtp_header->type.Audio.numEnergy;
- if (rtp_header->type.Audio.numEnergy > 0 &&
- rtp_header->type.Audio.numEnergy <= kRtpCsrcSize) {
- memcpy(current_remote_energy_, rtp_header->type.Audio.arrOfEnergy,
- rtp_header->type.Audio.numEnergy);
- }
-
if (first_packet_received_()) {
RTC_LOG(LS_INFO) << "Received first audio RTP packet";
}
@@ -168,18 +156,6 @@
TelephoneEventPayloadType(payload_type) || CNGPayloadType(payload_type);
}
-int RTPReceiverAudio::Energy(uint8_t array_of_energy[kRtpCsrcSize]) const {
- rtc::CritScope cs(&crit_sect_);
-
- assert(num_energy_ <= kRtpCsrcSize);
-
- if (num_energy_ > 0) {
- memcpy(array_of_energy, current_remote_energy_,
- sizeof(uint8_t) * num_energy_);
- }
- return num_energy_;
-}
-
// We are not allowed to have any critsects when calling data_callback.
int32_t RTPReceiverAudio::ParseAudioCodecSpecific(
WebRtcRTPHeader* rtp_header,
@@ -190,7 +166,6 @@
const size_t payload_data_length =
payload_length - rtp_header->header.paddingLength;
if (payload_data_length == 0) {
- rtp_header->type.Audio.isCNG = false;
rtp_header->frameType = kEmptyFrame;
return data_callback_->OnReceivedPayloadData(nullptr, 0, rtp_header);
}
@@ -246,15 +221,6 @@
{
rtc::CritScope lock(&crit_sect_);
- // Check if this is a CNG packet, receiver might want to know
- if (CNGPayloadType(rtp_header->header.payloadType)) {
- rtp_header->type.Audio.isCNG = true;
- rtp_header->frameType = kAudioFrameCN;
- } else {
- rtp_header->frameType = kAudioFrameSpeech;
- rtp_header->type.Audio.isCNG = false;
- }
-
// check if it's a DTMF event, hence something we can playout
if (telephone_event_packet) {
if (!telephone_event_forward_to_decoder_) {
@@ -269,7 +235,6 @@
}
}
- rtp_header->type.Audio.channel = audio_specific.format.num_channels;
return data_callback_->OnReceivedPayloadData(payload_data,
payload_data_length, rtp_header);
}
diff --git a/modules/rtp_rtcp/source/rtp_receiver_audio.h b/modules/rtp_rtcp/source/rtp_receiver_audio.h
index ded9d42..d88acfd 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_audio.h
+++ b/modules/rtp_rtcp/source/rtp_receiver_audio.h
@@ -61,8 +61,6 @@
PayloadUnion* specific_payload,
bool* should_discard_changes) override;
- int Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
-
private:
int32_t ParseAudioCodecSpecific(WebRtcRTPHeader* rtp_header,
const uint8_t* payload_data,
@@ -78,9 +76,6 @@
int8_t cng_swb_payload_type_;
int8_t cng_fb_payload_type_;
- uint8_t num_energy_;
- uint8_t current_remote_energy_[kRtpCsrcSize];
-
ThreadUnsafeOneTimeEvent first_packet_received_;
};
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index a0d201a..7fa1d37 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -143,10 +143,6 @@
return num_csrcs_;
}
-int32_t RtpReceiverImpl::Energy(uint8_t array_of_energy[kRtpCsrcSize]) const {
- return rtp_media_receiver_->Energy(array_of_energy);
-}
-
bool RtpReceiverImpl::IncomingRtpPacket(const RTPHeader& rtp_header,
const uint8_t* payload,
size_t payload_length,
diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.h b/modules/rtp_rtcp/source/rtp_receiver_impl.h
index 70d7a2e..ec218d3 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_impl.h
+++ b/modules/rtp_rtcp/source/rtp_receiver_impl.h
@@ -54,8 +54,6 @@
int32_t CSRCs(uint32_t array_of_csrc[kRtpCsrcSize]) const override;
- int32_t Energy(uint8_t array_of_energy[kRtpCsrcSize]) const override;
-
TelephoneEventHandler* GetTelephoneEventHandler() override;
std::vector<RtpSource> GetSources() const override;
diff --git a/modules/rtp_rtcp/source/rtp_receiver_strategy.cc b/modules/rtp_rtcp/source/rtp_receiver_strategy.cc
index 1404273..bcce3e3 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_strategy.cc
+++ b/modules/rtp_rtcp/source/rtp_receiver_strategy.cc
@@ -26,8 +26,4 @@
*should_discard_changes = false;
}
-int RTPReceiverStrategy::Energy(uint8_t array_of_energy[kRtpCsrcSize]) const {
- return -1;
-}
-
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_receiver_strategy.h b/modules/rtp_rtcp/source/rtp_receiver_strategy.h
index 52cb593..8b13f18 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_strategy.h
+++ b/modules/rtp_rtcp/source/rtp_receiver_strategy.h
@@ -61,8 +61,6 @@
PayloadUnion* specific_payload,
bool* should_discard_changes);
- virtual int Energy(uint8_t array_of_energy[kRtpCsrcSize]) const;
-
protected:
// The data callback is where we should send received payload data.
// See ParseRtpPacket. This class does not claim ownership of the callback.
diff --git a/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
index d64440f..abda7b2 100644
--- a/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
+++ b/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
@@ -39,14 +39,6 @@
{104, 32000},
{105, 48000}};
-bool IsComfortNoisePayload(uint8_t payload_type) {
- for (const auto& c : kCngCodecs) {
- if (c.payload_type == payload_type)
- return true;
- }
-
- return false;
-}
class VerifyingAudioReceiver : public RtpData {
public:
@@ -60,11 +52,8 @@
// All our test vectors for PCMU and DTMF are equal to |kTestPayload|.
const size_t min_size = std::min(sizeof(kTestPayload), payloadSize);
EXPECT_EQ(0, memcmp(payloadData, kTestPayload, min_size));
- } else if (IsComfortNoisePayload(payload_type)) {
- // CNG types should be recognized properly.
- EXPECT_EQ(kAudioFrameCN, rtpHeader->frameType);
- EXPECT_TRUE(rtpHeader->type.Audio.isCNG);
}
+
return 0;
}
};