Commit 5c1381cb authored by Yuri Wiitala's avatar Yuri Wiitala Committed by Commit Bot

Roll src/third_party/openscreen/src/ d0f315b3f..729798cc3 (7 commits)

Also includes chrome/browser/media/.../chrome_udp_socket changes to
account for openscreen::platform::UdpSocket interface changes.

https://chromium.googlesource.com/openscreen/+log/d0f315b3fac8..729798cc3be6

$ git log d0f315b3f..729798cc3 --date=short --no-merges --format='%ad %ae %s'
2019-10-23 miu Cast Streaming: Receiver tweaks, revealed while working on demo app.
2019-10-23 miu Clean-up/Bug-fix: Move all UdpSocketPosix impl out of public API.
2019-10-22 rwkeane DNS-SD: Constants
2019-10-21 mfoltz [Open Screen] Update README.md
2019-10-21 rwkeane DNS-SD: Class Skeletons
2019-10-21 mfoltz [Open Screen] Add scheduler for linux64_gcc_debug.
2019-10-21 takumif Format TODO URLs as TODO(crbug.com/openscreen/000)

Created with:
  roll-dep src/third_party/openscreen/src

Change-Id: I87faa4377c42e080fb46454911c3a086c6b84eee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1877614Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Commit-Queue: Yuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709712}
parent 09c67587
...@@ -1280,7 +1280,7 @@ deps = { ...@@ -1280,7 +1280,7 @@ deps = {
Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + '6f26bce0b1c4e8ce0e13332f7c0083788def5fdf', Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + '6f26bce0b1c4e8ce0e13332f7c0083788def5fdf',
'src/third_party/openscreen/src': 'src/third_party/openscreen/src':
Var('chromium_git') + '/openscreen' + '@' + 'd0f315b3fac883c1e34c1ea2d768118efeffb3bc', Var('chromium_git') + '/openscreen' + '@' + '729798cc3be6c945eb7ec4b3cf10e027397b6ca7',
'src/third_party/openxr/src': { 'src/third_party/openxr/src': {
'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '46d7cb392019e934e2944bdd317be8ed5176b3f2', 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '46d7cb392019e934e2944bdd317be8ed5176b3f2',
......
...@@ -43,7 +43,7 @@ ErrorOr<UdpSocketUniquePtr> UdpSocket::Create( ...@@ -43,7 +43,7 @@ ErrorOr<UdpSocketUniquePtr> UdpSocket::Create(
return ErrorOr<UdpSocketUniquePtr>( return ErrorOr<UdpSocketUniquePtr>(
std::make_unique<media_router::ChromeUdpSocket>( std::make_unique<media_router::ChromeUdpSocket>(
task_runner, client, local_endpoint, std::move(socket), client, local_endpoint, std::move(socket),
std::move(pending_listener))); std::move(pending_listener)));
} }
...@@ -129,13 +129,11 @@ const IPEndpoint ToOpenScreenEndpoint(const net::IPEndPoint& endpoint) { ...@@ -129,13 +129,11 @@ const IPEndpoint ToOpenScreenEndpoint(const net::IPEndPoint& endpoint) {
} // namespace } // namespace
ChromeUdpSocket::ChromeUdpSocket( ChromeUdpSocket::ChromeUdpSocket(
TaskRunner* task_runner,
Client* client, Client* client,
const IPEndpoint& local_endpoint, const IPEndpoint& local_endpoint,
mojo::Remote<network::mojom::UDPSocket> udp_socket, mojo::Remote<network::mojom::UDPSocket> udp_socket,
mojo::PendingReceiver<network::mojom::UDPSocketListener> pending_listener) mojo::PendingReceiver<network::mojom::UDPSocketListener> pending_listener)
: client_(client),
: UdpSocket(task_runner, client),
local_endpoint_(local_endpoint), local_endpoint_(local_endpoint),
udp_socket_(std::move(udp_socket)), udp_socket_(std::move(udp_socket)),
pending_listener_(std::move(pending_listener)) {} pending_listener_(std::move(pending_listener)) {}
...@@ -199,8 +197,12 @@ void ChromeUdpSocket::OnReceived( ...@@ -199,8 +197,12 @@ void ChromeUdpSocket::OnReceived(
int32_t net_result, int32_t net_result,
const base::Optional<net::IPEndPoint>& source_endpoint, const base::Optional<net::IPEndPoint>& source_endpoint,
base::Optional<base::span<const uint8_t>> data) { base::Optional<base::span<const uint8_t>> data) {
if (!client_) {
return; // Ignore if there's no Client to receive the result.
}
if (net_result != net::OK) { if (net_result != net::OK) {
OnRead(Error::Code::kSocketReadFailure); client_->OnRead(this, Error::Code::kSocketReadFailure);
} else if (data) { } else if (data) {
// TODO(jophba): fixup when UdpPacket provides a data copy constructor. // TODO(jophba): fixup when UdpPacket provides a data copy constructor.
UdpPacket packet; UdpPacket packet;
...@@ -211,7 +213,7 @@ void ChromeUdpSocket::OnReceived( ...@@ -211,7 +213,7 @@ void ChromeUdpSocket::OnReceived(
if (source_endpoint) { if (source_endpoint) {
packet.set_source(ToOpenScreenEndpoint(source_endpoint.value())); packet.set_source(ToOpenScreenEndpoint(source_endpoint.value()));
} }
OnRead(std::move(packet)); client_->OnRead(this, std::move(packet));
} }
udp_socket_->ReceiveMore(1); udp_socket_->ReceiveMore(1);
...@@ -221,14 +223,21 @@ void ChromeUdpSocket::BindCallback( ...@@ -221,14 +223,21 @@ void ChromeUdpSocket::BindCallback(
int32_t result, int32_t result,
const base::Optional<net::IPEndPoint>& address) { const base::Optional<net::IPEndPoint>& address) {
if (result != net::OK) { if (result != net::OK) {
OnError(Error(Error::Code::kSocketBindFailure, net::ErrorToString(result))); if (client_) {
client_->OnError(this, Error(Error::Code::kSocketBindFailure,
net::ErrorToString(result)));
}
return; return;
} }
// This is an approximate value for number of packets, and may need to be // Enable packet receives only if there is a Client to dispatch them to.
// adjusted when we have real world data. if (client_) {
constexpr int kNumPacketsReadyFor = 30; // This is an approximate value for number of packets, and may need to be
udp_socket_->ReceiveMore(kNumPacketsReadyFor); // adjusted when we have real world data.
constexpr int kNumPacketsReadyFor = 30;
udp_socket_->ReceiveMore(kNumPacketsReadyFor);
}
if (address) { if (address) {
local_endpoint_ = ToOpenScreenEndpoint(address.value()); local_endpoint_ = ToOpenScreenEndpoint(address.value());
if (pending_listener_.is_valid()) { if (pending_listener_.is_valid()) {
...@@ -238,15 +247,16 @@ void ChromeUdpSocket::BindCallback( ...@@ -238,15 +247,16 @@ void ChromeUdpSocket::BindCallback(
} }
void ChromeUdpSocket::JoinGroupCallback(int32_t result) { void ChromeUdpSocket::JoinGroupCallback(int32_t result) {
if (result != net::OK) { if (result != net::OK && client_) {
OnError(Error(Error::Code::kSocketOptionSettingFailure, client_->OnError(this, Error(Error::Code::kSocketOptionSettingFailure,
net::ErrorToString(result))); net::ErrorToString(result)));
} }
} }
void ChromeUdpSocket::SendCallback(int32_t result) { void ChromeUdpSocket::SendCallback(int32_t result) {
if (result != net::OK) { if (result != net::OK && client_) {
OnError(Error(Error::Code::kSocketSendFailure, net::ErrorToString(result))); client_->OnSendError(this, Error(Error::Code::kSocketSendFailure,
net::ErrorToString(result)));
} }
} }
......
...@@ -24,8 +24,7 @@ namespace media_router { ...@@ -24,8 +24,7 @@ namespace media_router {
class ChromeUdpSocket : public openscreen::platform::UdpSocket, class ChromeUdpSocket : public openscreen::platform::UdpSocket,
network::mojom::UDPSocketListener { network::mojom::UDPSocketListener {
public: public:
ChromeUdpSocket(openscreen::platform::TaskRunner* task_runner, ChromeUdpSocket(Client* client,
Client* client,
const openscreen::IPEndpoint& local_endpoint, const openscreen::IPEndpoint& local_endpoint,
mojo::Remote<network::mojom::UDPSocket> udp_socket, mojo::Remote<network::mojom::UDPSocket> udp_socket,
mojo::PendingReceiver<network::mojom::UDPSocketListener> mojo::PendingReceiver<network::mojom::UDPSocketListener>
...@@ -58,6 +57,9 @@ class ChromeUdpSocket : public openscreen::platform::UdpSocket, ...@@ -58,6 +57,9 @@ class ChromeUdpSocket : public openscreen::platform::UdpSocket,
void JoinGroupCallback(int32_t result); void JoinGroupCallback(int32_t result);
void SendCallback(int32_t result); void SendCallback(int32_t result);
// Note: This can be null, per UdpSocket API header comments.
Client* const client_;
// The local endpoint can change as a result of bind calls. // The local endpoint can change as a result of bind calls.
openscreen::IPEndpoint local_endpoint_; openscreen::IPEndpoint local_endpoint_;
mojo::Remote<network::mojom::UDPSocket> udp_socket_; mojo::Remote<network::mojom::UDPSocket> udp_socket_;
......
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