Index: chrome/browser/media/cast_remoting_sender.cc |
diff --git a/chrome/browser/media/cast_remoting_sender.cc b/chrome/browser/media/cast_remoting_sender.cc |
index 00de02537bbeafe4c4f4ca00c7e7e0e197bb1207..7a55a911404a8c892689330be0856bd08d7a1cfa 100644 |
--- a/chrome/browser/media/cast_remoting_sender.cc |
+++ b/chrome/browser/media/cast_remoting_sender.cc |
@@ -92,7 +92,7 @@ CastRemotingSender::CastRemotingSender( |
latest_acked_frame_id_(media::cast::FrameId::first() - 1), |
duplicate_ack_counter_(0), |
input_queue_discards_remaining_(0), |
- pipe_watcher_(FROM_HERE), |
+ pipe_watcher_(FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL), |
flow_restart_pending_(true), |
weak_factory_(this) { |
// Confirm this constructor is running on the IO BrowserThread. |
@@ -164,10 +164,11 @@ void CastRemotingSender::FindAndBind( |
sender->error_callback_ = error_callback; |
sender->pipe_ = std::move(pipe); |
- sender->pipe_watcher_.Start( |
- sender->pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
- base::Bind(&CastRemotingSender::ProcessInputQueue, |
- base::Unretained(sender))); |
+ sender->pipe_watcher_.Watch(sender->pipe_.get(), |
+ MOJO_HANDLE_SIGNAL_NEW_DATA_READABLE, |
+ base::Bind(&CastRemotingSender::ProcessInputQueue, |
+ base::Unretained(sender))); |
+ sender->pipe_watcher_.ArmOrNotify(); |
sender->binding_.Bind(std::move(request)); |
sender->binding_.set_connection_error_handler(sender->error_callback_); |
} |
@@ -378,8 +379,10 @@ bool CastRemotingSender::TryConsumeDataChunk(uint32_t offset, uint32_t size, |
MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE); |
if (result == MOJO_RESULT_OK) |
return true; // Successfully discarded data. |
- if (result == MOJO_RESULT_OUT_OF_RANGE) |
+ if (result == MOJO_RESULT_OUT_OF_RANGE) { |
+ pipe_watcher_.ArmOrNotify(); |
return false; // Retry later. |
+ } |
LOG(ERROR) << SENDER_SSRC |
<< "Unexpected result when discarding from data pipe (" |
<< result << ')'; |
@@ -395,8 +398,10 @@ bool CastRemotingSender::TryConsumeDataChunk(uint32_t offset, uint32_t size, |
MOJO_READ_DATA_FLAG_ALL_OR_NONE); |
if (result == MOJO_RESULT_OK) |
return true; // Successfully consumed data. |
- if (result == MOJO_RESULT_OUT_OF_RANGE) |
+ if (result == MOJO_RESULT_OUT_OF_RANGE) { |
+ pipe_watcher_.ArmOrNotify(); |
return false; // Retry later. |
+ } |
LOG(ERROR) |
<< SENDER_SSRC << "Read from data pipe failed (" << result << ')'; |
} while (false); |