Update remaining audio test code to not use WebRtcRTPHeader.
Bug: webrtc:5876
Change-Id: I5b1abcec4a0ef52b6dd36d1fe94dbfd3f88f28a7
Reviewed-on: https://webrtc-review.googlesource.com/c/123235
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26736}
diff --git a/modules/audio_coding/test/Channel.cc b/modules/audio_coding/test/Channel.cc
index e54a29a..adfc0d5 100644
--- a/modules/audio_coding/test/Channel.cc
+++ b/modules/audio_coding/test/Channel.cc
@@ -24,21 +24,20 @@
const uint8_t* payloadData,
size_t payloadSize,
const RTPFragmentationHeader* fragmentation) {
- WebRtcRTPHeader rtpInfo;
+ RTPHeader rtp_header;
int32_t status;
size_t payloadDataSize = payloadSize;
- rtpInfo.header.markerBit = false;
- rtpInfo.header.ssrc = 0;
- rtpInfo.header.sequenceNumber =
+ rtp_header.markerBit = false;
+ rtp_header.ssrc = 0;
+ rtp_header.sequenceNumber =
(external_sequence_number_ < 0)
? _seqNo++
: static_cast<uint16_t>(external_sequence_number_);
- rtpInfo.header.payloadType = payloadType;
- rtpInfo.header.timestamp =
- (external_send_timestamp_ < 0)
- ? timeStamp
- : static_cast<uint32_t>(external_send_timestamp_);
+ rtp_header.payloadType = payloadType;
+ rtp_header.timestamp = (external_send_timestamp_ < 0)
+ ? timeStamp
+ : static_cast<uint32_t>(external_send_timestamp_);
if (frameType == kEmptyFrame) {
// When frame is empty, we should not transmit it. The frame size of the
@@ -75,16 +74,16 @@
memcpy(_payloadData, payloadData + fragmentation->fragmentationOffset[0],
fragmentation->fragmentationLength[0]);
payloadDataSize = fragmentation->fragmentationLength[0];
- rtpInfo.header.payloadType = fragmentation->fragmentationPlType[0];
+ rtp_header.payloadType = fragmentation->fragmentationPlType[0];
}
} else {
memcpy(_payloadData, payloadData, payloadDataSize);
if (_isStereo) {
if (_leftChannel) {
- memcpy(&_rtpInfo, &rtpInfo, sizeof(WebRtcRTPHeader));
+ _rtp_header = rtp_header;
_leftChannel = false;
} else {
- memcpy(&rtpInfo, &_rtpInfo, sizeof(WebRtcRTPHeader));
+ rtp_header = _rtp_header;
_leftChannel = true;
}
}
@@ -96,7 +95,7 @@
}
if (!_isStereo) {
- CalcStatistics(rtpInfo, payloadSize);
+ CalcStatistics(rtp_header, payloadSize);
}
_useLastFrameSize = false;
_lastInTimestamp = timeStamp;
@@ -116,16 +115,16 @@
return 0;
}
- status = _receiverACM->IncomingPacket(_payloadData, payloadDataSize,
- rtpInfo.header);
+ status =
+ _receiverACM->IncomingPacket(_payloadData, payloadDataSize, rtp_header);
return status;
}
// TODO(turajs): rewite this method.
-void Channel::CalcStatistics(WebRtcRTPHeader& rtpInfo, size_t payloadSize) {
+void Channel::CalcStatistics(const RTPHeader& rtp_header, size_t payloadSize) {
int n;
- if ((rtpInfo.header.payloadType != _lastPayloadType) &&
+ if ((rtp_header.payloadType != _lastPayloadType) &&
(_lastPayloadType != -1)) {
// payload-type is changed.
// we have to terminate the calculations on the previous payload type
@@ -138,12 +137,12 @@
}
}
}
- _lastPayloadType = rtpInfo.header.payloadType;
+ _lastPayloadType = rtp_header.payloadType;
bool newPayload = true;
ACMTestPayloadStats* currentPayloadStr = NULL;
for (n = 0; n < MAX_NUM_PAYLOADS; n++) {
- if (rtpInfo.header.payloadType == _payloadStats[n].payloadType) {
+ if (rtp_header.payloadType == _payloadStats[n].payloadType) {
newPayload = false;
currentPayloadStr = &_payloadStats[n];
break;
@@ -154,7 +153,7 @@
if (!currentPayloadStr->newPacket) {
if (!_useLastFrameSize) {
_lastFrameSizeSample =
- (uint32_t)((uint32_t)rtpInfo.header.timestamp -
+ (uint32_t)((uint32_t)rtp_header.timestamp -
(uint32_t)currentPayloadStr->lastTimestamp);
}
assert(_lastFrameSizeSample > 0);
@@ -194,13 +193,13 @@
currentPayloadStr->lastPayloadLenByte;
}
// store the current values for the next time
- currentPayloadStr->lastTimestamp = rtpInfo.header.timestamp;
+ currentPayloadStr->lastTimestamp = rtp_header.timestamp;
currentPayloadStr->lastPayloadLenByte = payloadSize;
} else {
currentPayloadStr->newPacket = false;
currentPayloadStr->lastPayloadLenByte = payloadSize;
- currentPayloadStr->lastTimestamp = rtpInfo.header.timestamp;
- currentPayloadStr->payloadType = rtpInfo.header.payloadType;
+ currentPayloadStr->lastTimestamp = rtp_header.timestamp;
+ currentPayloadStr->payloadType = rtp_header.payloadType;
memset(currentPayloadStr->frameSizeStats, 0,
MAX_NUM_FRAMESIZES * sizeof(ACMTestFrameSizeStats));
}
@@ -212,8 +211,8 @@
// first packet
_payloadStats[n].newPacket = false;
_payloadStats[n].lastPayloadLenByte = payloadSize;
- _payloadStats[n].lastTimestamp = rtpInfo.header.timestamp;
- _payloadStats[n].payloadType = rtpInfo.header.payloadType;
+ _payloadStats[n].lastTimestamp = rtp_header.timestamp;
+ _payloadStats[n].payloadType = rtp_header.payloadType;
memset(_payloadStats[n].frameSizeStats, 0,
MAX_NUM_FRAMESIZES * sizeof(ACMTestFrameSizeStats));
}
diff --git a/modules/audio_coding/test/Channel.h b/modules/audio_coding/test/Channel.h
index e428a71..4d7f0b7 100644
--- a/modules/audio_coding/test/Channel.h
+++ b/modules/audio_coding/test/Channel.h
@@ -81,7 +81,7 @@
}
private:
- void CalcStatistics(WebRtcRTPHeader& rtpInfo, size_t payloadSize);
+ void CalcStatistics(const RTPHeader& rtp_header, size_t payloadSize);
AudioCodingModule* _receiverACM;
uint16_t _seqNo;
@@ -94,7 +94,7 @@
int16_t _lastPayloadType;
ACMTestPayloadStats _payloadStats[MAX_NUM_PAYLOADS];
bool _isStereo;
- WebRtcRTPHeader _rtpInfo;
+ RTPHeader _rtp_header;
bool _leftChannel;
uint32_t _lastInTimestamp;
bool _useLastFrameSize;
diff --git a/modules/audio_coding/test/EncodeDecodeTest.cc b/modules/audio_coding/test/EncodeDecodeTest.cc
index cd57ecd..28ee8aa 100644
--- a/modules/audio_coding/test/EncodeDecodeTest.cc
+++ b/modules/audio_coding/test/EncodeDecodeTest.cc
@@ -155,7 +155,7 @@
if (!_rtpStream->EndOfFile()) {
if (_firstTime) {
_firstTime = false;
- _realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
+ _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload,
_payloadSizeBytes, &_nextTime);
if (_realPayloadSizeBytes == 0) {
if (_rtpStream->EndOfFile()) {
@@ -168,8 +168,8 @@
}
EXPECT_EQ(0, _acm->IncomingPacket(_incomingPayload, _realPayloadSizeBytes,
- _rtpInfo.header));
- _realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
+ _rtpHeader));
+ _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload,
_payloadSizeBytes, &_nextTime);
if (_realPayloadSizeBytes == 0 && _rtpStream->EndOfFile()) {
_firstTime = true;
diff --git a/modules/audio_coding/test/EncodeDecodeTest.h b/modules/audio_coding/test/EncodeDecodeTest.h
index df6ee5f..d9c22d7 100644
--- a/modules/audio_coding/test/EncodeDecodeTest.h
+++ b/modules/audio_coding/test/EncodeDecodeTest.h
@@ -84,7 +84,7 @@
AudioCodingModule* _acm;
uint8_t _incomingPayload[MAX_INCOMING_PAYLOAD];
RTPStream* _rtpStream;
- WebRtcRTPHeader _rtpInfo;
+ RTPHeader _rtpHeader;
size_t _realPayloadSizeBytes;
size_t _payloadSizeBytes;
uint32_t _nextTime;
diff --git a/modules/audio_coding/test/PacketLossTest.cc b/modules/audio_coding/test/PacketLossTest.cc
index fd76224..cbe066f 100644
--- a/modules/audio_coding/test/PacketLossTest.cc
+++ b/modules/audio_coding/test/PacketLossTest.cc
@@ -44,7 +44,7 @@
bool ReceiverWithPacketLoss::IncomingPacket() {
if (!_rtpStream->EndOfFile()) {
if (packet_counter_ == 0) {
- _realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
+ _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload,
_payloadSizeBytes, &_nextTime);
if (_realPayloadSizeBytes == 0) {
if (_rtpStream->EndOfFile()) {
@@ -57,11 +57,10 @@
}
if (!PacketLost()) {
- _acm->IncomingPacket(_incomingPayload, _realPayloadSizeBytes,
- _rtpInfo.header);
+ _acm->IncomingPacket(_incomingPayload, _realPayloadSizeBytes, _rtpHeader);
}
packet_counter_++;
- _realPayloadSizeBytes = _rtpStream->Read(&_rtpInfo, _incomingPayload,
+ _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload,
_payloadSizeBytes, &_nextTime);
if (_realPayloadSizeBytes == 0 && _rtpStream->EndOfFile()) {
packet_counter_ = 0;
diff --git a/modules/audio_coding/test/RTPFile.cc b/modules/audio_coding/test/RTPFile.cc
index cfe93fa..1273fa8 100644
--- a/modules/audio_coding/test/RTPFile.cc
+++ b/modules/audio_coding/test/RTPFile.cc
@@ -25,19 +25,19 @@
namespace webrtc {
-void RTPStream::ParseRTPHeader(WebRtcRTPHeader* rtpInfo,
+void RTPStream::ParseRTPHeader(RTPHeader* rtp_header,
const uint8_t* rtpHeader) {
- rtpInfo->header.payloadType = rtpHeader[1];
- rtpInfo->header.sequenceNumber =
+ rtp_header->payloadType = rtpHeader[1];
+ rtp_header->sequenceNumber =
(static_cast<uint16_t>(rtpHeader[2]) << 8) | rtpHeader[3];
- rtpInfo->header.timestamp = (static_cast<uint32_t>(rtpHeader[4]) << 24) |
- (static_cast<uint32_t>(rtpHeader[5]) << 16) |
- (static_cast<uint32_t>(rtpHeader[6]) << 8) |
- rtpHeader[7];
- rtpInfo->header.ssrc = (static_cast<uint32_t>(rtpHeader[8]) << 24) |
- (static_cast<uint32_t>(rtpHeader[9]) << 16) |
- (static_cast<uint32_t>(rtpHeader[10]) << 8) |
- rtpHeader[11];
+ rtp_header->timestamp = (static_cast<uint32_t>(rtpHeader[4]) << 24) |
+ (static_cast<uint32_t>(rtpHeader[5]) << 16) |
+ (static_cast<uint32_t>(rtpHeader[6]) << 8) |
+ rtpHeader[7];
+ rtp_header->ssrc = (static_cast<uint32_t>(rtpHeader[8]) << 24) |
+ (static_cast<uint32_t>(rtpHeader[9]) << 16) |
+ (static_cast<uint32_t>(rtpHeader[10]) << 8) |
+ rtpHeader[11];
}
void RTPStream::MakeRTPheader(uint8_t* rtpHeader,
@@ -101,7 +101,7 @@
_queueRWLock->ReleaseLockExclusive();
}
-size_t RTPBuffer::Read(WebRtcRTPHeader* rtpInfo,
+size_t RTPBuffer::Read(RTPHeader* rtp_header,
uint8_t* payloadData,
size_t payloadSize,
uint32_t* offset) {
@@ -109,11 +109,11 @@
RTPPacket* packet = _rtpQueue.front();
_rtpQueue.pop();
_queueRWLock->ReleaseLockShared();
- rtpInfo->header.markerBit = 1;
- rtpInfo->header.payloadType = packet->payloadType;
- rtpInfo->header.sequenceNumber = packet->seqNo;
- rtpInfo->header.ssrc = 0;
- rtpInfo->header.timestamp = packet->timeStamp;
+ rtp_header->markerBit = 1;
+ rtp_header->payloadType = packet->payloadType;
+ rtp_header->sequenceNumber = packet->seqNo;
+ rtp_header->ssrc = 0;
+ rtp_header->timestamp = packet->timeStamp;
if (packet->payloadSize > 0 && payloadSize >= packet->payloadSize) {
memcpy(payloadData, packet->payloadData, packet->payloadSize);
} else {
@@ -199,7 +199,7 @@
EXPECT_EQ(payloadSize, fwrite(payloadData, 1, payloadSize, _rtpFile));
}
-size_t RTPFile::Read(WebRtcRTPHeader* rtpInfo,
+size_t RTPFile::Read(RTPHeader* rtp_header,
uint8_t* payloadData,
size_t payloadSize,
uint32_t* offset) {
@@ -220,7 +220,7 @@
EXPECT_GT(plen, 11);
EXPECT_EQ(1u, fread(rtpHeader, 12, 1, _rtpFile));
- ParseRTPHeader(rtpInfo, rtpHeader);
+ ParseRTPHeader(rtp_header, rtpHeader);
EXPECT_EQ(lengthBytes, plen + 8);
if (plen == 0) {
diff --git a/modules/audio_coding/test/RTPFile.h b/modules/audio_coding/test/RTPFile.h
index 141075b..1c555ed 100644
--- a/modules/audio_coding/test/RTPFile.h
+++ b/modules/audio_coding/test/RTPFile.h
@@ -33,7 +33,7 @@
// Returns the packet's payload size. Zero should be treated as an
// end-of-stream (in the case that EndOfFile() is true) or an error.
- virtual size_t Read(WebRtcRTPHeader* rtpInfo,
+ virtual size_t Read(RTPHeader* rtp_Header,
uint8_t* payloadData,
size_t payloadSize,
uint32_t* offset) = 0;
@@ -46,7 +46,7 @@
uint32_t timeStamp,
uint32_t ssrc);
- void ParseRTPHeader(WebRtcRTPHeader* rtpInfo, const uint8_t* rtpHeader);
+ void ParseRTPHeader(RTPHeader* rtp_header, const uint8_t* rtpHeader);
};
class RTPPacket {
@@ -81,7 +81,7 @@
const size_t payloadSize,
uint32_t frequency) override;
- size_t Read(WebRtcRTPHeader* rtpInfo,
+ size_t Read(RTPHeader* rtp_header,
uint8_t* payloadData,
size_t payloadSize,
uint32_t* offset) override;
@@ -114,7 +114,7 @@
const size_t payloadSize,
uint32_t frequency) override;
- size_t Read(WebRtcRTPHeader* rtpInfo,
+ size_t Read(RTPHeader* rtp_header,
uint8_t* payloadData,
size_t payloadSize,
uint32_t* offset) override;