summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 15:55:08 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-17 15:55:08 +0000
commitcb8c383d19dafbfb404c57da6627464652e2cb7e (patch)
treef58c83549b5ba92ec84f4b1e189cf5516be1006a
parent326ea61e58b51329631b853b3c46fadc8b085708 (diff)
downloadchromium_src-cb8c383d19dafbfb404c57da6627464652e2cb7e.zip
chromium_src-cb8c383d19dafbfb404c57da6627464652e2cb7e.tar.gz
chromium_src-cb8c383d19dafbfb404c57da6627464652e2cb7e.tar.bz2
Don't call AudioInputIPCImpl::CloseStream unless we called CreateStream.
If the PepperPlatformAudioInputImpl is destroyed between the time it has been created and the time it has been fully intialized, we may create an AudioInputMessageFilter but not call CreateStream on it. During destruction we call CloseStream but this should only be called after CreateStream has been called. This ensures we don't call CloseStream prematurely. BUG=249335 R=yzshen@chromium.org Review URL: https://codereview.chromium.org/17100006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206730 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/renderer/pepper/pepper_platform_audio_input_impl.cc8
-rw-r--r--content/renderer/pepper/pepper_platform_audio_input_impl.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.cc b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
index 6c0daf9..55b7e6a 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.cc
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.cc
@@ -128,7 +128,8 @@ PepperPlatformAudioInputImpl::~PepperPlatformAudioInputImpl() {
PepperPlatformAudioInputImpl::PepperPlatformAudioInputImpl()
: client_(NULL),
- main_message_loop_proxy_(base::MessageLoopProxy::current()) {
+ main_message_loop_proxy_(base::MessageLoopProxy::current()),
+ create_stream_sent_(false) {
}
bool PepperPlatformAudioInputImpl::Initialize(
@@ -172,6 +173,7 @@ void PepperPlatformAudioInputImpl::InitializeOnIOThread(int session_id) {
return;
// We will be notified by OnStreamCreated().
+ create_stream_sent_ = true;
ipc_->CreateStream(this, session_id, params_, false, 1);
}
@@ -188,10 +190,10 @@ void PepperPlatformAudioInputImpl::StopCaptureOnIOThread() {
BelongsToCurrentThread());
// TODO(yzshen): We cannot re-start capturing if the stream is closed.
- if (ipc_) {
+ if (ipc_ && create_stream_sent_) {
ipc_->CloseStream();
- ipc_.reset();
}
+ ipc_.reset();
}
void PepperPlatformAudioInputImpl::ShutDownOnIOThread() {
diff --git a/content/renderer/pepper/pepper_platform_audio_input_impl.h b/content/renderer/pepper/pepper_platform_audio_input_impl.h
index 4a32e6d..b2084da 100644
--- a/content/renderer/pepper/pepper_platform_audio_input_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_input_impl.h
@@ -112,6 +112,9 @@ class PepperPlatformAudioInputImpl
// Initialized on the main thread and accessed on the I/O thread afterwards.
media::AudioParameters params_;
+ // Whether we have tried to create an audio stream.
+ bool create_stream_sent_;
+
DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl);
};