Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2795)

Unified Diff: media/cast/transport/transport/udp_transport.cc

Issue 268983002: Revert of Cast: Fix two video freezing problems (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/transport/transport/udp_transport.h ('k') | media/cast/transport/transport_audio_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/transport/transport/udp_transport.cc
diff --git a/media/cast/transport/transport/udp_transport.cc b/media/cast/transport/transport/udp_transport.cc
index bcce4f72f3172d1764e5d588cb880ae093908827..578b9593e9a6bd8333bb78ad42b3a590acd0edee 100644
--- a/media/cast/transport/transport/udp_transport.cc
+++ b/media/cast/transport/transport/udp_transport.cc
@@ -52,7 +52,6 @@
net_log,
net::NetLog::Source())),
send_pending_(false),
- receive_pending_(false),
client_connected_(false),
status_callback_(status_callback),
weak_factory_(this) {
@@ -85,18 +84,7 @@
NOTREACHED() << "Either local or remote address has to be defined.";
}
- ScheduleReceiveNextPacket();
-}
-
-void UdpTransport::ScheduleReceiveNextPacket() {
- DCHECK(io_thread_proxy_->RunsTasksOnCurrentThread());
- if (!packet_receiver_.is_null() && !receive_pending_) {
- receive_pending_ = true;
- io_thread_proxy_->PostTask(FROM_HERE,
- base::Bind(&UdpTransport::ReceiveNextPacket,
- weak_factory_.GetWeakPtr(),
- net::ERR_IO_PENDING));
- }
+ ReceiveNextPacket(net::ERR_IO_PENDING);
}
void UdpTransport::ReceiveNextPacket(int length_or_status) {
@@ -116,18 +104,16 @@
&recv_addr_,
base::Bind(&UdpTransport::ReceiveNextPacket,
weak_factory_.GetWeakPtr()));
- if (length_or_status == net::ERR_IO_PENDING) {
- receive_pending_ = true;
+ if (length_or_status == net::ERR_IO_PENDING)
return;
- }
}
// Note: At this point, either a packet is ready or an error has occurred.
+
if (length_or_status < 0) {
VLOG(1) << "Failed to receive packet: Status code is "
- << length_or_status;
+ << length_or_status << ". Stop receiving packets.";
status_callback_.Run(TRANSPORT_SOCKET_ERROR);
- receive_pending_ = false;
return;
}
@@ -195,8 +181,6 @@
status_callback_.Run(TRANSPORT_SOCKET_ERROR);
return true;
} else {
- // Successful send, re-start reading if needed.
- ScheduleReceiveNextPacket();
return true;
}
}
@@ -211,9 +195,6 @@
if (result < 0) {
LOG(ERROR) << "Failed to send packet: " << result << ".";
status_callback_.Run(TRANSPORT_SOCKET_ERROR);
- } else {
- // Successful send, re-start reading if needed.
- ScheduleReceiveNextPacket();
}
if (!cb.is_null()) {
« no previous file with comments | « media/cast/transport/transport/udp_transport.h ('k') | media/cast/transport/transport_audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698