aboutsummaryrefslogtreecommitdiff
path: root/cast
diff options
context:
space:
mode:
authorKennan Gumbs <kennangumbs@google.com>2021-07-07 15:54:14 -0400
committerOpenscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-07-14 01:16:32 +0000
commit7e167e2bc4c8c0c650f00b995e1e20cb1ae1f479 (patch)
tree6a84d39db2234179deaac624ec05e0d86c40ceb1 /cast
parent01c7cc260a28bc0a814249f41825b35e021be271 (diff)
downloadopenscreen-7e167e2bc4c8c0c650f00b995e1e20cb1ae1f479.tar.gz
Remove abseil dependency from HexEncode method
Currently the HexEncode method defined in util/stringprintf.h depends on absl::Span, which is part of abseil. This patch removes the dependency, allowing the method to be more widely used. Bug: b/158660166 Change-Id: I37715271391000b5c61d5a657f604db2bc6c882e Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/3001949 Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r--cast/standalone_receiver/cast_service.cc3
-rw-r--r--cast/streaming/offer_messages.cc4
-rw-r--r--cast/streaming/receiver_packet_router.cc5
-rw-r--r--cast/streaming/sender_packet_router.cc5
4 files changed, 10 insertions, 7 deletions
diff --git a/cast/standalone_receiver/cast_service.cc b/cast/standalone_receiver/cast_service.cc
index 009190b0..0e3d9c9c 100644
--- a/cast/standalone_receiver/cast_service.cc
+++ b/cast/standalone_receiver/cast_service.cc
@@ -69,7 +69,8 @@ CastService::CastService(CastService::Configuration config)
if (discovery_publisher_) {
ReceiverInfo info;
info.port = local_endpoint_.port;
- info.unique_id = HexEncode(config.interface.hardware_address);
+ info.unique_id = HexEncode(config.interface.hardware_address.data(),
+ config.interface.hardware_address.size());
info.friendly_name = config.friendly_name;
info.model_name = config.model_name;
info.capabilities = kHasVideoOutput | kHasAudioOutput;
diff --git a/cast/streaming/offer_messages.cc b/cast/streaming/offer_messages.cc
index 3e816026..eeefcc5d 100644
--- a/cast/streaming/offer_messages.cc
+++ b/cast/streaming/offer_messages.cc
@@ -202,8 +202,8 @@ Json::Value Stream::ToJson() const {
"this code assumes Ssrc fits in a Json::UInt");
root["ssrc"] = static_cast<Json::UInt>(ssrc);
root["targetDelay"] = static_cast<int>(target_delay.count());
- root["aesKey"] = HexEncode(aes_key);
- root["aesIvMask"] = HexEncode(aes_iv_mask);
+ root["aesKey"] = HexEncode(aes_key.data(), aes_key.size());
+ root["aesIvMask"] = HexEncode(aes_iv_mask.data(), aes_iv_mask.size());
root["receiverRtcpEventLog"] = receiver_rtcp_event_log;
root["receiverRtcpDscp"] = receiver_rtcp_dscp;
root["timeBase"] = "1/" + std::to_string(rtp_timebase);
diff --git a/cast/streaming/receiver_packet_router.cc b/cast/streaming/receiver_packet_router.cc
index 1ac4266a..23b99ce4 100644
--- a/cast/streaming/receiver_packet_router.cc
+++ b/cast/streaming/receiver_packet_router.cc
@@ -73,10 +73,11 @@ void ReceiverPacketRouter::OnReceivedPacket(const IPEndpoint& source,
InspectPacketForRouting(packet);
if (seems_like.first == ApparentPacketType::UNKNOWN) {
constexpr int kMaxPartiaHexDumpSize = 96;
+ const std::size_t encode_size =
+ std::min(packet.size(), static_cast<size_t>(kMaxPartiaHexDumpSize));
OSP_LOG_WARN << "UNKNOWN packet of " << packet.size()
<< " bytes. Partial hex dump: "
- << HexEncode(absl::Span<const uint8_t>(packet).subspan(
- 0, kMaxPartiaHexDumpSize));
+ << HexEncode(packet.data(), encode_size);
return;
}
auto it = receivers_.find(seems_like.second);
diff --git a/cast/streaming/sender_packet_router.cc b/cast/streaming/sender_packet_router.cc
index c2b23dbf..684b1fb2 100644
--- a/cast/streaming/sender_packet_router.cc
+++ b/cast/streaming/sender_packet_router.cc
@@ -102,10 +102,11 @@ void SenderPacketRouter::OnReceivedPacket(const IPEndpoint& source,
InspectPacketForRouting(packet);
if (seems_like.first != ApparentPacketType::RTCP) {
constexpr int kMaxPartiaHexDumpSize = 96;
+ const std::size_t encode_size =
+ std::min(packet.size(), static_cast<size_t>(kMaxPartiaHexDumpSize));
OSP_LOG_WARN << "UNKNOWN packet of " << packet.size()
<< " bytes. Partial hex dump: "
- << HexEncode(absl::Span<const uint8_t>(packet).subspan(
- 0, kMaxPartiaHexDumpSize));
+ << HexEncode(packet.data(), encode_size);
return;
}
const auto it = FindEntry(seems_like.second);