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

Unified Diff: content/browser/renderer_host/media/audio_sync_reader.cc

Issue 8229013: Fix problem when we did not play beginning of HTML5 audio stream in low latency mode. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 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 | « content/browser/renderer_host/media/audio_sync_reader.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/audio_sync_reader.cc
===================================================================
--- content/browser/renderer_host/media/audio_sync_reader.cc (revision 104976)
+++ content/browser/renderer_host/media/audio_sync_reader.cc (working copy)
@@ -21,8 +21,21 @@
AudioSyncReader::~AudioSyncReader() {
}
+bool AudioSyncReader::DataReady() {
+ return !media::IsUnknownDataSize(
+ shared_memory_,
+ media::PacketSizeSizeInBytes(shared_memory_->created_size()));
+}
+
// media::AudioOutputController::SyncReader implementations.
void AudioSyncReader::UpdatePendingBytes(uint32 bytes) {
+ if (bytes != static_cast<uint32>(media::AudioOutputController::kPauseMark)) {
+ // Store unknown length of data into buffer, so we later
+ // can find out if data became available.
+ media::SetUnknownDataSize(
+ shared_memory_,
+ media::PacketSizeSizeInBytes(shared_memory_->created_size()));
+ }
socket_->Send(&bytes, sizeof(bytes));
}
@@ -38,7 +51,7 @@
// Optimization: if renderer is "new" one that writes length of data we can
// stop yielding the moment length is written -- not ideal solution,
// but better than nothing.
- while (media::IsUnknownDataSize(shared_memory_, max_size) &&
+ while (!DataReady() &&
((base::Time::Now() - previous_call_time_).InMilliseconds() <
kMinIntervalBetweenReadCallsInMs)) {
base::PlatformThread::YieldCurrentThread();
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698