Commit eb1252cd authored by Oscar Johansson's avatar Oscar Johansson Committed by Commit Bot

Move transport functions and variables to util (media/cast)

When building using jumbo, files get merged and functions and
variables with the same name may end up in the same namespace
and conflict. This happens in:
media/cast/net/cast_transport_impl.cc
media/cast/net/udp_transport_impl.cc

Since the functions and variables are identical they are
moved to a common util file.

Bug: 867350
Change-Id: I08747781d56b78e9a8783bfec870c7084183062a
Reviewed-on: https://chromium-review.googlesource.com/1152738
Commit-Queue: Chrome Cunningham (In Paris) <chcunningham@chromium.org>
Reviewed-by: default avatarChrome Cunningham (In Paris) <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578596}
parent e6ff3d97
...@@ -102,6 +102,8 @@ source_set("net") { ...@@ -102,6 +102,8 @@ source_set("net") {
"net/rtp/rtp_parser.h", "net/rtp/rtp_parser.h",
"net/rtp/rtp_sender.cc", "net/rtp/rtp_sender.cc",
"net/rtp/rtp_sender.h", "net/rtp/rtp_sender.h",
"net/transport_util.cc",
"net/transport_util.h",
"net/udp_packet_pipe.cc", "net/udp_packet_pipe.cc",
"net/udp_packet_pipe.h", "net/udp_packet_pipe.h",
"net/udp_transport_impl.cc", "net/udp_transport_impl.cc",
......
...@@ -13,32 +13,22 @@ ...@@ -13,32 +13,22 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "media/cast/net/cast_transport_defines.h" #include "media/cast/net/cast_transport_defines.h"
#include "media/cast/net/rtcp/sender_rtcp_session.h" #include "media/cast/net/rtcp/sender_rtcp_session.h"
#include "media/cast/net/transport_util.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
using media::cast::transport_util::kOptionPacerMaxBurstSize;
using media::cast::transport_util::kOptionPacerTargetBurstSize;
using media::cast::transport_util::LookupOptionWithDefault;
namespace media { namespace media {
namespace cast { namespace cast {
namespace { namespace {
// Options for PaceSender.
const char kOptionPacerMaxBurstSize[] = "pacer_max_burst_size";
const char kOptionPacerTargetBurstSize[] = "pacer_target_burst_size";
// Wifi options. // Wifi options.
const char kOptionWifiDisableScan[] = "disable_wifi_scan"; const char kOptionWifiDisableScan[] = "disable_wifi_scan";
const char kOptionWifiMediaStreamingMode[] = "media_streaming_mode"; const char kOptionWifiMediaStreamingMode[] = "media_streaming_mode";
int LookupOptionWithDefault(const base::DictionaryValue& options,
const std::string& path,
int default_value) {
int ret;
if (options.GetInteger(path, &ret)) {
return ret;
} else {
return default_value;
}
}
} // namespace } // namespace
std::unique_ptr<CastTransport> CastTransport::Create( std::unique_ptr<CastTransport> CastTransport::Create(
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/cast/net/transport_util.h"
namespace media {
namespace cast {
namespace transport_util {
int LookupOptionWithDefault(const base::DictionaryValue& options,
const std::string& path,
int default_value) {
int ret;
if (options.GetInteger(path, &ret)) {
return ret;
} else {
return default_value;
}
}
} // namespace transport_util
} // namespace cast
} // namespace media
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAST_NET_TRANSPORT_UTIL_H_
#define MEDIA_CAST_NET_TRANSPORT_UTIL_H_
#include <string>
#include "base/values.h"
namespace media {
namespace cast {
namespace transport_util {
// Options for PaceSender.
const char kOptionPacerMaxBurstSize[] = "pacer_max_burst_size";
const char kOptionPacerTargetBurstSize[] = "pacer_target_burst_size";
int LookupOptionWithDefault(const base::DictionaryValue& options,
const std::string& path,
int default_value);
} // namespace transport_util
} // namespace cast
} // namespace media
#endif // MEDIA_CAST_NET_TRANSPORT_UTIL_H_
...@@ -11,12 +11,16 @@ ...@@ -11,12 +11,16 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "media/cast/net/transport_util.h"
#include "media/cast/net/udp_packet_pipe.h" #include "media/cast/net/udp_packet_pipe.h"
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "net/log/net_log_source.h" #include "net/log/net_log_source.h"
#include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation.h"
using media::cast::transport_util::kOptionPacerMaxBurstSize;
using media::cast::transport_util::LookupOptionWithDefault;
namespace media { namespace media {
namespace cast { namespace cast {
...@@ -27,23 +31,11 @@ const char kOptionDscp[] = "DSCP"; ...@@ -27,23 +31,11 @@ const char kOptionDscp[] = "DSCP";
const char kOptionDisableNonBlockingIO[] = "disable_non_blocking_io"; const char kOptionDisableNonBlockingIO[] = "disable_non_blocking_io";
#endif #endif
const char kOptionSendBufferMinSize[] = "send_buffer_min_size"; const char kOptionSendBufferMinSize[] = "send_buffer_min_size";
const char kOptionPacerMaxBurstSize[] = "pacer_max_burst_size";
bool IsEmpty(const net::IPEndPoint& addr) { bool IsEmpty(const net::IPEndPoint& addr) {
return (addr.address().empty() || addr.address().IsZero()) && !addr.port(); return (addr.address().empty() || addr.address().IsZero()) && !addr.port();
} }
int LookupOptionWithDefault(const base::DictionaryValue& options,
const std::string& path,
int default_value) {
int ret;
if (options.GetInteger(path, &ret)) {
return ret;
} else {
return default_value;
}
}
int32_t GetTransportSendBufferSize(const base::DictionaryValue& options) { int32_t GetTransportSendBufferSize(const base::DictionaryValue& options) {
// Socket send buffer size needs to be at least greater than one burst // Socket send buffer size needs to be at least greater than one burst
// size. // size.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment