Adopt absl::string_view in call/
Bug: webrtc:13579
Change-Id: Ib616eb3372da341fafb55c23038182751b9da5a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262780
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36910}
diff --git a/call/BUILD.gn b/call/BUILD.gn
index ba0da32..6b92d28 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -78,6 +78,7 @@
]
absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -127,6 +128,7 @@
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -339,6 +341,7 @@
]
absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -591,7 +594,10 @@
"../video",
"//testing/gtest",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/flags:flag",
+ "//third_party/abseil-cpp/absl/strings",
+ ]
}
}
@@ -616,6 +622,7 @@
"../rtc_base/network:sent_packet",
"../test:test_support",
]
+ absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
}
rtc_source_set("mock_bitrate_allocator") {
testonly = true
diff --git a/call/adaptation/BUILD.gn b/call/adaptation/BUILD.gn
index 2cb8093..336dd23 100644
--- a/call/adaptation/BUILD.gn
+++ b/call/adaptation/BUILD.gn
@@ -57,6 +57,7 @@
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
]
@@ -123,6 +124,9 @@
"../../rtc_base/task_utils:to_queued_task",
"../../test:test_support",
]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/strings",
+ "//third_party/abseil-cpp/absl/types:optional",
+ ]
}
}
diff --git a/call/adaptation/broadcast_resource_listener.cc b/call/adaptation/broadcast_resource_listener.cc
index 5a1250ae..9d0a849 100644
--- a/call/adaptation/broadcast_resource_listener.cc
+++ b/call/adaptation/broadcast_resource_listener.cc
@@ -14,6 +14,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/ref_counted_object.h"
#include "rtc_base/synchronization/mutex.h"
@@ -24,7 +25,7 @@
// a single ResourceListener.
class BroadcastResourceListener::AdapterResource : public Resource {
public:
- explicit AdapterResource(std::string name) : name_(std::move(name)) {}
+ explicit AdapterResource(absl::string_view name) : name_(std::move(name)) {}
~AdapterResource() override { RTC_DCHECK(!listener_); }
// The parent is letting us know we have a usage neasurement.
diff --git a/call/adaptation/resource_adaptation_processor.cc b/call/adaptation/resource_adaptation_processor.cc
index a89d64b..44fe472 100644
--- a/call/adaptation/resource_adaptation_processor.cc
+++ b/call/adaptation/resource_adaptation_processor.cc
@@ -15,6 +15,7 @@
#include <utility>
#include "absl/algorithm/container.h"
+#include "absl/strings/string_view.h"
#include "api/sequence_checker.h"
#include "api/video/video_adaptation_counters.h"
#include "call/adaptation/video_stream_adapter.h"
@@ -59,8 +60,9 @@
: result(MitigationResult::kAdaptationApplied), message() {}
ResourceAdaptationProcessor::MitigationResultAndLogMessage::
- MitigationResultAndLogMessage(MitigationResult result, std::string message)
- : result(result), message(std::move(message)) {}
+ MitigationResultAndLogMessage(MitigationResult result,
+ absl::string_view message)
+ : result(result), message(message) {}
ResourceAdaptationProcessor::ResourceAdaptationProcessor(
VideoStreamAdapter* stream_adapter)
diff --git a/call/adaptation/resource_adaptation_processor.h b/call/adaptation/resource_adaptation_processor.h
index ca2fec0..6ad0ef8 100644
--- a/call/adaptation/resource_adaptation_processor.h
+++ b/call/adaptation/resource_adaptation_processor.h
@@ -17,6 +17,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/adaptation/resource.h"
#include "api/rtp_parameters.h"
@@ -108,7 +109,8 @@
struct MitigationResultAndLogMessage {
MitigationResultAndLogMessage();
- MitigationResultAndLogMessage(MitigationResult result, std::string message);
+ MitigationResultAndLogMessage(MitigationResult result,
+ absl::string_view message);
MitigationResult result;
std::string message;
};
diff --git a/call/adaptation/test/fake_adaptation_constraint.cc b/call/adaptation/test/fake_adaptation_constraint.cc
index 18b8e8b..dbb31f0 100644
--- a/call/adaptation/test/fake_adaptation_constraint.cc
+++ b/call/adaptation/test/fake_adaptation_constraint.cc
@@ -12,10 +12,12 @@
#include <utility>
+#include "absl/strings/string_view.h"
+
namespace webrtc {
-FakeAdaptationConstraint::FakeAdaptationConstraint(std::string name)
- : name_(std::move(name)), is_adaptation_up_allowed_(true) {}
+FakeAdaptationConstraint::FakeAdaptationConstraint(absl::string_view name)
+ : name_(name), is_adaptation_up_allowed_(true) {}
FakeAdaptationConstraint::~FakeAdaptationConstraint() = default;
diff --git a/call/adaptation/test/fake_adaptation_constraint.h b/call/adaptation/test/fake_adaptation_constraint.h
index 021e46a..5c68433 100644
--- a/call/adaptation/test/fake_adaptation_constraint.h
+++ b/call/adaptation/test/fake_adaptation_constraint.h
@@ -13,13 +13,14 @@
#include <string>
+#include "absl/strings/string_view.h"
#include "call/adaptation/adaptation_constraint.h"
namespace webrtc {
class FakeAdaptationConstraint : public AdaptationConstraint {
public:
- explicit FakeAdaptationConstraint(std::string name);
+ explicit FakeAdaptationConstraint(absl::string_view name);
~FakeAdaptationConstraint() override;
void set_is_adaptation_up_allowed(bool is_adaptation_up_allowed);
diff --git a/call/adaptation/test/fake_resource.cc b/call/adaptation/test/fake_resource.cc
index 70df058..4515b0a 100644
--- a/call/adaptation/test/fake_resource.cc
+++ b/call/adaptation/test/fake_resource.cc
@@ -13,17 +13,18 @@
#include <algorithm>
#include <utility>
+#include "absl/strings/string_view.h"
#include "rtc_base/ref_counted_object.h"
namespace webrtc {
// static
-rtc::scoped_refptr<FakeResource> FakeResource::Create(std::string name) {
+rtc::scoped_refptr<FakeResource> FakeResource::Create(absl::string_view name) {
return rtc::make_ref_counted<FakeResource>(name);
}
-FakeResource::FakeResource(std::string name)
- : Resource(), name_(std::move(name)), listener_(nullptr) {}
+FakeResource::FakeResource(absl::string_view name)
+ : Resource(), name_(name), listener_(nullptr) {}
FakeResource::~FakeResource() {}
diff --git a/call/adaptation/test/fake_resource.h b/call/adaptation/test/fake_resource.h
index e88d97d..1119a96 100644
--- a/call/adaptation/test/fake_resource.h
+++ b/call/adaptation/test/fake_resource.h
@@ -14,6 +14,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/adaptation/resource.h"
#include "api/scoped_refptr.h"
@@ -23,9 +24,9 @@
// Fake resource used for testing.
class FakeResource : public Resource {
public:
- static rtc::scoped_refptr<FakeResource> Create(std::string name);
+ static rtc::scoped_refptr<FakeResource> Create(absl::string_view name);
- explicit FakeResource(std::string name);
+ explicit FakeResource(absl::string_view name);
~FakeResource() override;
void SetUsageState(ResourceUsageState usage_state);
diff --git a/call/bitrate_allocator_unittest.cc b/call/bitrate_allocator_unittest.cc
index e4f0566..69bdd83 100644
--- a/call/bitrate_allocator_unittest.cc
+++ b/call/bitrate_allocator_unittest.cc
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "absl/strings/string_view.h"
#include "system_wrappers/include/clock.h"
#include "test/gmock.h"
#include "test/gtest.h"
@@ -306,7 +307,7 @@
uint32_t max_bitrate_bps,
uint32_t pad_up_bitrate_bps,
bool enforce_min_bitrate,
- std::string track_id,
+ absl::string_view track_id,
double bitrate_priority) {
allocator_->AddObserver(
observer, {min_bitrate_bps, max_bitrate_bps, pad_up_bitrate_bps, 0,
diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc
index 424cf0b..e18bc24 100644
--- a/call/bitrate_estimator_tests.cc
+++ b/call/bitrate_estimator_tests.cc
@@ -41,7 +41,7 @@
~LogObserver() { rtc::LogMessage::RemoveLogToStream(&callback_); }
- void PushExpectedLogLine(const std::string& expected_log_line) {
+ void PushExpectedLogLine(absl::string_view expected_log_line) {
callback_.PushExpectedLogLine(expected_log_line);
}
@@ -83,9 +83,9 @@
bool Wait() { return done_.Wait(test::CallTest::kDefaultTimeoutMs); }
- void PushExpectedLogLine(const std::string& expected_log_line) {
+ void PushExpectedLogLine(absl::string_view expected_log_line) {
MutexLock lock(&mutex_);
- expected_log_lines_.push_back(expected_log_line);
+ expected_log_lines_.emplace_back(expected_log_line);
}
private:
diff --git a/call/call.cc b/call/call.cc
index 1582bd2..f96bda5 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -21,6 +21,7 @@
#include <vector>
#include "absl/functional/bind_front.h"
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/sequence_checker.h"
@@ -272,7 +273,7 @@
uint32_t local_ssrc) override;
void OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
- const std::string& sync_group) override;
+ absl::string_view sync_group) override;
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
@@ -349,9 +350,9 @@
rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) RTC_RUN_ON(worker_thread_);
- AudioReceiveStream* FindAudioStreamForSyncGroup(const std::string& sync_group)
+ AudioReceiveStream* FindAudioStreamForSyncGroup(absl::string_view sync_group)
RTC_RUN_ON(worker_thread_);
- void ConfigureSync(const std::string& sync_group) RTC_RUN_ON(worker_thread_);
+ void ConfigureSync(absl::string_view sync_group) RTC_RUN_ON(worker_thread_);
void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
MediaType media_type,
@@ -1403,7 +1404,7 @@
}
void Call::OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
- const std::string& sync_group) {
+ absl::string_view sync_group) {
RTC_DCHECK_RUN_ON(worker_thread_);
webrtc::internal::AudioReceiveStream& receive_stream =
static_cast<webrtc::internal::AudioReceiveStream&>(stream);
@@ -1476,7 +1477,7 @@
// RTC_RUN_ON(worker_thread_)
AudioReceiveStream* Call::FindAudioStreamForSyncGroup(
- const std::string& sync_group) {
+ absl::string_view sync_group) {
RTC_DCHECK_RUN_ON(&receive_11993_checker_);
if (!sync_group.empty()) {
for (AudioReceiveStream* stream : audio_receive_streams_) {
@@ -1490,7 +1491,7 @@
// TODO(bugs.webrtc.org/11993): Expect to be called on the network thread.
// RTC_RUN_ON(worker_thread_)
-void Call::ConfigureSync(const std::string& sync_group) {
+void Call::ConfigureSync(absl::string_view sync_group) {
// `audio_stream` may be nullptr when clearing the audio stream for a group.
AudioReceiveStream* audio_stream = FindAudioStreamForSyncGroup(sync_group);
diff --git a/call/call.h b/call/call.h
index 65bd5f2..d98616c 100644
--- a/call/call.h
+++ b/call/call.h
@@ -15,6 +15,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "api/adaptation/resource.h"
#include "api/media_types.h"
#include "api/task_queue/task_queue_base.h"
@@ -171,7 +172,7 @@
uint32_t local_ssrc) = 0;
virtual void OnUpdateSyncGroup(AudioReceiveStream& stream,
- const std::string& sync_group) = 0;
+ absl::string_view sync_group) = 0;
virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0;
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 6acebf2..16ecf10 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/task_queue_base.h"
@@ -76,7 +77,7 @@
float video_ntp_speed,
float video_rtp_speed,
float audio_rtp_speed,
- const std::string& test_label);
+ absl::string_view test_label);
void TestMinTransmitBitrate(bool pad_to_min_bitrate);
@@ -91,7 +92,7 @@
int start_bwe,
int max_bwe);
void TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
- const std::string& payload_name,
+ absl::string_view payload_name,
const std::vector<int>& max_framerates);
};
@@ -104,7 +105,7 @@
public:
explicit VideoRtcpAndSyncObserver(TaskQueueBase* task_queue,
Clock* clock,
- const std::string& test_label)
+ absl::string_view test_label)
: test::RtpRtcpObserver(CallPerfTest::kLongTimeoutMs),
clock_(clock),
test_label_(test_label),
@@ -169,7 +170,7 @@
float video_ntp_speed,
float video_rtp_speed,
float audio_rtp_speed,
- const std::string& test_label) {
+ absl::string_view test_label) {
const char* kSyncGroup = "av_sync";
const uint32_t kAudioSendSsrc = 1234;
const uint32_t kAudioRecvSsrc = 5678;
@@ -1055,7 +1056,7 @@
}
void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
- const std::string& payload_name,
+ absl::string_view payload_name,
const std::vector<int>& max_framerates) {
static constexpr double kAllowedFpsDiff = 1.5;
static constexpr TimeDelta kMinGetStatsInterval = TimeDelta::Millis(400);
@@ -1067,7 +1068,7 @@
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
FramerateObserver(VideoEncoderFactory* encoder_factory,
- const std::string& payload_name,
+ absl::string_view payload_name,
const std::vector<int>& max_framerates,
TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeoutMs),
diff --git a/call/call_unittest.cc b/call/call_unittest.cc
index c84cc51..e07e447 100644
--- a/call/call_unittest.cc
+++ b/call/call_unittest.cc
@@ -16,6 +16,7 @@
#include <utility>
#include "absl/memory/memory.h"
+#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/default_task_queue_factory.h"
@@ -82,9 +83,9 @@
rtc::scoped_refptr<Resource> FindResourceWhoseNameContains(
const std::vector<rtc::scoped_refptr<Resource>>& resources,
- const std::string& name_contains) {
+ absl::string_view name_contains) {
for (const auto& resource : resources) {
- if (resource->Name().find(name_contains) != std::string::npos)
+ if (resource->Name().find(std::string(name_contains)) != std::string::npos)
return resource;
}
return nullptr;
diff --git a/call/degraded_call.cc b/call/degraded_call.cc
index e6dd361..82f5a5a 100644
--- a/call/degraded_call.cc
+++ b/call/degraded_call.cc
@@ -13,6 +13,7 @@
#include <memory>
#include <utility>
+#include "absl/strings/string_view.h"
#include "rtc_base/location.h"
namespace webrtc {
@@ -315,7 +316,7 @@
}
void DegradedCall::OnUpdateSyncGroup(AudioReceiveStream& stream,
- const std::string& sync_group) {
+ absl::string_view sync_group) {
call_->OnUpdateSyncGroup(stream, sync_group);
}
diff --git a/call/degraded_call.h b/call/degraded_call.h
index 586bb91..434d377 100644
--- a/call/degraded_call.h
+++ b/call/degraded_call.h
@@ -19,6 +19,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/call/transport.h"
#include "api/fec_controller.h"
@@ -105,7 +106,7 @@
void OnLocalSsrcUpdated(FlexfecReceiveStream& stream,
uint32_t local_ssrc) override;
void OnUpdateSyncGroup(AudioReceiveStream& stream,
- const std::string& sync_group) override;
+ absl::string_view sync_group) override;
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
protected:
diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc
index 999bb50..ae2b0a7 100644
--- a/call/rampup_tests.cc
+++ b/call/rampup_tests.cc
@@ -13,6 +13,7 @@
#include <memory>
#include "absl/flags/flag.h"
+#include "absl/strings/string_view.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/rtc_event_log_output_file.h"
#include "api/task_queue/default_task_queue_factory.h"
@@ -58,7 +59,7 @@
size_t num_flexfec_streams,
unsigned int start_bitrate_bps,
int64_t min_run_time_ms,
- const std::string& extension_type,
+ absl::string_view extension_type,
bool rtx,
bool red,
bool report_perf_stats,
@@ -329,9 +330,9 @@
}
void RampUpTester::ReportResult(
- const std::string& measurement,
+ absl::string_view measurement,
size_t value,
- const std::string& units,
+ absl::string_view units,
test::ImproveDirection improve_direction) const {
webrtc::test::PrintResult(
measurement, "",
@@ -420,7 +421,7 @@
size_t num_audio_streams,
size_t num_flexfec_streams,
unsigned int start_bitrate_bps,
- const std::string& extension_type,
+ absl::string_view extension_type,
bool rtx,
bool red,
const std::vector<int>& loss_rates,
diff --git a/call/rampup_tests.h b/call/rampup_tests.h
index 0432e66..aadbca8 100644
--- a/call/rampup_tests.h
+++ b/call/rampup_tests.h
@@ -17,6 +17,7 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/task_queue_base.h"
#include "api/test/simulated_network.h"
@@ -43,7 +44,7 @@
size_t num_flexfec_streams,
unsigned int start_bitrate_bps,
int64_t min_run_time_ms,
- const std::string& extension_type,
+ absl::string_view extension_type,
bool rtx,
bool red,
bool report_perf_stats,
@@ -65,9 +66,9 @@
size_t* padding_sent,
size_t* media_sent) const;
- void ReportResult(const std::string& measurement,
+ void ReportResult(absl::string_view measurement,
size_t value,
- const std::string& units,
+ absl::string_view units,
test::ImproveDirection improve_direction) const;
void TriggerTestDone();
@@ -128,7 +129,7 @@
size_t num_audio_streams,
size_t num_flexfec_streams,
unsigned int start_bitrate_bps,
- const std::string& extension_type,
+ absl::string_view extension_type,
bool rtx,
bool red,
const std::vector<int>& loss_rates,
diff --git a/call/rtp_demuxer.cc b/call/rtp_demuxer.cc
index 3924f84..0b74f2a 100644
--- a/call/rtp_demuxer.cc
+++ b/call/rtp_demuxer.cc
@@ -10,6 +10,7 @@
#include "call/rtp_demuxer.h"
+#include "absl/strings/string_view.h"
#include "call/rtp_packet_sink_interface.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
@@ -238,8 +239,7 @@
return AddSink(criteria, sink);
}
-void RtpDemuxer::AddSink(const std::string& rsid,
- RtpPacketSinkInterface* sink) {
+void RtpDemuxer::AddSink(absl::string_view rsid, RtpPacketSinkInterface* sink) {
RtpDemuxerCriteria criteria(absl::string_view() /* mid */, rsid);
AddSink(criteria, sink);
}
@@ -363,7 +363,7 @@
return ResolveSinkByPayloadType(packet.PayloadType(), ssrc);
}
-RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByMid(const std::string& mid,
+RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByMid(absl::string_view mid,
uint32_t ssrc) {
const auto it = sink_by_mid_.find(mid);
if (it != sink_by_mid_.end()) {
@@ -374,11 +374,11 @@
return nullptr;
}
-RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByMidRsid(
- const std::string& mid,
- const std::string& rsid,
- uint32_t ssrc) {
- const auto it = sink_by_mid_and_rsid_.find(std::make_pair(mid, rsid));
+RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByMidRsid(absl::string_view mid,
+ absl::string_view rsid,
+ uint32_t ssrc) {
+ const auto it = sink_by_mid_and_rsid_.find(
+ std::make_pair(std::string(mid), std::string(rsid)));
if (it != sink_by_mid_and_rsid_.end()) {
RtpPacketSinkInterface* sink = it->second;
AddSsrcSinkBinding(ssrc, sink);
@@ -387,7 +387,7 @@
return nullptr;
}
-RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByRsid(const std::string& rsid,
+RtpPacketSinkInterface* RtpDemuxer::ResolveSinkByRsid(absl::string_view rsid,
uint32_t ssrc) {
const auto it = sink_by_rsid_.find(rsid);
if (it != sink_by_rsid_.end()) {
diff --git a/call/rtp_demuxer.h b/call/rtp_demuxer.h
index 5fd37b4..53eeb0b 100644
--- a/call/rtp_demuxer.h
+++ b/call/rtp_demuxer.h
@@ -145,7 +145,7 @@
// Registers a sink's association to an RSID. Only one sink may be associated
// with a given RSID. Null pointer is not allowed.
- void AddSink(const std::string& rsid, RtpPacketSinkInterface* sink);
+ void AddSink(absl::string_view rsid, RtpPacketSinkInterface* sink);
// Removes a sink. Return value reports if anything was actually removed.
// Null pointer is not allowed.
@@ -167,12 +167,12 @@
RtpPacketSinkInterface* ResolveSink(const RtpPacketReceived& packet);
// Used by the ResolveSink algorithm.
- RtpPacketSinkInterface* ResolveSinkByMid(const std::string& mid,
+ RtpPacketSinkInterface* ResolveSinkByMid(absl::string_view mid,
uint32_t ssrc);
- RtpPacketSinkInterface* ResolveSinkByMidRsid(const std::string& mid,
- const std::string& rsid,
+ RtpPacketSinkInterface* ResolveSinkByMidRsid(absl::string_view mid,
+ absl::string_view rsid,
uint32_t ssrc);
- RtpPacketSinkInterface* ResolveSinkByRsid(const std::string& rsid,
+ RtpPacketSinkInterface* ResolveSinkByRsid(absl::string_view rsid,
uint32_t ssrc);
RtpPacketSinkInterface* ResolveSinkByPayloadType(uint8_t payload_type,
uint32_t ssrc);
diff --git a/call/rtp_demuxer_unittest.cc b/call/rtp_demuxer_unittest.cc
index 4dbee91..2b394d3 100644
--- a/call/rtp_demuxer_unittest.cc
+++ b/call/rtp_demuxer_unittest.cc
@@ -14,6 +14,7 @@
#include <set>
#include <string>
+#include "absl/strings/string_view.h"
#include "call/test/mock_rtp_packet_sink_interface.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
@@ -60,18 +61,18 @@
return AddSink(criteria, sink);
}
- bool AddSinkOnlyRsid(const std::string& rsid, RtpPacketSinkInterface* sink) {
+ bool AddSinkOnlyRsid(absl::string_view rsid, RtpPacketSinkInterface* sink) {
RtpDemuxerCriteria criteria(absl::string_view(), rsid);
return AddSink(criteria, sink);
}
- bool AddSinkOnlyMid(const std::string& mid, RtpPacketSinkInterface* sink) {
+ bool AddSinkOnlyMid(absl::string_view mid, RtpPacketSinkInterface* sink) {
RtpDemuxerCriteria criteria(mid);
return AddSink(criteria, sink);
}
- bool AddSinkBothMidRsid(const std::string& mid,
- const std::string& rsid,
+ bool AddSinkBothMidRsid(absl::string_view mid,
+ absl::string_view rsid,
RtpPacketSinkInterface* sink) {
RtpDemuxerCriteria criteria(mid, rsid);
return AddSink(criteria, sink);
@@ -110,7 +111,7 @@
std::unique_ptr<RtpPacketReceived> CreatePacketWithSsrcMid(
uint32_t ssrc,
- const std::string& mid) {
+ absl::string_view mid) {
RtpPacketReceived::ExtensionManager extension_manager;
extension_manager.Register<RtpMid>(11);
@@ -121,7 +122,7 @@
std::unique_ptr<RtpPacketReceived> CreatePacketWithSsrcRsid(
uint32_t ssrc,
- const std::string& rsid) {
+ absl::string_view rsid) {
RtpPacketReceived::ExtensionManager extension_manager;
extension_manager.Register<RtpStreamId>(6);
@@ -132,7 +133,7 @@
std::unique_ptr<RtpPacketReceived> CreatePacketWithSsrcRrid(
uint32_t ssrc,
- const std::string& rrid) {
+ absl::string_view rrid) {
RtpPacketReceived::ExtensionManager extension_manager;
extension_manager.Register<RepairedRtpStreamId>(7);
@@ -143,8 +144,8 @@
std::unique_ptr<RtpPacketReceived> CreatePacketWithSsrcMidRsid(
uint32_t ssrc,
- const std::string& mid,
- const std::string& rsid) {
+ absl::string_view mid,
+ absl::string_view rsid) {
RtpPacketReceived::ExtensionManager extension_manager;
extension_manager.Register<RtpMid>(11);
extension_manager.Register<RtpStreamId>(6);
@@ -157,8 +158,8 @@
std::unique_ptr<RtpPacketReceived> CreatePacketWithSsrcRsidRrid(
uint32_t ssrc,
- const std::string& rsid,
- const std::string& rrid) {
+ absl::string_view rsid,
+ absl::string_view rrid) {
RtpPacketReceived::ExtensionManager extension_manager;
extension_manager.Register<RtpStreamId>(6);
extension_manager.Register<RepairedRtpStreamId>(7);
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index cc469cf..393acc4 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -14,6 +14,7 @@
#include <vector>
#include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/transport/goog_cc_factory.h"
#include "api/transport/network_types.h"
@@ -270,7 +271,7 @@
}
void RtpTransportControllerSend::OnNetworkRouteChanged(
- const std::string& transport_name,
+ absl::string_view transport_name,
const rtc::NetworkRoute& network_route) {
// Check if the network route is connected.
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index e982a07..abe13ee 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -17,6 +17,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "api/network_state_predictor.h"
#include "api/sequence_checker.h"
#include "api/transport/network_control.h"
@@ -94,7 +95,7 @@
StreamFeedbackProvider* GetStreamFeedbackProvider() override;
void RegisterTargetTransferRateObserver(
TargetTransferRateObserver* observer) override;
- void OnNetworkRouteChanged(const std::string& transport_name,
+ void OnNetworkRouteChanged(absl::string_view transport_name,
const rtc::NetworkRoute& network_route) override;
void OnNetworkAvailability(bool network_available) override;
RtcpBandwidthObserver* GetBandwidthObserver() override;
diff --git a/call/rtp_transport_controller_send_interface.h b/call/rtp_transport_controller_send_interface.h
index f68c4bf..adf983c 100644
--- a/call/rtp_transport_controller_send_interface.h
+++ b/call/rtp_transport_controller_send_interface.h
@@ -18,6 +18,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/crypto/crypto_options.h"
#include "api/fec_controller.h"
@@ -127,7 +128,7 @@
virtual void RegisterTargetTransferRateObserver(
TargetTransferRateObserver* observer) = 0;
virtual void OnNetworkRouteChanged(
- const std::string& transport_name,
+ absl::string_view transport_name,
const rtc::NetworkRoute& network_route) = 0;
virtual void OnNetworkAvailability(bool network_available) = 0;
virtual RtcpBandwidthObserver* GetBandwidthObserver() = 0;
diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc
index 116c878..2a87b1b 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -17,6 +17,7 @@
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
#include "api/array_view.h"
#include "api/transport/field_trial_based_config.h"
#include "api/video_codecs/video_codec.h"
@@ -55,9 +56,10 @@
using webrtc_internal_rtp_video_sender::RtpStreamSender;
-bool PayloadTypeSupportsSkippingFecPackets(const std::string& payload_name,
+bool PayloadTypeSupportsSkippingFecPackets(absl::string_view payload_name,
const FieldTrialsView& trials) {
- const VideoCodecType codecType = PayloadStringToCodecType(payload_name);
+ const VideoCodecType codecType =
+ PayloadStringToCodecType(std::string(payload_name));
if (codecType == kVideoCodecVP8 || codecType == kVideoCodecVP9) {
return true;
}
diff --git a/call/test/mock_rtp_transport_controller_send.h b/call/test/mock_rtp_transport_controller_send.h
index 8d637a3..1887cb0 100644
--- a/call/test/mock_rtp_transport_controller_send.h
+++ b/call/test/mock_rtp_transport_controller_send.h
@@ -16,6 +16,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "api/crypto/crypto_options.h"
#include "api/crypto/frame_encryptor_interface.h"
#include "api/frame_transformer_interface.h"
@@ -76,7 +77,7 @@
(override));
MOCK_METHOD(void,
OnNetworkRouteChanged,
- (const std::string&, const rtc::NetworkRoute&),
+ (absl::string_view, const rtc::NetworkRoute&),
(override));
MOCK_METHOD(void, OnNetworkAvailability, (bool), (override));
MOCK_METHOD(RtcpBandwidthObserver*, GetBandwidthObserver, (), (override));
diff --git a/media/engine/fake_webrtc_call.cc b/media/engine/fake_webrtc_call.cc
index 0cbbf7c..9375103 100644
--- a/media/engine/fake_webrtc_call.cc
+++ b/media/engine/fake_webrtc_call.cc
@@ -13,6 +13,7 @@
#include <utility>
#include "absl/algorithm/container.h"
+#include "absl/strings/string_view.h"
#include "api/call/audio_sink.h"
#include "modules/rtp_rtcp/source/rtp_util.h"
#include "rtc_base/checks.h"
@@ -728,7 +729,7 @@
}
void FakeCall::OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
- const std::string& sync_group) {
+ absl::string_view sync_group) {
auto& fake_stream = static_cast<FakeAudioReceiveStream&>(stream);
fake_stream.SetSyncGroup(sync_group);
}
diff --git a/media/engine/fake_webrtc_call.h b/media/engine/fake_webrtc_call.h
index 8a3e226..28302c7 100644
--- a/media/engine/fake_webrtc_call.h
+++ b/media/engine/fake_webrtc_call.h
@@ -25,6 +25,7 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "api/transport/field_trial_based_config.h"
#include "api/video/video_frame.h"
#include "call/audio_receive_stream.h"
@@ -105,8 +106,8 @@
config_.rtp.local_ssrc = local_ssrc;
}
- void SetSyncGroup(const std::string& sync_group) {
- config_.sync_group = sync_group;
+ void SetSyncGroup(absl::string_view sync_group) {
+ config_.sync_group = std::string(sync_group);
}
private:
@@ -424,7 +425,7 @@
void OnLocalSsrcUpdated(webrtc::FlexfecReceiveStream& stream,
uint32_t local_ssrc) override;
void OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
- const std::string& sync_group) override;
+ absl::string_view sync_group) override;
void OnSentPacket(const rtc::SentPacket& sent_packet) override;
webrtc::TaskQueueBase* const network_thread_;