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

Unified Diff: media/audio/win/audio_low_latency_output_win.cc

Issue 27181005: Fail out of WASAPI render loop when errors are encountered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix signature. Created 7 years, 2 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/audio/win/audio_low_latency_output_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_low_latency_output_win.cc
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc
index e2c3ca716d6d0c5dcfc171ec5aa4dc36ac909848..c5402faf7c6ac3e6ee5c56db6d21756261bab3fa 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -472,7 +472,7 @@ void WASAPIAudioOutputStream::Run() {
break;
case WAIT_OBJECT_0 + 1:
// |audio_samples_render_event_| has been set.
- RenderAudioFromSource(audio_clock, device_frequency);
+ error = !RenderAudioFromSource(audio_clock, device_frequency);
break;
default:
error = true;
@@ -494,7 +494,7 @@ void WASAPIAudioOutputStream::Run() {
}
}
-void WASAPIAudioOutputStream::RenderAudioFromSource(
+bool WASAPIAudioOutputStream::RenderAudioFromSource(
IAudioClock* audio_clock, UINT64 device_frequency) {
TRACE_EVENT0("audio", "RenderAudioFromSource");
@@ -516,7 +516,7 @@ void WASAPIAudioOutputStream::RenderAudioFromSource(
if (FAILED(hr)) {
DLOG(ERROR) << "Failed to retrieve amount of available space: "
<< std::hex << hr;
- return;
+ return false;
}
} else {
// While the stream is running, the system alternately sends one
@@ -534,7 +534,7 @@ void WASAPIAudioOutputStream::RenderAudioFromSource(
// Check if there is enough available space to fit the packet size
// specified by the client.
if (num_available_frames < packet_size_frames_)
- return;
+ return true;
DLOG_IF(ERROR, num_available_frames % packet_size_frames_ != 0)
<< "Non-perfect timing detected (num_available_frames="
@@ -557,7 +557,7 @@ void WASAPIAudioOutputStream::RenderAudioFromSource(
if (FAILED(hr)) {
DLOG(ERROR) << "Failed to use rendering audio buffer: "
<< std::hex << hr;
- return;
+ return false;
}
// Derive the audio delay which corresponds to the delay between
@@ -615,6 +615,8 @@ void WASAPIAudioOutputStream::RenderAudioFromSource(
num_written_frames_ += packet_size_frames_;
}
+
+ return true;
}
HRESULT WASAPIAudioOutputStream::ExclusiveModeInitialization(
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698