Index: media/cast/net/cast_transport_sender_impl.cc |
diff --git a/media/cast/net/cast_transport_sender_impl.cc b/media/cast/net/cast_transport_sender_impl.cc |
index 6c746f485bf4806be73bbf1c17e6a4927d2937b0..ac4772380075fc441e94770cd9265289fa064903 100644 |
--- a/media/cast/net/cast_transport_sender_impl.cc |
+++ b/media/cast/net/cast_transport_sender_impl.cc |
@@ -9,6 +9,7 @@ |
#include "media/cast/net/cast_transport_config.h" |
#include "media/cast/net/cast_transport_defines.h" |
#include "media/cast/net/udp_transport.h" |
+#include "net/base/net_errors.h" |
#include "net/base/net_util.h" |
namespace media { |
@@ -26,6 +27,17 @@ int LookupOptionWithDefault(const base::DictionaryValue& options, |
} |
}; |
+// See header file for what these mean. |
+const char kOptionPacerTargetBurstSize[] = "pacer_target_burst_size"; |
+const char kOptionPacerMaxBurstSize[] = "pacer_max_burst_size"; |
+const char kOptionDscp[] = "DSCP"; |
+const char kOptionWifiDisableScan[] = "disable_wifi_scan"; |
+const char kOptionWifiMediaStreamingMode[] = "media_streaming_mode"; |
+ |
+// 802.11n is the most commonly used network for cast streaming. |
+// The maximum MAC level data unit is 64KB as defined in the standard. |
+const int k802dot11nMaxAMPDUSize = 65536; |
miu
2014/10/15 21:20:20
This will lower the default setting on Linux. Are
|
+ |
} // namespace |
scoped_ptr<CastTransportSender> CastTransportSender::Create( |
@@ -73,10 +85,10 @@ CastTransportSenderImpl::CastTransportSenderImpl( |
remote_end_point, |
status_callback)), |
pacer_(LookupOptionWithDefault(*options.get(), |
- "pacer_target_burst_size", |
+ kOptionPacerTargetBurstSize, |
kTargetBurstSize), |
LookupOptionWithDefault(*options.get(), |
- "pacer_max_burst_size", |
+ kOptionPacerMaxBurstSize, |
kMaxBurstSize), |
clock, |
&logging_, |
@@ -98,7 +110,7 @@ CastTransportSenderImpl::CastTransportSenderImpl( |
raw_events_callback_interval); |
} |
if (transport_) { |
- if (options->HasKey("DSCP")) { |
+ if (options->HasKey(kOptionDscp)) { |
// The default DSCP value for cast is AF41. Which gives it a higher |
// priority over other traffic. |
transport_->SetDscp(net::DSCP_AF41); |
@@ -106,11 +118,22 @@ CastTransportSenderImpl::CastTransportSenderImpl( |
transport_->StartReceiving( |
base::Bind(&CastTransportSenderImpl::OnReceivedPacket, |
weak_factory_.GetWeakPtr())); |
+ |
+ // Socket send buffer size needs to be at least greater than one burst size |
+ // and greater than MAC protocol data unit. We use the MPDU value of |
+ // 802.11n since it is the most commonly used network for Cast Streaming. |
+ int send_buffer_size = std::max<int32>( |
miu
2014/10/15 21:20:21
int, not int32 here.
Alpha Left Google
2014/10/15 23:07:26
Done.
|
+ k802dot11nMaxAMPDUSize, |
+ LookupOptionWithDefault(*options.get(), kOptionPacerMaxBurstSize, |
+ kMaxBurstSize) * kMaxIpPacketSize); |
+ if (transport_->SetSendBufferSize(send_buffer_size) != net::OK) { |
miu
2014/10/15 21:20:21
Please make this a ctor argument to UdpTransport (
Alpha Left Google
2014/10/15 23:07:26
Done.
|
+ VLOG(1) << "Cannot set send buffer size."; |
+ } |
int wifi_options = 0; |
- if (options->HasKey("disable_wifi_scan")) { |
+ if (options->HasKey(kOptionWifiDisableScan)) { |
wifi_options |= net::WIFI_OPTIONS_DISABLE_SCAN; |
} |
- if (options->HasKey("media_streaming_mode")) { |
+ if (options->HasKey(kOptionWifiMediaStreamingMode)) { |
wifi_options |= net::WIFI_OPTIONS_MEDIA_STREAMING_MODE; |
} |
if (wifi_options) { |