diff options
author | ihf@chromium.org <ihf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 01:44:13 +0000 |
---|---|---|
committer | ihf@chromium.org <ihf@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 01:44:13 +0000 |
commit | 028b90f6113fbb0415075d2292b442b03a9f9855 (patch) | |
tree | 46f82b7fe5f782a1e9b648eb2c0a8f1bcc61fbe3 /ppapi/shared_impl | |
parent | cf314aad7e048e51c16cc7e7d291be3fdfcab808 (diff) | |
download | chromium_src-028b90f6113fbb0415075d2292b442b03a9f9855.zip chromium_src-028b90f6113fbb0415075d2292b442b03a9f9855.tar.gz chromium_src-028b90f6113fbb0415075d2292b442b03a9f9855.tar.bz2 |
Ppapi audio: don't terminate thread on all negative pending_data.
pending_data should be used exclusively for synchronisation purposes, and not
as an indication of the fill level of the playback buffer. Change condition
to only quit on kPauseMark.
BUG=chromium-os:26151
TEST=Stressed as described in bug and watched Lumpy survive negative numbers.
Review URL: https://chromiumcodereview.appspot.com/9958093
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r-- | ppapi/shared_impl/ppb_audio_shared.cc | 6 | ||||
-rw-r--r-- | ppapi/shared_impl/ppb_audio_shared.h | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc index 5385106..63bd471 100644 --- a/ppapi/shared_impl/ppb_audio_shared.cc +++ b/ppapi/shared_impl/ppb_audio_shared.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,8 @@ namespace ppapi { +const int PPB_Audio_Shared::kPauseMark = -1; + PPB_Audio_Shared::PPB_Audio_Shared() : playing_(false), shared_memory_size_(0), @@ -86,7 +88,7 @@ void PPB_Audio_Shared::Run() { while (sizeof(pending_data) == socket_->Receive(&pending_data, sizeof(pending_data)) && - pending_data >= 0) { + pending_data != kPauseMark) { callback_(buffer, shared_memory_size_, user_data_); } } diff --git a/ppapi/shared_impl/ppb_audio_shared.h b/ppapi/shared_impl/ppb_audio_shared.h index 99f45de..aa06f6a 100644 --- a/ppapi/shared_impl/ppb_audio_shared.h +++ b/ppapi/shared_impl/ppb_audio_shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,6 +25,9 @@ class PPAPI_SHARED_EXPORT PPB_Audio_Shared PPB_Audio_Shared(); virtual ~PPB_Audio_Shared(); + // Keep in sync with media::AudioOutputController::kPauseMark. + static const int kPauseMark; + bool playing() const { return playing_; } // Sets the callback information that the background thread will use. This |