AcmReceiver::InsertPacket and NetEq::InsertPacket: Take ArrayView arguments

Instead of separate pointer and size arguments.

Review URL: https://codereview.webrtc.org/1429943004

Cr-Commit-Position: refs/heads/master@{#10606}
This commit is contained in:
kwiberg
2015-11-11 10:34:00 -08:00
committed by Commit bot
parent 91d926038f
commit ee2bac26dd
17 changed files with 132 additions and 157 deletions

View File

@ -33,14 +33,12 @@ void NetEqExternalDecoderTest::Init() {
decoder_, codec_, kPayloadType, sample_rate_hz_));
}
void NetEqExternalDecoderTest::InsertPacket(WebRtcRTPHeader rtp_header,
const uint8_t* payload,
size_t payload_size_bytes,
uint32_t receive_timestamp) {
ASSERT_EQ(
NetEq::kOK,
neteq_->InsertPacket(
rtp_header, payload, payload_size_bytes, receive_timestamp));
void NetEqExternalDecoderTest::InsertPacket(
WebRtcRTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp) {
ASSERT_EQ(NetEq::kOK,
neteq_->InsertPacket(rtp_header, payload, receive_timestamp));
}
size_t NetEqExternalDecoderTest::GetOutputAudio(size_t max_length,

View File

@ -36,8 +36,8 @@ class NetEqExternalDecoderTest {
// |payload_size_bytes| bytes. The |receive_timestamp| is an indication
// of the time when the packet was received, and should be measured with
// the same tick rate as the RTP timestamp of the current payload.
virtual void InsertPacket(WebRtcRTPHeader rtp_header, const uint8_t* payload,
size_t payload_size_bytes,
virtual void InsertPacket(WebRtcRTPHeader rtp_header,
rtc::ArrayView<const uint8_t> payload,
uint32_t receive_timestamp);
// Get 10 ms of audio data. The data is written to |output|, which can hold

View File

@ -68,7 +68,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms,
uint8_t input_payload[kInputBlockSizeSamples * sizeof(int16_t)];
size_t payload_len = WebRtcPcm16b_Encode(input_samples.data(),
input_samples.size(), input_payload);
assert(payload_len == kInputBlockSizeSamples * sizeof(int16_t));
RTC_CHECK_EQ(sizeof(input_payload), payload_len);
// Main loop.
webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock();
@ -82,9 +82,9 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms,
}
if (!lost) {
// Insert packet.
int error = neteq->InsertPacket(
rtp_header, input_payload, payload_len,
packet_input_time_ms * kSampRateHz / 1000);
int error =
neteq->InsertPacket(rtp_header, input_payload,
packet_input_time_ms * kSampRateHz / 1000);
if (error != NetEq::kOK)
return -1;
}

View File

@ -377,9 +377,10 @@ int NetEqQualityTest::Transmit() {
<< " ms ";
if (payload_size_bytes_ > 0) {
if (!PacketLost()) {
int ret = neteq_->InsertPacket(rtp_header_, &payload_[0],
payload_size_bytes_,
packet_input_time_ms * in_sampling_khz_);
int ret = neteq_->InsertPacket(
rtp_header_,
rtc::ArrayView<const uint8_t>(payload_.get(), payload_size_bytes_),
packet_input_time_ms * in_sampling_khz_);
if (ret != NetEq::kOK)
return -1;
Log() << "was sent.";

View File

@ -547,7 +547,7 @@ int main(int argc, char* argv[]) {
payload_ptr = payload.get();
}
int error = neteq->InsertPacket(
rtp_header, payload_ptr, payload_len,
rtp_header, rtc::ArrayView<const uint8_t>(payload_ptr, payload_len),
static_cast<uint32_t>(packet->time_ms() * sample_rate_hz / 1000));
if (error != NetEq::kOK) {
if (neteq->LastError() == NetEq::kUnknownRtpPayloadType) {