Replace ArrayView with std::span everywhere except api

ArrayView is an alias to std::span. This change switch to use
std::span directly instead of through the alias.

Search&Replace MakeArrayView and ArrayView with std::span
Search&Replace include "api/array_view.h" with include <span>
Remove <span> include where std::span is not mentioned in the file
Remove build dependencies on array_view target

Bug: webrtc:439801349
Change-Id: I64bbdcf1300126286158ccbeda62c49e0c3ec83f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/460501
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#47294}
This commit is contained in:
Danil Chapovalov 2026-03-27 15:27:59 +01:00 committed by WebRTC LUCI CQ
parent 50f35f0996
commit c9752917bd
56 changed files with 220 additions and 245 deletions

View File

@ -40,7 +40,6 @@ rtc_library("audio") {
]
deps = [
"../api:array_view",
"../api:bitrate_allocation",
"../api:call_api",
"../api:field_trials_view",
@ -165,7 +164,6 @@ if (rtc_include_tests) {
":audio",
":audio_end_to_end_test",
":channel_receive_unittest",
"../api:array_view",
"../api:bitrate_allocation",
"../api:call_api",
"../api:field_trials",
@ -252,7 +250,6 @@ if (rtc_include_tests) {
sources = [ "channel_receive_unittest.cc" ]
deps = [
":audio",
"../api:array_view",
"../api:make_ref_counted",
"../api:mock_frame_transformer",
"../api:scoped_refptr",

View File

@ -15,12 +15,12 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_format.h"
@ -446,7 +446,7 @@ bool AudioReceiveStreamImpl::SetMinimumPlayoutDelay(TimeDelta delay) {
return channel_receive_->SetMinimumPlayoutDelay(delay);
}
void AudioReceiveStreamImpl::DeliverRtcp(ArrayView<const uint8_t> packet) {
void AudioReceiveStreamImpl::DeliverRtcp(std::span<const uint8_t> packet) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_receive_->ReceivedRTCPPacket(packet.data(), packet.size());
}

View File

@ -16,11 +16,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_format.h"
@ -128,7 +128,7 @@ class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStreamInterface,
Timestamp time) override;
bool SetMinimumPlayoutDelay(TimeDelta delay) override;
void DeliverRtcp(ArrayView<const uint8_t> packet);
void DeliverRtcp(std::span<const uint8_t> packet);
void SetSyncGroup(absl::string_view sync_group);

View File

@ -15,13 +15,13 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_processing.h"
#include "api/audio_codecs/audio_encoder.h"
@ -495,7 +495,7 @@ webrtc::AudioSendStream::Stats AudioSendStream::GetStats(
return stats;
}
void AudioSendStream::DeliverRtcp(ArrayView<const uint8_t> packet) {
void AudioSendStream::DeliverRtcp(std::span<const uint8_t> packet) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_send_->ReceivedRTCPPacket(packet.data(), packet.size());
// Poll if overhead has changed, which it can do if ack triggers us to stop

View File

@ -15,10 +15,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/environment/environment.h"
#include "api/field_trials_view.h"
@ -103,7 +103,7 @@ class AudioSendStream final : public webrtc::AudioSendStream,
webrtc::AudioSendStream::Stats GetStats(
bool has_remote_tracks) const override;
void DeliverRtcp(ArrayView<const uint8_t> packet);
void DeliverRtcp(std::span<const uint8_t> packet);
// Implements BitrateAllocatorObserver.
uint32_t OnBitrateUpdated(BitrateAllocationUpdate update) override;

View File

@ -10,10 +10,10 @@
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/rtp_headers.h"
#include "api/rtp_parameters.h"
#include "call/audio_receive_stream.h"
@ -56,7 +56,7 @@ TEST_F(AudioSendStreamCallTest, SupportsCName) {
CNameObserver() = default;
private:
Action OnSendRtcp(ArrayView<const uint8_t> packet) override {
Action OnSendRtcp(std::span<const uint8_t> packet) override {
RtcpPacketParser parser;
EXPECT_TRUE(parser.Parse(packet));
if (parser.sdes()->num_packets() > 0) {
@ -89,7 +89,7 @@ TEST_F(AudioSendStreamCallTest, NoExtensionsByDefault) {
NoExtensionsObserver() = default;
private:
Action OnSendRtp(ArrayView<const uint8_t> packet) override {
Action OnSendRtp(std::span<const uint8_t> packet) override {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet)); // rtp packet is valid.
EXPECT_EQ(packet[0] & 0b0001'0000, 0); // extension bit not set.
@ -119,7 +119,7 @@ TEST_F(AudioSendStreamCallTest, SupportsAudioLevel) {
extensions_.Register<AudioLevelExtension>(kAudioLevelExtensionId);
}
Action OnSendRtp(ArrayView<const uint8_t> packet) override {
Action OnSendRtp(std::span<const uint8_t> packet) override {
RtpPacket rtp_packet(&extensions_);
EXPECT_TRUE(rtp_packet.Parse(packet));
@ -164,7 +164,7 @@ class TransportWideSequenceNumberObserver : public AudioSendTest {
}
private:
Action OnSendRtp(ArrayView<const uint8_t> packet) override {
Action OnSendRtp(std::span<const uint8_t> packet) override {
RtpPacket rtp_packet(&extensions_);
EXPECT_TRUE(rtp_packet.Parse(packet));
@ -210,7 +210,7 @@ TEST_F(AudioSendStreamCallTest, SendDtmf) {
DtmfObserver() = default;
private:
Action OnSendRtp(ArrayView<const uint8_t> packet) override {
Action OnSendRtp(std::span<const uint8_t> packet) override {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));

View File

@ -17,11 +17,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_device.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -220,7 +220,7 @@ class ChannelReceive : public ChannelReceiveInterface,
int GetRtpTimestampRateHz() const;
void OnReceivedPayloadData(ArrayView<const uint8_t> payload,
void OnReceivedPayloadData(std::span<const uint8_t> payload,
const RTPHeader& header,
Timestamp receive_time)
RTC_RUN_ON(worker_thread_checker_);
@ -334,7 +334,7 @@ class ChannelReceive : public ChannelReceiveInterface,
RTC_GUARDED_BY(worker_thread_checker_);
};
void ChannelReceive::OnReceivedPayloadData(ArrayView<const uint8_t> payload,
void ChannelReceive::OnReceivedPayloadData(std::span<const uint8_t> payload,
const RTPHeader& header,
Timestamp receive_time) {
if (!playing_) {
@ -379,7 +379,7 @@ void ChannelReceive::InitFrameTransformerDelegate(
// Pass a callback to ChannelReceive::OnReceivedPayloadData, to be called by
// the delegate to receive transformed audio.
ChannelReceiveFrameTransformerDelegate::ReceiveFrameCallback
receive_audio_callback = [this](ArrayView<const uint8_t> packet,
receive_audio_callback = [this](std::span<const uint8_t> packet,
const RTPHeader& header,
Timestamp receive_time) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
@ -737,7 +737,7 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
frame_decryptor_->Decrypt(
MediaType::AUDIO, csrcs,
/*additional_data=*/{},
ArrayView<const uint8_t>(payload, payload_data_length),
std::span<const uint8_t>(payload, payload_data_length),
decrypted_audio_payload);
if (decrypt_result.IsOk()) {
@ -755,7 +755,7 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
payload_data_length = 0;
}
ArrayView<const uint8_t> payload_data(payload, payload_data_length);
std::span<const uint8_t> payload_data(payload, payload_data_length);
if (frame_transformer_delegate_) {
// Asynchronously transform the received payload. After the payload is
// transformed, the delegate will call OnReceivedPayloadData to handle it.
@ -778,7 +778,7 @@ void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
UpdatePlayoutTimestamp(true, env_.clock().CurrentTime());
// Deliver RTCP packet to RTP/RTCP module for parsing
rtp_rtcp_->IncomingRtcpPacket(MakeArrayView(data, length));
rtp_rtcp_->IncomingRtcpPacket(std::span(data, length));
std::optional<TimeDelta> rtt = rtp_rtcp_->LastRtt();
if (!rtt.has_value()) {

View File

@ -14,10 +14,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_headers.h"
#include "api/scoped_refptr.h"
@ -34,7 +34,7 @@ namespace webrtc {
class TransformableIncomingAudioFrame
: public TransformableAudioFrameInterface {
public:
TransformableIncomingAudioFrame(ArrayView<const uint8_t> payload,
TransformableIncomingAudioFrame(std::span<const uint8_t> payload,
const RTPHeader& header,
uint32_t ssrc,
const std::string& codec_mime_type,
@ -46,9 +46,9 @@ class TransformableIncomingAudioFrame
codec_mime_type_(codec_mime_type),
receive_time_(receive_time) {}
~TransformableIncomingAudioFrame() override = default;
ArrayView<const uint8_t> GetData() const override { return payload_; }
std::span<const uint8_t> GetData() const override { return payload_; }
void SetData(ArrayView<const uint8_t> data) override {
void SetData(std::span<const uint8_t> data) override {
payload_.SetData(data.data(), data.size());
}
@ -59,8 +59,8 @@ class TransformableIncomingAudioFrame
uint8_t GetPayloadType() const override { return header_.payloadType; }
uint32_t GetSsrc() const override { return ssrc_; }
uint32_t GetTimestamp() const override { return header_.timestamp; }
ArrayView<const uint32_t> GetContributingSources() const override {
return ArrayView<const uint32_t>(header_.arrOfCSRCs, header_.numCSRCs);
std::span<const uint32_t> GetContributingSources() const override {
return std::span<const uint32_t>(header_.arrOfCSRCs, header_.numCSRCs);
}
Direction GetDirection() const override { return Direction::kReceiver; }
@ -159,7 +159,7 @@ void ChannelReceiveFrameTransformerDelegate::Reset() {
}
void ChannelReceiveFrameTransformerDelegate::Transform(
ArrayView<const uint8_t> packet,
std::span<const uint8_t> packet,
const RTPHeader& header,
uint32_t ssrc,
const std::string& codec_mime_type,

View File

@ -14,9 +14,9 @@
#include <cstdint>
#include <functional>
#include <memory>
#include <span>
#include <string>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/rtp_headers.h"
#include "api/scoped_refptr.h"
@ -34,7 +34,7 @@ namespace webrtc {
class ChannelReceiveFrameTransformerDelegate : public TransformedFrameCallback {
public:
using ReceiveFrameCallback =
std::function<void(webrtc::ArrayView<const uint8_t> packet,
std::function<void(std::span<const uint8_t> packet,
const RTPHeader& header,
Timestamp receive_time)>;
ChannelReceiveFrameTransformerDelegate(
@ -54,7 +54,7 @@ class ChannelReceiveFrameTransformerDelegate : public TransformedFrameCallback {
// Delegates the call to FrameTransformerInterface::Transform, to transform
// the frame asynchronously.
void Transform(ArrayView<const uint8_t> packet,
void Transform(std::span<const uint8_t> packet,
const RTPHeader& header,
uint32_t ssrc,
const std::string& codec_mime_type,

View File

@ -12,9 +12,9 @@
#include <cstdint>
#include <memory>
#include <span>
#include <utility>
#include "api/array_view.h"
#include "api/frame_transformer_factory.h"
#include "api/frame_transformer_interface.h"
#include "api/make_ref_counted.h"
@ -44,12 +44,12 @@ class MockChannelReceive {
public:
MOCK_METHOD(void,
ReceiveFrame,
(ArrayView<const uint8_t> packet,
(std::span<const uint8_t> packet,
const RTPHeader& header,
Timestamp receive_time));
ChannelReceiveFrameTransformerDelegate::ReceiveFrameCallback callback() {
return [this](ArrayView<const uint8_t> packet, const RTPHeader& header,
return [this](std::span<const uint8_t> packet, const RTPHeader& header,
Timestamp receive_time) {
ReceiveFrame(packet, header, receive_time);
};
@ -101,7 +101,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
ASSERT_TRUE(callback);
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
RTPHeader header;
EXPECT_CALL(mock_channel, ReceiveFrame);
ON_CALL(*mock_frame_transformer, Transform)
@ -132,7 +132,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
ASSERT_TRUE(callback);
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
RTPHeader header;
EXPECT_CALL(mock_channel,
ReceiveFrame(ElementsAre(1, 2, 3, 4), _, kFakeReceiveTimestamp));
@ -177,7 +177,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
make_ref_counted<ChannelReceiveFrameTransformerDelegate>(
mock_channel.callback(), mock_frame_transformer, Thread::Current());
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
RTPHeader header;
delegate->StartShortCircuiting();
@ -207,7 +207,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
ASSERT_TRUE(callback);
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
RTPHeader header;
std::unique_ptr<TransformableFrameInterface> frame;
ON_CALL(*mock_frame_transformer, Transform)
@ -244,7 +244,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
ASSERT_TRUE(callback);
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
RTPHeader header;
uint8_t audio_level_dbov = 67;
AudioLevel audio_level(/*voice_activity=*/true, audio_level_dbov);
@ -282,7 +282,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest,
ASSERT_TRUE(callback);
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
Timestamp capture_time = Timestamp::Millis(1234);
TimeDelta sender_capture_time_offsets[] = {TimeDelta::Millis(56),
TimeDelta::Millis(-79)};
@ -320,7 +320,7 @@ TEST(ChannelReceiveFrameTransformerDelegateTest, SetAudioLevel) {
Thread::Current());
delegate->Init();
const uint8_t data[] = {1, 2, 3, 4};
ArrayView<const uint8_t> packet(data, sizeof(data));
std::span<const uint8_t> packet(data, sizeof(data));
std::unique_ptr<TransformableFrameInterface> frame;
ON_CALL(*mock_frame_transformer, Transform)
.WillByDefault(

View File

@ -14,10 +14,10 @@
#include <cstdint>
#include <cstring>
#include <memory>
#include <span>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
@ -142,7 +142,7 @@ class ChannelReceiveTest : public Test {
}
void HandleGeneratedRtcp(ChannelReceiveInterface& /* channel */,
ArrayView<const uint8_t> packet) {
std::span<const uint8_t> packet) {
if (packet[1] == rtcp::ReceiverReport::kPacketType) {
// Ignore RR, it requires no response
} else {
@ -185,7 +185,7 @@ TEST_F(ChannelReceiveTest, ReceiveReportGeneratedOnTime) {
bool receiver_report_sent = false;
EXPECT_CALL(transport_, SendRtcp)
.WillRepeatedly([&](ArrayView<const uint8_t> packet,
.WillRepeatedly([&](std::span<const uint8_t> packet,
const PacketOptions& options) {
if (packet.size() >= 2 &&
packet[1] == rtcp::ReceiverReport::kPacketType) {
@ -205,7 +205,7 @@ TEST_F(ChannelReceiveTest, CaptureStartTimeBecomesValid) {
EXPECT_CALL(transport_, SendRtcp)
.WillRepeatedly(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
HandleGeneratedRtcp(*channel, packet);
return true;
});

View File

@ -16,13 +16,13 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/call/bitrate_allocation.h"
@ -165,7 +165,7 @@ class ChannelSend : public ChannelSendInterface,
void SetInputMute(bool enable) override;
// CSRCs.
void SetCsrcs(ArrayView<const uint32_t> csrcs) override;
void SetCsrcs(std::span<const uint32_t> csrcs) override;
// Stats.
ANAStats GetANAStatistics() const override;
@ -243,9 +243,9 @@ class ChannelSend : public ChannelSendInterface,
int32_t SendRtpAudio(AudioFrameType frameType,
uint8_t payloadType,
uint32_t rtp_timestamp_without_offset,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov)
RTC_RUN_ON(worker_thread_);
@ -418,9 +418,9 @@ int32_t ChannelSend::SendData(AudioFrameType frameType,
int32_t ChannelSend::SendRtpAudio(AudioFrameType frameType,
uint8_t payloadType,
uint32_t rtp_timestamp_without_offset,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov) {
// E2EE Custom Audio Frame Encryption (This is optional).
// Keep this buffer around for the lifetime of the send call.
@ -695,7 +695,7 @@ void ChannelSend::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
RTC_DCHECK_RUN_ON(worker_thread_);
// Deliver RTCP packet to RTP/RTCP module for parsing
rtp_rtcp_->IncomingRtcpPacket(MakeArrayView(data, length));
rtp_rtcp_->IncomingRtcpPacket(std::span(data, length));
std::optional<TimeDelta> rtt = rtp_rtcp_->LastRtt();
if (!rtt.has_value()) {
@ -721,7 +721,7 @@ bool ChannelSend::InputMute() const {
return input_mute_;
}
void ChannelSend::SetCsrcs(ArrayView<const uint32_t> csrcs) {
void ChannelSend::SetCsrcs(std::span<const uint32_t> csrcs) {
RTC_DCHECK_RUN_ON(worker_thread_);
std::vector<uint32_t> csrcs_copy(
csrcs.begin(),
@ -919,7 +919,7 @@ void ChannelSend::ProcessAndEncodeAudio(
rms_level_.AnalyzeMuted(length);
} else {
rms_level_.Analyze(
ArrayView<const int16_t>(audio_frame->data(), length));
std::span<const int16_t>(audio_frame->data(), length));
}
}
previous_frame_muted_ = is_muted;
@ -984,9 +984,9 @@ void ChannelSend::InitFrameTransformerDelegate(
ChannelSendFrameTransformerDelegate::SendFrameCallback send_audio_callback =
[this](AudioFrameType frameType, uint8_t payloadType,
uint32_t rtp_timestamp_with_offset,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov) {
RTC_DCHECK_RUN_ON(worker_thread_);
return SendRtpAudio(

View File

@ -15,10 +15,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -96,7 +96,7 @@ class ChannelSendInterface {
// Sets the list of CSRCs to be included in the RTP header. If more than
// kRtpCsrcSize CSRCs are provided, only the first kRtpCsrcSize elements are
// kept.
virtual void SetCsrcs(ArrayView<const uint32_t> csrcs) = 0;
virtual void SetCsrcs(std::span<const uint32_t> csrcs) = 0;
virtual void ProcessAndEncodeAudio(
std::unique_ptr<AudioFrame> audio_frame) = 0;

View File

@ -14,11 +14,11 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/scoped_refptr.h"
#include "api/sequence_checker.h"
@ -91,8 +91,8 @@ class TransformableOutgoingAudioFrame
sequence_number_(sequence_number),
audio_level_dbov_(audio_level_dbov) {}
~TransformableOutgoingAudioFrame() override = default;
ArrayView<const uint8_t> GetData() const override { return payload_; }
void SetData(ArrayView<const uint8_t> data) override {
std::span<const uint8_t> GetData() const override { return payload_; }
void SetData(std::span<const uint8_t> data) override {
payload_.SetData(data.data(), data.size());
}
uint32_t GetTimestamp() const override { return rtp_timestamp_with_offset_; }
@ -110,7 +110,7 @@ class TransformableOutgoingAudioFrame
Direction GetDirection() const override { return Direction::kSender; }
std::string GetMimeType() const override { return codec_mime_type_; }
ArrayView<const uint32_t> GetContributingSources() const override {
std::span<const uint32_t> GetContributingSources() const override {
return csrcs_;
}

View File

@ -16,10 +16,10 @@
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/scoped_refptr.h"
#include "api/task_queue/task_queue_base.h"
@ -40,9 +40,9 @@ class ChannelSendFrameTransformerDelegate : public TransformedFrameCallback {
std::function<int32_t(AudioFrameType frameType,
uint8_t payloadType,
uint32_t rtp_timestamp_with_offset,
webrtc::ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
webrtc::ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov)>;
ChannelSendFrameTransformerDelegate(
SendFrameCallback send_frame_callback,

View File

@ -13,11 +13,11 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "api/array_view.h"
#include "api/frame_transformer_interface.h"
#include "api/make_ref_counted.h"
#include "api/scoped_refptr.h"
@ -51,16 +51,16 @@ class MockChannelSend {
(AudioFrameType frameType,
uint8_t payloadType,
uint32_t rtp_timestamp,
ArrayView<const uint8_t> payload,
std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov));
ChannelSendFrameTransformerDelegate::SendFrameCallback callback() {
return [this](AudioFrameType frameType, uint8_t payloadType,
uint32_t rtp_timestamp, ArrayView<const uint8_t> payload,
uint32_t rtp_timestamp, std::span<const uint8_t> payload,
int64_t absolute_capture_timestamp_ms,
ArrayView<const uint32_t> csrcs,
std::span<const uint32_t> csrcs,
std::optional<uint8_t> audio_level_dbov) {
return SendFrame(frameType, payloadType, rtp_timestamp, payload,
absolute_capture_timestamp_ms, csrcs, audio_level_dbov);
@ -73,7 +73,7 @@ std::unique_ptr<TransformableAudioFrameInterface> CreateMockReceiverFrame(
std::optional<uint8_t> audio_level_dbov) {
std::unique_ptr<MockTransformableAudioFrame> mock_frame =
std::make_unique<NiceMock<MockTransformableAudioFrame>>();
ArrayView<const uint8_t> payload(mock_data);
std::span<const uint8_t> payload(mock_data);
ON_CALL(*mock_frame, GetData).WillByDefault(Return(payload));
ON_CALL(*mock_frame, GetPayloadType).WillByDefault(Return(0));
ON_CALL(*mock_frame, GetDirection)

View File

@ -14,10 +14,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
@ -155,7 +155,7 @@ TEST_F(ChannelSendTest, IncreaseRtpTimestampByPauseDuration) {
channel_->StartSend();
uint32_t timestamp;
int sent_packets = 0;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
++sent_packets;
RtpPacketReceived packet;
@ -190,7 +190,7 @@ TEST_F(ChannelSendTest, FrameTransformerGetsCorrectTimestamp) {
EXPECT_CALL(*mock_frame_transformer, UnregisterTransformedFrameCallback);
std::optional<uint32_t> sent_timestamp;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
RtpPacketReceived packet;
packet.Parse(data);
@ -239,7 +239,7 @@ TEST_F(ChannelSendTest, AudioLevelsAttachedToCorrectTransformedFrame) {
EXPECT_CALL(*mock_frame_transformer, UnregisterTransformedFrameCallback);
std::vector<uint8_t> sent_audio_levels;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
RtpPacketReceived packet(&extension_manager);
packet.Parse(data);
@ -303,7 +303,7 @@ TEST_F(ChannelSendTest, AudioLevelsAttachedToInsertedTransformedFrame) {
EXPECT_CALL(*mock_frame_transformer, UnregisterTransformedFrameCallback);
std::optional<uint8_t> sent_audio_level;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
RtpPacketReceived packet(&extension_manager);
packet.Parse(data);
@ -323,7 +323,7 @@ TEST_F(ChannelSendTest, AudioLevelsAttachedToInsertedTransformedFrame) {
ON_CALL(*mock_frame, AudioLevel()).WillByDefault(Return(audio_level));
uint8_t payload[10];
ON_CALL(*mock_frame, GetData())
.WillByDefault(Return(ArrayView<uint8_t>(&payload[0], 10)));
.WillByDefault(Return(std::span<uint8_t>(&payload[0], 10)));
EXPECT_THAT(WaitUntil([&] { return callback; }, IsTrue()), IsRtcOk());
callback->OnTransformedFrame(std::move(mock_frame));
@ -415,7 +415,7 @@ TEST_F(ChannelSendTest, ConfiguredCsrcsAreIncludedInRtpPackets) {
channel_->SetCsrcs(expected_csrcs);
std::vector<uint32_t> csrcs;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
RtpPacketReceived packet;
packet.Parse(data);
@ -500,7 +500,7 @@ TEST_F(ChannelSendTest, FrameTransformerTakesPrecedenceOverSetCsrcs) {
channel_->StartSend();
std::vector<uint32_t> sent_csrcs;
auto send_rtp = [&](ArrayView<const uint8_t> data,
auto send_rtp = [&](std::span<const uint8_t> data,
const PacketOptions& /* options */) {
RtpPacketReceived packet;
packet.Parse(data);

View File

@ -16,11 +16,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_encoder.h"
@ -208,7 +208,7 @@ class MockChannelSend : public voe::ChannelSendInterface {
RegisterPacketOverhead,
(int packet_byte_overhead),
(override));
MOCK_METHOD(void, SetCsrcs, (ArrayView<const uint32_t> csrcs), (override));
MOCK_METHOD(void, SetCsrcs, (std::span<const uint32_t> csrcs), (override));
};
} // namespace test
} // namespace webrtc

View File

@ -16,7 +16,6 @@ rtc_library("voip_core") {
deps = [
":audio_channel",
"..:audio",
"../../api:array_view",
"../../api:make_ref_counted",
"../../api:scoped_refptr",
"../../api:transport_api",
@ -43,7 +42,6 @@ rtc_library("audio_channel") {
deps = [
":audio_egress",
":audio_ingress",
"../../api:array_view",
"../../api:ref_count",
"../../api:rtp_headers",
"../../api:scoped_refptr",
@ -67,7 +65,6 @@ rtc_library("audio_ingress") {
]
deps = [
"..:audio",
"../../api:array_view",
"../../api:scoped_refptr",
"../../api/audio:audio_mixer_api",
"../../api/audio_codecs:audio_codecs_api",
@ -97,7 +94,6 @@ rtc_library("audio_egress") {
]
deps = [
"..:audio",
"../../api:array_view",
"../../api:sequence_checker",
"../../api/audio:audio_frame_api",
"../../api/audio_codecs:audio_codecs_api",

View File

@ -15,9 +15,9 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include "api/array_view.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder.h"
@ -83,10 +83,10 @@ class AudioChannel : public RefCountInterface {
// APIs relayed to AudioIngress.
bool IsPlaying() const { return ingress_->IsPlaying(); }
void ReceivedRTPPacket(ArrayView<const uint8_t> rtp_packet) {
void ReceivedRTPPacket(std::span<const uint8_t> rtp_packet) {
ingress_->ReceivedRTPPacket(rtp_packet);
}
void ReceivedRTCPPacket(ArrayView<const uint8_t> rtcp_packet) {
void ReceivedRTCPPacket(std::span<const uint8_t> rtcp_packet) {
ingress_->ReceivedRTCPPacket(rtcp_packet);
}
void SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) {

View File

@ -13,9 +13,9 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include <utility>
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -132,7 +132,7 @@ int32_t AudioEgress::SendData(AudioFrameType frame_type,
size_t payload_size) {
RTC_DCHECK_RUN_ON(&encoder_queue_checker_);
ArrayView<const uint8_t> payload(payload_data, payload_size);
std::span<const uint8_t> payload(payload_data, payload_size);
// Currently we don't get a capture time from downstream modules (ADM,
// AudioTransportImpl).

View File

@ -14,10 +14,10 @@
#include <ctime>
#include <map>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_format.h"
@ -160,7 +160,7 @@ void AudioIngress::SetReceiveCodecs(
neteq_->SetCodecs(codecs);
}
void AudioIngress::ReceivedRTPPacket(ArrayView<const uint8_t> rtp_packet) {
void AudioIngress::ReceivedRTPPacket(std::span<const uint8_t> rtp_packet) {
RtpPacketReceived rtp_packet_received;
rtp_packet_received.Parse(rtp_packet.data(), rtp_packet.size());
@ -204,7 +204,7 @@ void AudioIngress::ReceivedRTPPacket(ArrayView<const uint8_t> rtp_packet) {
const uint8_t* payload = rtp_packet_received.data() + header.headerLength;
size_t payload_length = packet_length - header.headerLength;
size_t payload_data_length = payload_length - header.paddingLength;
auto data_view = ArrayView<const uint8_t>(payload, payload_data_length);
auto data_view = std::span<const uint8_t>(payload, payload_data_length);
// Push the incoming payload (parsed and ready for decoding) into NetEq.
if (!data_view.empty()) {
@ -217,7 +217,7 @@ void AudioIngress::ReceivedRTPPacket(ArrayView<const uint8_t> rtp_packet) {
}
}
void AudioIngress::ReceivedRTCPPacket(ArrayView<const uint8_t> rtcp_packet) {
void AudioIngress::ReceivedRTCPPacket(std::span<const uint8_t> rtcp_packet) {
rtcp::CommonHeader rtcp_header;
if (rtcp_header.Parse(rtcp_packet.data(), rtcp_packet.size()) &&
(rtcp_header.type() == rtcp::SenderReport::kPacketType ||

View File

@ -17,8 +17,8 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include "api/array_view.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_format.h"
@ -72,8 +72,8 @@ class AudioIngress : public AudioMixer::Source {
void SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs);
// APIs to handle received RTP/RTCP packets from caller.
void ReceivedRTPPacket(ArrayView<const uint8_t> rtp_packet);
void ReceivedRTCPPacket(ArrayView<const uint8_t> rtcp_packet);
void ReceivedRTPPacket(std::span<const uint8_t> rtp_packet);
void ReceivedRTCPPacket(std::span<const uint8_t> rtcp_packet);
// See comments on LevelFullRange, TotalEnergy, TotalDuration from
// audio/audio_level.h.

View File

@ -49,7 +49,6 @@ if (rtc_include_tests) {
deps = [
":mock_task_queue",
"..:audio_channel",
"../../../api:array_view",
"../../../api:make_ref_counted",
"../../../api:scoped_refptr",
"../../../api/audio:audio_frame_api",
@ -76,7 +75,6 @@ if (rtc_include_tests) {
deps = [
"..:audio_egress",
"..:audio_ingress",
"../../../api:array_view",
"../../../api:rtp_headers",
"../../../api:scoped_refptr",
"../../../api/audio:audio_frame_api",
@ -102,7 +100,6 @@ if (rtc_include_tests) {
sources = [ "audio_egress_unittest.cc" ]
deps = [
"..:audio_egress",
"../../../api:array_view",
"../../../api:rtp_headers",
"../../../api:scoped_refptr",
"../../../api:transport_api",

View File

@ -14,10 +14,10 @@
#include <cstring>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include "absl/functional/any_invocable.h"
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -120,7 +120,7 @@ class AudioChannelTest : public ::testing::Test {
// Resulted RTP packet is looped back into AudioChannel and gets decoded into
// audio frame to see if it has some signal to indicate its validity.
TEST_F(AudioChannelTest, PlayRtpByLocalLoop) {
auto loop_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto loop_rtp = [&](std::span<const uint8_t> packet, Unused) {
audio_channel_->ReceivedRTPPacket(packet);
return true;
};
@ -145,7 +145,7 @@ TEST_F(AudioChannelTest, PlayRtpByLocalLoop) {
// Validate assigned local SSRC is resulted in RTP packet.
TEST_F(AudioChannelTest, VerifyLocalSsrcAsAssigned) {
RtpPacketReceived rtp;
auto loop_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto loop_rtp = [&](std::span<const uint8_t> packet, Unused) {
rtp.Parse(packet);
return true;
};
@ -160,7 +160,7 @@ TEST_F(AudioChannelTest, VerifyLocalSsrcAsAssigned) {
// Check metrics after processing an RTP packet.
TEST_F(AudioChannelTest, TestIngressStatistics) {
auto loop_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto loop_rtp = [&](std::span<const uint8_t> packet, Unused) {
audio_channel_->ReceivedRTPPacket(packet);
return true;
};
@ -237,11 +237,11 @@ TEST_F(AudioChannelTest, TestIngressStatistics) {
// Check ChannelStatistics metric after processing RTP and RTCP packets.
TEST_F(AudioChannelTest, TestChannelStatistics) {
auto loop_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto loop_rtp = [&](std::span<const uint8_t> packet, Unused) {
audio_channel_->ReceivedRTPPacket(packet);
return true;
};
auto loop_rtcp = [&](ArrayView<const uint8_t> packet, Unused) {
auto loop_rtcp = [&](std::span<const uint8_t> packet, Unused) {
audio_channel_->ReceivedRTCPPacket(packet);
return true;
};
@ -306,7 +306,7 @@ TEST_F(AudioChannelTest, RttIsAvailableAfterChangeOfRemoteSsrc) {
auto send_recv_rtp = [&](scoped_refptr<AudioChannel> rtp_sender,
scoped_refptr<AudioChannel> rtp_receiver) {
// Setup routing logic via transport_.
auto route_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto route_rtp = [&](std::span<const uint8_t> packet, Unused) {
rtp_receiver->ReceivedRTPPacket(packet);
return true;
};
@ -328,7 +328,7 @@ TEST_F(AudioChannelTest, RttIsAvailableAfterChangeOfRemoteSsrc) {
auto send_recv_rtcp = [&](scoped_refptr<AudioChannel> rtcp_sender,
scoped_refptr<AudioChannel> rtcp_receiver) {
// Setup routing logic via transport_.
auto route_rtcp = [&](ArrayView<const uint8_t> packet, Unused) {
auto route_rtcp = [&](std::span<const uint8_t> packet, Unused) {
rtcp_receiver->ReceivedRTCPPacket(packet);
return true;
};

View File

@ -14,8 +14,8 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/audio_codecs/audio_format.h"
@ -131,7 +131,7 @@ TEST_F(AudioEgressTest, ProcessAudioWithMute) {
Event event;
int rtp_count = 0;
RtpPacketReceived rtp;
auto rtp_sent = [&](ArrayView<const uint8_t> packet, Unused) {
auto rtp_sent = [&](std::span<const uint8_t> packet, Unused) {
rtp.Parse(packet);
if (++rtp_count == kExpected) {
event.Set();
@ -169,7 +169,7 @@ TEST_F(AudioEgressTest, ProcessAudioWithSineWave) {
Event event;
int rtp_count = 0;
RtpPacketReceived rtp;
auto rtp_sent = [&](ArrayView<const uint8_t> packet, Unused) {
auto rtp_sent = [&](std::span<const uint8_t> packet, Unused) {
rtp.Parse(packet);
if (++rtp_count == kExpected) {
event.Set();
@ -204,7 +204,7 @@ TEST_F(AudioEgressTest, SkipAudioEncodingAfterStopSend) {
constexpr int kExpected = 10;
Event event;
int rtp_count = 0;
auto rtp_sent = [&](ArrayView<const uint8_t> /* packet */, Unused) {
auto rtp_sent = [&](std::span<const uint8_t> /* packet */, Unused) {
if (++rtp_count == kExpected) {
event.Set();
}
@ -278,7 +278,7 @@ TEST_F(AudioEgressTest, SendDTMF) {
// It's possible that we may have actual audio RTP packets along with
// DTMF packtets. We are only interested in the exact number of DTMF
// packets rtp stack is emitting.
auto rtp_sent = [&](ArrayView<const uint8_t> packet, Unused) {
auto rtp_sent = [&](std::span<const uint8_t> packet, Unused) {
RtpPacketReceived rtp;
rtp.Parse(packet);
if (is_dtmf(rtp) && ++dtmf_count == kExpected) {
@ -305,7 +305,7 @@ TEST_F(AudioEgressTest, TestAudioInputLevelAndEnergyDuration) {
constexpr int kExpected = 6;
Event event;
int rtp_count = 0;
auto rtp_sent = [&](ArrayView<const uint8_t> /* packet */, Unused) {
auto rtp_sent = [&](std::span<const uint8_t> /* packet */, Unused) {
if (++rtp_count == kExpected) {
event.Set();
}

View File

@ -13,8 +13,8 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <span>
#include "api/array_view.h"
#include "api/audio/audio_frame.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -125,7 +125,7 @@ TEST_F(AudioIngressTest, PlayingAfterStartAndStop) {
TEST_F(AudioIngressTest, GetAudioFrameAfterRtpReceived) {
Event event;
auto handle_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto handle_rtp = [&](std::span<const uint8_t> packet, Unused) {
ingress_->ReceivedRTPPacket(packet);
event.Set();
return true;
@ -155,7 +155,7 @@ TEST_F(AudioIngressTest, TestSpeechOutputLevelAndEnergyDuration) {
constexpr int kNumRtp = 6;
int rtp_count = 0;
Event event;
auto handle_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto handle_rtp = [&](std::span<const uint8_t> packet, Unused) {
ingress_->ReceivedRTPPacket(packet);
if (++rtp_count == kNumRtp) {
event.Set();
@ -186,7 +186,7 @@ TEST_F(AudioIngressTest, TestSpeechOutputLevelAndEnergyDuration) {
TEST_F(AudioIngressTest, PreferredSampleRate) {
Event event;
auto handle_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto handle_rtp = [&](std::span<const uint8_t> packet, Unused) {
ingress_->ReceivedRTPPacket(packet);
event.Set();
return true;
@ -215,7 +215,7 @@ TEST_F(AudioIngressTest, GetMutedAudioFrameAfterRtpReceivedAndStopPlay) {
constexpr int kNumRtp = 6;
int rtp_count = 0;
Event event;
auto handle_rtp = [&](ArrayView<const uint8_t> packet, Unused) {
auto handle_rtp = [&](std::span<const uint8_t> packet, Unused) {
ingress_->ReceivedRTPPacket(packet);
if (++rtp_count == kNumRtp) {
event.Set();

View File

@ -16,10 +16,10 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_device.h"
#include "api/audio/audio_processing.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -367,7 +367,7 @@ VoipResult VoipCore::StopPlayout(ChannelId channel_id) {
}
VoipResult VoipCore::ReceivedRTPPacket(ChannelId channel_id,
ArrayView<const uint8_t> rtp_packet) {
std::span<const uint8_t> rtp_packet) {
scoped_refptr<AudioChannel> channel = GetChannel(channel_id);
if (!channel) {
@ -380,7 +380,7 @@ VoipResult VoipCore::ReceivedRTPPacket(ChannelId channel_id,
}
VoipResult VoipCore::ReceivedRTCPPacket(ChannelId channel_id,
ArrayView<const uint8_t> rtcp_packet) {
std::span<const uint8_t> rtcp_packet) {
scoped_refptr<AudioChannel> channel = GetChannel(channel_id);
if (!channel) {

View File

@ -15,9 +15,9 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <unordered_map>
#include "api/array_view.h"
#include "api/audio/audio_device.h"
#include "api/audio/audio_mixer.h"
#include "api/audio/audio_processing.h"
@ -81,9 +81,9 @@ class VoipCore : public VoipEngine,
// Implements VoipNetwork interfaces.
VoipResult ReceivedRTPPacket(ChannelId channel_id,
ArrayView<const uint8_t> rtp_packet) override;
std::span<const uint8_t> rtp_packet) override;
VoipResult ReceivedRTCPPacket(ChannelId channel_id,
ArrayView<const uint8_t> rtcp_packet) override;
std::span<const uint8_t> rtcp_packet) override;
// Implements VoipCodec interfaces.
VoipResult SetSendCodec(ChannelId channel_id,

View File

@ -109,7 +109,6 @@ rtc_library("rtp_interfaces") {
"rtp_transport_controller_send_interface.h",
]
deps = [
"../api:array_view",
"../api:fec_controller_api",
"../api:frame_transformer_interface",
"../api:network_state_predictor_api",
@ -148,7 +147,6 @@ rtc_library("rtp_receiver") {
]
deps = [
":rtp_interfaces",
"../api:array_view",
"../api:sequence_checker",
"../api/environment",
"../logging:rtc_event_rtp_rtcp",
@ -178,7 +176,6 @@ rtc_library("rtp_sender") {
deps = [
":bitrate_configurator",
":rtp_interfaces",
"../api:array_view",
"../api:bitrate_allocation",
"../api:fec_controller_api",
"../api:field_trials_view",
@ -306,7 +303,6 @@ rtc_library("call") {
":version",
":video_receive_stream_api",
":video_send_stream_api",
"../api:array_view",
"../api:fec_controller_api",
"../api:field_trials_view",
"../api:rtp_headers",
@ -407,7 +403,6 @@ rtc_library("video_send_stream_api") {
]
deps = [
":rtp_interfaces",
"../api:array_view",
"../api:frame_transformer_interface",
"../api:rtp_parameters",
"../api:rtp_sender_interface",
@ -474,7 +469,6 @@ rtc_library("fake_network") {
]
deps = [
":simulated_packet_receiver",
"../api:array_view",
"../api:rtp_parameters",
"../api:simulated_network_api",
"../api:transport_api",
@ -521,7 +515,6 @@ if (rtc_include_tests) {
":rtp_sender",
":video_receive_stream_api",
":video_send_stream_api",
"../api:array_view",
"../api:bitrate_allocation",
"../api:create_frame_generator",
"../api:field_trials",
@ -625,7 +618,6 @@ if (rtc_include_tests) {
":fake_network",
":video_receive_stream_api",
":video_send_stream_api",
"../api:array_view",
"../api:field_trials_view",
"../api:make_ref_counted",
"../api:rtc_event_log_output_file",

View File

@ -18,6 +18,7 @@
#include <memory>
#include <optional>
#include <set>
#include <span>
#include <string>
#include <utility>
#include <vector>
@ -25,7 +26,6 @@
#include "absl/functional/bind_front.h"
#include "absl/strings/string_view.h"
#include "api/adaptation/resource.h"
#include "api/array_view.h"
#include "api/environment/environment.h"
#include "api/fec_controller.h"
#include "api/media_types.h"
@ -1343,7 +1343,7 @@ void Call::DeliverRtcpPacket(CopyOnWriteBuffer packet) {
receive_stats_.AddReceivedRtcpBytes(static_cast<int>(packet.size()));
bool rtcp_delivered = false;
ArrayView<const uint8_t> packet_view(packet.cdata(), packet.size());
std::span<const uint8_t> packet_view(packet.cdata(), packet.size());
for (VideoReceiveStream2* stream : video_receive_streams_) {
if (stream->DeliverRtcp(packet_view))
rtcp_delivered = true;

View File

@ -16,13 +16,13 @@
#include <limits>
#include <map>
#include <memory>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/flags/flag.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/audio/audio_device.h"
#include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
@ -566,7 +566,7 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
private:
// TODO(holmer): Run this with a timer instead of once per packet.
Action OnSendRtp(ArrayView<const uint8_t> /* packet */) override {
Action OnSendRtp(std::span<const uint8_t> /* packet */) override {
task_queue_->PostTask(SafeTask(task_safety_flag_, [this]() {
VideoSendStream::Stats stats = send_stream_->GetStats();
@ -1021,7 +1021,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
}
}
Action OnSendRtp(ArrayView<const uint8_t> /* packet */) override {
Action OnSendRtp(std::span<const uint8_t> /* packet */) override {
const Timestamp now = clock_->CurrentTime();
if (now - last_getstats_time_ > kMinGetStatsInterval) {
last_getstats_time_ = now;

View File

@ -16,10 +16,10 @@
#include <memory>
#include <optional>
#include <queue>
#include <span>
#include <utility>
#include <vector>
#include "api/array_view.h"
#include "api/call/transport.h"
#include "api/media_types.h"
#include "api/test/simulated_network.h"
@ -142,7 +142,7 @@ void FakeNetworkPipe::RemoveActiveTransport(Transport* transport) {
}
}
bool FakeNetworkPipe::SendRtp(ArrayView<const uint8_t> packet,
bool FakeNetworkPipe::SendRtp(std::span<const uint8_t> packet,
const PacketOptions& options,
Transport* transport) {
RTC_DCHECK(transport);
@ -150,7 +150,7 @@ bool FakeNetworkPipe::SendRtp(ArrayView<const uint8_t> packet,
return true;
}
bool FakeNetworkPipe::SendRtcp(ArrayView<const uint8_t> packet,
bool FakeNetworkPipe::SendRtcp(std::span<const uint8_t> packet,
Transport* transport) {
RTC_DCHECK(transport);
EnqueuePacket(CopyOnWriteBuffer(packet), std::nullopt, true, transport);
@ -322,10 +322,10 @@ void FakeNetworkPipe::DeliverNetworkPacket(NetworkPacket* packet) {
return;
}
if (packet->is_rtcp()) {
transport->SendRtcp(MakeArrayView(packet->data(), packet->data_length()),
transport->SendRtcp(std::span(packet->data(), packet->data_length()),
packet->packet_options());
} else {
transport->SendRtp(MakeArrayView(packet->data(), packet->data_length()),
transport->SendRtp(std::span(packet->data(), packet->data_length()),
packet->packet_options());
}
} else if (receiver_) {

View File

@ -17,8 +17,8 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include "api/array_view.h"
#include "api/call/transport.h"
#include "api/test/simulated_network.h"
#include "call/simulated_packet_receiver.h"
@ -133,10 +133,10 @@ class FakeNetworkPipe : public SimulatedPacketReceiverInterface {
// Methods for use with Transport interface. When/if packets are delivered,
// they will be passed to the instance specified by the `transport` parameter.
// Note that that instance must be in the map of active transports.
bool SendRtp(ArrayView<const uint8_t> packet,
bool SendRtp(std::span<const uint8_t> packet,
const PacketOptions& options,
Transport* transport);
bool SendRtcp(ArrayView<const uint8_t> packet, Transport* transport);
bool SendRtcp(std::span<const uint8_t> packet, Transport* transport);
// Implements the PacketReceiver interface. When/if packets are delivered,
// they will be passed directly to the receiver instance given in

View File

@ -14,7 +14,6 @@
#include <memory>
#include <string>
#include "api/array_view.h"
#include "api/environment/environment.h"
#include "api/sequence_checker.h"
#include "call/flexfec_receive_stream.h"

View File

@ -12,9 +12,9 @@
#include <cstdint>
#include <memory>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/call/transport.h"
#include "api/environment/environment_factory.h"
#include "api/rtp_headers.h"
@ -52,7 +52,7 @@ FlexfecReceiveStream::Config CreateDefaultConfig(
return config;
}
RtpPacketReceived ParsePacket(ArrayView<const uint8_t> packet) {
RtpPacketReceived ParsePacket(std::span<const uint8_t> packet) {
RtpPacketReceived parsed_packet(nullptr);
EXPECT_TRUE(parsed_packet.Parse(packet));
return parsed_packet;

View File

@ -19,7 +19,6 @@
#include <vector>
#include "absl/algorithm/container.h"
#include "api/array_view.h"
#include "api/rtp_headers.h"
#include "rtc_base/checks.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -14,12 +14,12 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/call/transport.h"
#include "api/fec_controller.h"
#include "api/frame_transformer_interface.h"
@ -898,7 +898,7 @@ void RtpTransportControllerSend::PostUpdates(NetworkControlUpdate update) {
void RtpTransportControllerSend::OnReport(
Timestamp receive_time,
ArrayView<const ReportBlockData> report_blocks) {
std::span<const ReportBlockData> report_blocks) {
RTC_DCHECK_RUN_ON(&sequence_checker_);
if (report_blocks.empty())
return;

View File

@ -16,11 +16,11 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/environment/environment.h"
#include "api/fec_controller.h"
#include "api/frame_transformer_interface.h"
@ -129,7 +129,7 @@ class RtpTransportControllerSend final
void OnReceiverEstimatedMaxBitrate(Timestamp receive_time,
DataRate bitrate) override;
void OnReport(Timestamp receive_time,
ArrayView<const ReportBlockData> report_blocks) override;
std::span<const ReportBlockData> report_blocks) override;
void OnRttUpdate(Timestamp receive_time, TimeDelta rtt) override;
void OnTransportFeedback(Timestamp receive_time,
const rtcp::TransportFeedback& feedback) override;

View File

@ -17,6 +17,7 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
@ -24,7 +25,6 @@
#include "absl/algorithm/container.h"
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/crypto/crypto_options.h"
#include "api/environment/environment.h"
@ -719,7 +719,7 @@ DataRate RtpVideoSender::GetPostEncodeOverhead() const {
return post_encode_overhead;
}
void RtpVideoSender::DeliverRtcp(ArrayView<const uint8_t> packet) {
void RtpVideoSender::DeliverRtcp(std::span<const uint8_t> packet) {
// Runs on a network thread.
for (const RtpStreamSender& stream : rtp_streams_)
stream.rtp_rtcp->IncomingRtcpPacket(packet);
@ -920,7 +920,7 @@ uint32_t RtpVideoSender::GetProtectionBitrateBps() const {
std::vector<RtpSequenceNumberMap::Info> RtpVideoSender::GetSentRtpPacketInfos(
uint32_t ssrc,
ArrayView<const uint16_t> sequence_numbers) const {
std::span<const uint16_t> sequence_numbers) const {
for (const auto& rtp_stream : rtp_streams_) {
if (ssrc == rtp_stream.rtp_rtcp->SSRC()) {
return rtp_stream.rtp_rtcp->GetSentRtpPacketInfos(sequence_numbers);
@ -1015,7 +1015,7 @@ void RtpVideoSender::OnPacketFeedbackVector(
// clean up anyway.
continue;
}
ArrayView<const uint16_t> rtp_sequence_numbers(kv.second);
std::span<const uint16_t> rtp_sequence_numbers(kv.second);
it->second->OnPacketsAcknowledged(rtp_sequence_numbers);
}
}
@ -1027,7 +1027,7 @@ void RtpVideoSender::SetEncodingData(size_t width,
rtp_config_.max_packet_size);
}
void RtpVideoSender::SetCsrcs(ArrayView<const uint32_t> csrcs) {
void RtpVideoSender::SetCsrcs(std::span<const uint32_t> csrcs) {
MutexLock lock(&mutex_);
csrcs_.assign(csrcs.begin(),
csrcs.begin() + std::min<size_t>(csrcs.size(), kRtpCsrcSize));

View File

@ -15,10 +15,10 @@
#include <cstdint>
#include <map>
#include <memory>
#include <span>
#include <vector>
#include "absl/base/nullability.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
@ -113,7 +113,7 @@ class RtpVideoSender : public RtpVideoSenderInterface,
std::map<uint32_t, RtpPayloadState> GetRtpPayloadStates() const
RTC_LOCKS_EXCLUDED(mutex_) override;
void DeliverRtcp(ArrayView<const uint8_t> packet)
void DeliverRtcp(std::span<const uint8_t> packet)
RTC_LOCKS_EXCLUDED(mutex_) override;
// Implements webrtc::VCMProtectionCallback.
int ProtectionRequest(const FecProtectionParams* delta_params,
@ -158,12 +158,12 @@ class RtpVideoSender : public RtpVideoSenderInterface,
// Sets the list of CSRCs to be included in every packet. If more than
// kRtpCsrcSize CSRCs are provided, only the first kRtpCsrcSize elements are
// kept.
void SetCsrcs(ArrayView<const uint32_t> csrcs)
void SetCsrcs(std::span<const uint32_t> csrcs)
RTC_LOCKS_EXCLUDED(mutex_) override;
std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos(
uint32_t ssrc,
ArrayView<const uint16_t> sequence_numbers) const
std::span<const uint16_t> sequence_numbers) const
RTC_LOCKS_EXCLUDED(mutex_) override;
// From StreamFeedbackObserver.

View File

@ -14,9 +14,9 @@
#include <cstddef>
#include <cstdint>
#include <map>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/fec_controller_override.h"
#include "api/video/video_layers_allocation.h"
@ -40,7 +40,7 @@ class RtpVideoSenderInterface : public EncodedImageCallback,
virtual std::map<uint32_t, RtpState> GetRtpStates() const = 0;
virtual std::map<uint32_t, RtpPayloadState> GetRtpPayloadStates() const = 0;
virtual void DeliverRtcp(ArrayView<const uint8_t> packet) = 0;
virtual void DeliverRtcp(std::span<const uint8_t> packet) = 0;
virtual void OnBitrateAllocationUpdated(
const VideoBitrateAllocation& bitrate) = 0;
@ -55,10 +55,10 @@ class RtpVideoSenderInterface : public EncodedImageCallback,
virtual void SetEncodingData(size_t width,
size_t height,
size_t num_temporal_layers) = 0;
virtual void SetCsrcs(ArrayView<const uint32_t> csrcs) = 0;
virtual void SetCsrcs(std::span<const uint32_t> csrcs) = 0;
virtual std::vector<RtpSequenceNumberMap::Info> GetSentRtpPacketInfos(
uint32_t ssrc,
ArrayView<const uint16_t> sequence_numbers) const = 0;
std::span<const uint16_t> sequence_numbers) const = 0;
// Implements FecControllerOverride.
void SetFecAllowed(bool fec_allowed) override = 0;

View File

@ -15,10 +15,10 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <vector>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
@ -137,7 +137,7 @@ VideoSendStream::Config CreateVideoSendStreamConfig(
const std::vector<uint32_t>& ssrcs,
const std::vector<uint32_t>& rtx_ssrcs,
int payload_type,
ArrayView<const int> payload_types) {
std::span<const int> payload_types) {
VideoSendStream::Config config(transport);
config.rtp.ssrcs = ssrcs;
config.rtp.rtx.ssrcs = rtx_ssrcs;
@ -511,7 +511,7 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
.Times(2)
.WillRepeatedly(
[&rtp_sequence_numbers, &transport_sequence_numbers](
ArrayView<const uint8_t> packet, const PacketOptions& options) {
std::span<const uint8_t> packet, const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
rtp_sequence_numbers.push_back(rtp_packet.SequenceNumber());
@ -537,13 +537,13 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
EXPECT_CALL(test.transport(), SendRtp)
.Times(2)
.WillRepeatedly([&retransmitted_rtp_sequence_numbers](
ArrayView<const uint8_t> packet,
std::span<const uint8_t> packet,
const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
// Capture the retransmitted sequence number from the RTX header.
ArrayView<const uint8_t> payload = rtp_packet.payload();
std::span<const uint8_t> payload = rtp_packet.payload();
retransmitted_rtp_sequence_numbers.push_back(
ByteReader<uint16_t>::ReadBigEndian(payload.data()));
return true;
@ -578,13 +578,13 @@ TEST(RtpVideoSenderTest, DoesNotRetrasmitAckedPackets) {
// still be retransmitted.
test.AdvanceTime(TimeDelta::Millis(33));
EXPECT_CALL(test.transport(), SendRtp)
.WillOnce([&lost_packet_feedback](ArrayView<const uint8_t> packet,
.WillOnce([&lost_packet_feedback](std::span<const uint8_t> packet,
const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
// Capture the retransmitted sequence number from the RTX header.
ArrayView<const uint8_t> payload = rtp_packet.payload();
std::span<const uint8_t> payload = rtp_packet.payload();
EXPECT_EQ(lost_packet_feedback.rtp_sequence_number,
ByteReader<uint16_t>::ReadBigEndian(payload.data()));
return true;
@ -681,7 +681,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
EXPECT_CALL(test.transport(), SendRtp)
.WillOnce(
[&frame1_rtp_sequence_number, &frame1_transport_sequence_number](
ArrayView<const uint8_t> packet, const PacketOptions& options) {
std::span<const uint8_t> packet, const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
frame1_rtp_sequence_number = rtp_packet.SequenceNumber();
@ -700,7 +700,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
EXPECT_CALL(test.transport(), SendRtp)
.WillOnce(
[&frame2_rtp_sequence_number, &frame2_transport_sequence_number](
ArrayView<const uint8_t> packet, const PacketOptions& options) {
std::span<const uint8_t> packet, const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
frame2_rtp_sequence_number = rtp_packet.SequenceNumber();
@ -717,7 +717,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
// Inject a transport feedback where the packet for the first frame is lost,
// expect a retransmission for it.
EXPECT_CALL(test.transport(), SendRtp)
.WillOnce([&frame1_rtp_sequence_number](ArrayView<const uint8_t> packet,
.WillOnce([&frame1_rtp_sequence_number](std::span<const uint8_t> packet,
const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
@ -725,7 +725,7 @@ TEST(RtpVideoSenderTest, EarlyRetransmits) {
// Retransmitted sequence number from the RTX header should match
// the lost packet.
ArrayView<const uint8_t> payload = rtp_packet.payload();
std::span<const uint8_t> payload = rtp_packet.payload();
EXPECT_EQ(ByteReader<uint16_t>::ReadBigEndian(payload.data()),
frame1_rtp_sequence_number);
return true;
@ -760,7 +760,7 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptor) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -824,7 +824,7 @@ TEST(RtpVideoSenderTest, SimulcastIndependentFrameIds) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -883,7 +883,7 @@ TEST(RtpVideoSenderTest,
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -938,7 +938,7 @@ TEST(RtpVideoSenderTest, MixedCodecSimulcastPayloadType) {
std::vector<RtpPacket> sent_packets;
EXPECT_CALL(test.transport(), SendRtp)
.Times(3)
.WillRepeatedly([&](ArrayView<const uint8_t> packet,
.WillRepeatedly([&](std::span<const uint8_t> packet,
const PacketOptions& options) -> bool {
RtpPacket& rtp_packet = sent_packets.emplace_back();
EXPECT_TRUE(rtp_packet.Parse(packet));
@ -983,7 +983,7 @@ TEST(RtpVideoSenderTest, MixedCodecSimulcastPayloadType) {
EXPECT_CALL(test.transport(), SendRtp)
.Times(3)
.WillRepeatedly(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
RtpPacket& rtp_packet = sent_rtx_packets.emplace_back();
EXPECT_TRUE(rtp_packet.Parse(packet));
return true;
@ -1009,7 +1009,7 @@ TEST(RtpVideoSenderTest,
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions&) {
[&](std::span<const uint8_t> packet, const PacketOptions&) {
EXPECT_TRUE(sent_packets.emplace_back(&extensions).Parse(packet));
return true;
});
@ -1055,7 +1055,7 @@ TEST(RtpVideoSenderTest, SupportsDependencyDescriptorForVp9) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1111,7 +1111,7 @@ TEST(RtpVideoSenderTest,
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1165,7 +1165,7 @@ TEST(RtpVideoSenderTest,
std::vector<RtpPacket> sent_packets;
EXPECT_CALL(test.transport(), SendRtp(_, _))
.Times(2)
.WillRepeatedly([&](ArrayView<const uint8_t> packet,
.WillRepeatedly([&](std::span<const uint8_t> packet,
const PacketOptions& options) -> bool {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
@ -1223,7 +1223,7 @@ TEST(RtpVideoSenderTest, GenerateDependecyDescriptorForGenericCodecs) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1269,7 +1269,7 @@ TEST(RtpVideoSenderTest, SupportsStoppingUsingDependencyDescriptor) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1381,7 +1381,7 @@ TEST(RtpVideoSenderTest, ClearsPendingPacketsOnInactivation) {
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1459,7 +1459,7 @@ TEST(RtpVideoSenderTest,
std::vector<RtpPacket> sent_packets;
ON_CALL(test.transport(), SendRtp)
.WillByDefault(
[&](ArrayView<const uint8_t> packet, const PacketOptions& options) {
[&](std::span<const uint8_t> packet, const PacketOptions& options) {
sent_packets.emplace_back(&extensions);
EXPECT_TRUE(sent_packets.back().Parse(packet));
return true;
@ -1552,7 +1552,7 @@ TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) {
.Times(2)
.WillRepeatedly(
[&rtp_sequence_numbers, &transport_sequence_numbers](
ArrayView<const uint8_t> packet, const PacketOptions& options) {
std::span<const uint8_t> packet, const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
rtp_sequence_numbers.push_back(rtp_packet.SequenceNumber());
@ -1587,13 +1587,13 @@ TEST(RtpVideoSenderTest, RetransmitsBaseLayerOnly) {
EXPECT_CALL(test.transport(), SendRtp)
.Times(1)
.WillRepeatedly([&retransmitted_rtp_sequence_numbers](
ArrayView<const uint8_t> packet,
std::span<const uint8_t> packet,
const PacketOptions& options) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet));
EXPECT_EQ(rtp_packet.Ssrc(), kRtxSsrc1);
// Capture the retransmitted sequence number from the RTX header.
ArrayView<const uint8_t> payload = rtp_packet.payload();
std::span<const uint8_t> payload = rtp_packet.payload();
retransmitted_rtp_sequence_numbers.push_back(
ByteReader<uint16_t>::ReadBigEndian(payload.data()));
return true;

View File

@ -14,9 +14,9 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <utility>
#include "api/array_view.h"
#include "api/environment/environment.h"
#include "api/sequence_checker.h"
#include "call/rtp_packet_sink_interface.h"
@ -78,7 +78,7 @@ void RtxReceiveStream::OnRtpPacket(const RtpPacketReceived& rtx_packet) {
if (rtp_receive_statistics_) {
rtp_receive_statistics_->OnRtpPacket(rtx_packet);
}
ArrayView<const uint8_t> payload = rtx_packet.payload();
std::span<const uint8_t> payload = rtx_packet.payload();
if (payload.size() < kRtxHeaderSize) {
LogRtpPacketToEventLog(rtx_packet, /*osn=*/std::nullopt);

View File

@ -14,8 +14,8 @@
#include <cstdint>
#include <cstring>
#include <map>
#include <span>
#include "api/array_view.h"
#include "api/environment/environment.h"
#include "api/rtc_event_log/rtc_event.h"
#include "api/units/timestamp.h"
@ -123,7 +123,7 @@ std::map<int, int> PayloadTypeMapping() {
}
template <typename T>
ArrayView<T> Truncate(ArrayView<T> a, size_t drop) {
std::span<T> Truncate(std::span<T> a, size_t drop) {
return a.subspan(0, a.size() - drop);
}
@ -134,7 +134,7 @@ TEST(RtxReceiveStreamTest, RestoresPacketPayload) {
Environment env = CreateTestEnvironment();
RtxReceiveStream rtx_sink(env, &media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacket)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacket)));
EXPECT_CALL(media_sink, OnRtpPacket)
.WillOnce([](const RtpPacketReceived& packet) {
@ -152,7 +152,7 @@ TEST(RtxReceiveStreamTest, SetsRecoveredFlag) {
Environment env = CreateTestEnvironment();
RtxReceiveStream rtx_sink(env, &media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacket)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacket)));
EXPECT_FALSE(rtx_packet.recovered());
EXPECT_CALL(media_sink, OnRtpPacket)
.WillOnce([](const RtpPacketReceived& packet) {
@ -171,7 +171,7 @@ TEST(RtxReceiveStreamTest, IgnoresUnknownPayloadType) {
Environment env = CreateTestEnvironment({.event_log = &log});
RtxReceiveStream rtx_sink(env, &media_sink, payload_type_mapping, kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacket)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacket)));
EXPECT_CALL(log, LogProxy(_));
rtx_sink.OnRtpPacket(rtx_packet);
}
@ -183,7 +183,7 @@ TEST(RtxReceiveStreamTest, IgnoresTruncatedPacket) {
RtxReceiveStream rtx_sink(env, &media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(
rtx_packet.Parse(Truncate(ArrayView<const uint8_t>(kRtxPacket), 2)));
rtx_packet.Parse(Truncate(std::span<const uint8_t>(kRtxPacket), 2)));
EXPECT_CALL(log, LogProxy(_));
rtx_sink.OnRtpPacket(rtx_packet);
}
@ -195,7 +195,7 @@ TEST(RtxReceiveStreamTest, CopiesRtpHeaderExtensions) {
RtpHeaderExtensionMap extension_map;
extension_map.RegisterByType(3, kRtpExtensionVideoRotation);
RtpPacketReceived rtx_packet(&extension_map);
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacketWithCVO)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacketWithCVO)));
VideoRotation rotation = kVideoRotation_0;
EXPECT_TRUE(rtx_packet.GetExtension<VideoOrientation>(&rotation));
@ -220,7 +220,7 @@ TEST(RtxReceiveStreamTest, PropagatesArrivalTime) {
Environment env = CreateTestEnvironment();
RtxReceiveStream rtx_sink(env, &media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet(nullptr);
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacket)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacket)));
rtx_packet.set_arrival_time(Timestamp::Millis(123));
EXPECT_CALL(media_sink, OnRtpPacket(Property(&RtpPacketReceived::arrival_time,
Timestamp::Millis(123))));
@ -236,14 +236,14 @@ TEST(RtxReceiveStreamTest, SupportsLargePacket) {
constexpr int kRtxPayloadOffset = 14;
uint8_t large_rtx_packet[kRtxPacketSize];
memcpy(large_rtx_packet, kRtxPacket, sizeof(kRtxPacket));
ArrayView<uint8_t> payload(large_rtx_packet + kRtxPayloadOffset,
std::span<uint8_t> payload(large_rtx_packet + kRtxPayloadOffset,
kRtxPacketSize - kRtxPayloadOffset);
// Fill payload.
for (size_t i = 0; i < payload.size(); i++) {
payload[i] = i;
}
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(large_rtx_packet)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(large_rtx_packet)));
EXPECT_CALL(media_sink, OnRtpPacket)
.WillOnce([&](const RtpPacketReceived& packet) {
@ -267,10 +267,10 @@ TEST(RtxReceiveStreamTest, SupportsLargePacketWithPadding) {
uint8_t large_rtx_packet[kRtxPacketSize];
memcpy(large_rtx_packet, kRtxPacketWithPadding,
sizeof(kRtxPacketWithPadding));
ArrayView<uint8_t> payload(
std::span<uint8_t> payload(
large_rtx_packet + kRtxPayloadOffset,
kRtxPacketSize - kRtxPayloadOffset - kRtxPaddingSize);
ArrayView<uint8_t> padding(
std::span<uint8_t> padding(
large_rtx_packet + kRtxPacketSize - kRtxPaddingSize, kRtxPaddingSize);
// Fill payload.
@ -282,7 +282,7 @@ TEST(RtxReceiveStreamTest, SupportsLargePacketWithPadding) {
padding[i] = kRtxPaddingSize;
}
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(large_rtx_packet)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(large_rtx_packet)));
EXPECT_CALL(media_sink, OnRtpPacket)
.WillOnce([&](const RtpPacketReceived& packet) {
@ -314,7 +314,7 @@ TEST(RtxReceiveStreamTest, LogsRtpPacketIncoming) {
Environment env = CreateTestEnvironment({.event_log = &log});
RtxReceiveStream rtx_sink(env, &media_sink, PayloadTypeMapping(), kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(rtx_packet.Parse(ArrayView<const uint8_t>(kRtxPacket)));
EXPECT_TRUE(rtx_packet.Parse(std::span<const uint8_t>(kRtxPacket)));
EXPECT_CALL(log, LogProxy(IsRtcEventRtpPacketIncomingPtrWithSsrcAndOsn(
kRtxSSRC, kMediaSeqno)));

View File

@ -15,11 +15,11 @@
#include <map>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "api/adaptation/resource.h"
#include "api/array_view.h"
#include "api/call/transport.h"
#include "api/crypto/crypto_options.h"
#include "api/frame_transformer_interface.h"
@ -264,7 +264,7 @@ class VideoSendStream {
virtual void SetStats(const Stats& stats) { RTC_CHECK_NOTREACHED(); }
// Sets the list of CSRCs to be included in every packet.
virtual void SetCsrcs(ArrayView<const uint32_t> csrcs) = 0;
virtual void SetCsrcs(std::span<const uint32_t> csrcs) = 0;
virtual void GenerateKeyFrame(const std::vector<std::string>& rids) = 0;

View File

@ -45,7 +45,6 @@ rtc_library("common_audio") {
deps = [
":common_audio_c",
":sinc_resampler",
"../api:array_view",
"../api/audio:audio_frame_api",
"../api/units:timestamp",
"../rtc_base:checks",

View File

@ -14,9 +14,9 @@
#include <cstdint>
#include <cstring>
#include <memory>
#include <span>
#include <vector>
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "rtc_base/checks.h"
@ -89,19 +89,19 @@ class ChannelBuffer {
num_channels_(num_channels),
num_bands_(num_bands),
bands_view_(num_allocated_channels_,
std::vector<ArrayView<T>>(num_bands_)),
std::vector<std::span<T>>(num_bands_)),
channels_view_(num_bands_,
std::vector<ArrayView<T>>(num_allocated_channels_)) {
std::vector<std::span<T>>(num_allocated_channels_)) {
// Temporarily cast away const_ness to allow populating the array views.
auto* bands_view =
const_cast<std::vector<std::vector<ArrayView<T>>>*>(&bands_view_);
const_cast<std::vector<std::vector<std::span<T>>>*>(&bands_view_);
auto* channels_view =
const_cast<std::vector<std::vector<ArrayView<T>>>*>(&channels_view_);
const_cast<std::vector<std::vector<std::span<T>>>*>(&channels_view_);
for (size_t ch = 0; ch < num_allocated_channels_; ++ch) {
for (size_t band = 0; band < num_bands_; ++band) {
(*channels_view)[band][ch] =
ArrayView<T>(&data_[ch * num_frames_ + band * num_frames_per_band_],
std::span<T>(&data_[ch * num_frames_ + band * num_frames_per_band_],
num_frames_per_band_);
(*bands_view)[ch][band] = channels_view_[band][ch];
channels_[band * num_allocated_channels_ + ch] =
@ -133,10 +133,10 @@ class ChannelBuffer {
const ChannelBuffer<T>* t = this;
return const_cast<T* const*>(t->channels(band));
}
ArrayView<const ArrayView<T>> channels_view(size_t band = 0) {
std::span<const std::span<T>> channels_view(size_t band = 0) {
return channels_view_[band];
}
ArrayView<const ArrayView<T>> channels_view(size_t band = 0) const {
std::span<const std::span<T>> channels_view(size_t band = 0) const {
return channels_view_[band];
}
@ -157,10 +157,10 @@ class ChannelBuffer {
return const_cast<T* const*>(t->bands(channel));
}
ArrayView<const ArrayView<T>> bands_view(size_t channel) {
std::span<const std::span<T>> bands_view(size_t channel) {
return bands_view_[channel];
}
ArrayView<const ArrayView<T>> bands_view(size_t channel) const {
std::span<const std::span<T>> bands_view(size_t channel) const {
return bands_view_[channel];
}
@ -204,8 +204,8 @@ class ChannelBuffer {
// Number of channels the user sees.
size_t num_channels_;
const size_t num_bands_;
const std::vector<std::vector<ArrayView<T>>> bands_view_;
const std::vector<std::vector<ArrayView<T>>> channels_view_;
const std::vector<std::vector<std::span<T>>> bands_view_;
const std::vector<std::vector<std::span<T>>> channels_view_;
};
// One int16_t and one float ChannelBuffer that are kept in sync. The sync is

View File

@ -106,7 +106,7 @@ inline float FloatS16ToDbfs(float v) {
// Copy audio from `src` channels to `dest` channels unless `src` and `dest`
// point to the same address. `src` and `dest` must have the same number of
// channels, and there must be sufficient space allocated in `dest`.
// TODO: b/335805780 - Accept ArrayView.
// TODO: b/335805780 - Accept std::span.
template <typename T>
void CopyAudioIfNeeded(const T* const* src,
int num_frames,

View File

@ -65,7 +65,6 @@ rtc_library("read_auth_file") {
"turnserver/read_auth_file.h",
]
deps = [
"../api:array_view",
"../rtc_base:stringutils",
"//third_party/abseil-cpp/absl/strings:string_view",
]
@ -677,7 +676,6 @@ if (is_linux || is_chromeos || is_win) {
]
deps = [
"../api:array_view",
"../api:async_dns_resolver",
"../api:audio_options_api",
"../api:create_frame_generator",

View File

@ -55,7 +55,6 @@ if (is_android) {
deps = [
":generated_jni",
"../../api:array_view",
"../../api:sequence_checker",
"../../api/audio:builtin_audio_processing_builder",
"../../api/environment",

View File

@ -20,12 +20,12 @@
#include <map>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "api/array_view.h"
#include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio_codecs/audio_format.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
@ -481,7 +481,7 @@ void AndroidVoipClient::SendRtpPacket(const std::vector<uint8_t>& packet_copy) {
}
}
bool AndroidVoipClient::SendRtp(webrtc::ArrayView<const uint8_t> packet,
bool AndroidVoipClient::SendRtp(std::span<const uint8_t> packet,
const webrtc::PacketOptions& options) {
std::vector<uint8_t> packet_copy(packet.begin(), packet.end());
voip_thread_->PostTask([this, packet_copy = std::move(packet_copy)] {
@ -501,7 +501,7 @@ void AndroidVoipClient::SendRtcpPacket(
}
}
bool AndroidVoipClient::SendRtcp(webrtc::ArrayView<const uint8_t> packet,
bool AndroidVoipClient::SendRtcp(std::span<const uint8_t> packet,
const webrtc::PacketOptions& options) {
std::vector<uint8_t> packet_copy(packet.begin(), packet.end());
voip_thread_->PostTask([this, packet_copy = std::move(packet_copy)] {
@ -519,7 +519,7 @@ void AndroidVoipClient::ReadRTPPacket(const std::vector<uint8_t>& packet_copy) {
}
webrtc::VoipResult result = voip_engine_->Network().ReceivedRTPPacket(
*channel_,
webrtc::ArrayView<const uint8_t>(packet_copy.data(), packet_copy.size()));
std::span<const uint8_t>(packet_copy.data(), packet_copy.size()));
RTC_CHECK(result == webrtc::VoipResult::kOk);
}
@ -543,7 +543,7 @@ void AndroidVoipClient::ReadRTCPPacket(
}
webrtc::VoipResult result = voip_engine_->Network().ReceivedRTCPPacket(
*channel_,
webrtc::ArrayView<const uint8_t>(packet_copy.data(), packet_copy.size()));
std::span<const uint8_t>(packet_copy.data(), packet_copy.size()));
RTC_CHECK(result == webrtc::VoipResult::kOk);
}

View File

@ -16,10 +16,10 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/audio_codecs/audio_format.h"
#include "api/call/transport.h"
#include "api/environment/environment.h"
@ -121,9 +121,9 @@ class AndroidVoipClient : public webrtc::Transport {
void Delete(JNIEnv* env);
// Implementation for Transport.
bool SendRtp(webrtc::ArrayView<const uint8_t> packet,
bool SendRtp(std::span<const uint8_t> packet,
const webrtc::PacketOptions& options) override;
bool SendRtcp(webrtc::ArrayView<const uint8_t> packet,
bool SendRtcp(std::span<const uint8_t> packet,
const webrtc::PacketOptions& options) override;
void OnSignalReadRTPPacket(webrtc::AsyncPacketSocket* socket,

View File

@ -14,9 +14,9 @@
#include <stdint.h>
#include <memory>
#include <span>
#include <string>
#include "api/array_view.h"
#include "api/media_stream_interface.h"
#include "api/scoped_refptr.h"
#include "api/video/video_frame.h"
@ -94,7 +94,7 @@ class GtkMainWnd : public MainWindow {
// VideoSinkInterface implementation
void OnFrame(const webrtc::VideoFrame& frame) override;
webrtc::ArrayView<const uint8_t> image() const { return image_; }
std::span<const uint8_t> image() const { return image_; }
int width() const { return width_; }

View File

@ -13,10 +13,10 @@
#include <cstddef>
#include <istream>
#include <map>
#include <span>
#include <string>
#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "rtc_base/string_encode.h"
namespace webrtc_examples {
@ -28,7 +28,7 @@ std::map<std::string, std::string> ReadAuthFile(std::istream* s) {
if (sep == std::string::npos)
continue;
char buf[32];
size_t len = webrtc::hex_decode(webrtc::ArrayView<char>(buf),
size_t len = webrtc::hex_decode(std::span<char>(buf),
absl::string_view(line).substr(sep + 1));
if (len > 0) {
name_to_key.emplace(line.substr(0, sep), std::string(buf, len));

View File

@ -23,7 +23,6 @@ rtc_library("system_wrappers") {
defines = []
libs = []
deps = [
"../api:array_view",
"../api/units:time_delta",
"../api/units:timestamp",
"../rtc_base:checks",