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

Unified Diff: media/mojo/services/mojo_audio_decoder_service.cc

Issue 1982883003: Handle unexpected MojoWait() result in MojoAudioDecoderService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 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/mojo/services/mojo_audio_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_audio_decoder_service.cc
diff --git a/media/mojo/services/mojo_audio_decoder_service.cc b/media/mojo/services/mojo_audio_decoder_service.cc
index 91d0b9bf8b479dff3c424076f24f208fd43ff4a1..64ed7d56358c6b7eb813e5ba2717d626dd10e522 100644
--- a/media/mojo/services/mojo_audio_decoder_service.cc
+++ b/media/mojo/services/mojo_audio_decoder_service.cc
@@ -153,27 +153,27 @@ scoped_refptr<DecoderBuffer> MojoAudioDecoderService::ReadDecoderBuffer(
// Wait for the data to become available in the DataPipe.
MojoHandleSignalsState state;
- CHECK_EQ(MOJO_RESULT_OK,
- MojoWait(consumer_handle_.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
- MOJO_DEADLINE_INDEFINITE, &state));
+ MojoResult result =
+ MojoWait(consumer_handle_.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+ MOJO_DEADLINE_INDEFINITE, &state);
- if (state.satisfied_signals & MOJO_HANDLE_SIGNAL_PEER_CLOSED) {
+ if (result != MOJO_RESULT_OK) {
DVLOG(1) << __FUNCTION__ << ": Peer closed the data pipe";
- return scoped_refptr<DecoderBuffer>();
+ return nullptr;
}
- CHECK_EQ(MOJO_HANDLE_SIGNAL_READABLE,
- state.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE);
-
// Read the inner data for the DecoderBuffer from our DataPipe.
- uint32_t bytes_to_read =
- base::checked_cast<uint32_t>(media_buffer->data_size());
- DCHECK_GT(bytes_to_read, 0u);
- uint32_t bytes_read = bytes_to_read;
- CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(),
- &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE),
- MOJO_RESULT_OK);
- CHECK_EQ(bytes_to_read, bytes_read);
+ uint32_t data_size = static_cast<uint32_t>(media_buffer->data_size());
+ DCHECK_EQ(data_size, buffer->data_size);
+ DCHECK_GT(data_size, 0u);
+
+ uint32_t bytes_read = data_size;
+ result = ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(),
+ &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE);
+ if (result != MOJO_RESULT_OK || bytes_read != data_size) {
+ DVLOG(1) << __FUNCTION__ << ": reading from pipe failed";
+ return nullptr;
+ }
return media_buffer;
}
« no previous file with comments | « media/mojo/services/mojo_audio_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698