diff options
author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 00:32:09 +0000 |
---|---|---|
committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 00:32:09 +0000 |
commit | 55b67c2a6a1ea4846656de82fe2acd1e3d59048a (patch) | |
tree | 5e104103b85175ed53679d43202d6b4f7f55ce41 /content/browser/speech/speech_recognizer_impl.cc | |
parent | 3391a0773921b0539699ad4eab0a409e10194f84 (diff) | |
download | chromium_src-55b67c2a6a1ea4846656de82fe2acd1e3d59048a.zip chromium_src-55b67c2a6a1ea4846656de82fe2acd1e3d59048a.tar.gz chromium_src-55b67c2a6a1ea4846656de82fe2acd1e3d59048a.tar.bz2 |
Speech refactoring: Turned AudioChunk into a refcounted class (CL1.4)
BUG=116954
TEST=Run content_unittests.
Review URL: http://codereview.chromium.org/9861019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognizer_impl.cc')
-rw-r--r-- | content/browser/speech/speech_recognizer_impl.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content/browser/speech/speech_recognizer_impl.cc b/content/browser/speech/speech_recognizer_impl.cc index 2e8cc48..3c15e2e 100644 --- a/content/browser/speech/speech_recognizer_impl.cc +++ b/content/browser/speech/speech_recognizer_impl.cc @@ -211,15 +211,16 @@ void SpeechRecognizerImpl::OnData(AudioInputController* controller, const uint8* data, uint32 size) { if (size == 0) // This could happen when recording stops and is normal. return; - AudioChunk* raw_audio = new AudioChunk(data, static_cast<size_t>(size), - kNumBitsPerAudioSample / 8); + scoped_refptr<AudioChunk> raw_audio( + new AudioChunk(data, + static_cast<size_t>(size), + kNumBitsPerAudioSample / 8)); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&SpeechRecognizerImpl::HandleOnData, this, raw_audio)); } -void SpeechRecognizerImpl::HandleOnData(AudioChunk* raw_audio) { - scoped_ptr<AudioChunk> free_raw_audio_on_return(raw_audio); +void SpeechRecognizerImpl::HandleOnData(scoped_refptr<AudioChunk> raw_audio) { // Check if we are still recording and if not discard this buffer, as // recording might have been stopped after this buffer was posted to the queue // by |OnData|. |