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

Unified Diff: media/audio/pulse/pulse_input.cc

Issue 486603002: Fix the unnecessary sleep when no back to back OnData call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/pulse/pulse_input.cc
diff --git a/media/audio/pulse/pulse_input.cc b/media/audio/pulse/pulse_input.cc
index 4976b5610eda39d309f3a347de448a0ce9e494b2..6c9855e504c568bf47771ae04e6470c5f06ac061 100644
--- a/media/audio/pulse/pulse_input.cc
+++ b/media/audio/pulse/pulse_input.cc
@@ -281,7 +281,10 @@ void PulseAudioInputStream::ReadData() {
hardware_delay += fifo_.GetAvailableFrames() * params_.GetBytesPerFrame();
callback_->OnData(this, audio_bus, hardware_delay, normalized_volume);
- base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(5));
+ // Sleep 5ms to wait until render consumes the data in order to avoid
+ // back to back OnData() method.
+ if (fifo_.available_blocks())
+ base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(5));
}
pa_threaded_mainloop_signal(pa_mainloop_, 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698