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

Side by Side Diff: media/audio/sounds/audio_stream_handler.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix audio muter build buster. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/sounds/audio_stream_handler.h" 5 #include "media/audio/sounds/audio_stream_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/cancelable_callback.h" 9 #include "base/cancelable_callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (stream_) 98 if (stream_)
99 stream_->Close(); 99 stream_->Close();
100 stream_ = NULL; 100 stream_ = NULL;
101 stop_closure_.Cancel(); 101 stop_closure_.Cancel();
102 } 102 }
103 103
104 private: 104 private:
105 // AudioOutputStream::AudioSourceCallback overrides: 105 // AudioOutputStream::AudioSourceCallback overrides:
106 // Following methods could be called from *ANY* thread. 106 // Following methods could be called from *ANY* thread.
107 virtual int OnMoreData(AudioBus* dest, 107 virtual int OnMoreData(AudioBus* dest,
108 AudioBuffersState /* state */) OVERRIDE { 108 uint32 /* total_bytes_delay */) OVERRIDE {
109 base::AutoLock al(state_lock_); 109 base::AutoLock al(state_lock_);
110 size_t bytes_written = 0; 110 size_t bytes_written = 0;
111 111
112 if (wav_audio_.AtEnd(cursor_) || 112 if (wav_audio_.AtEnd(cursor_) ||
113 !wav_audio_.CopyTo(dest, cursor_, &bytes_written)) { 113 !wav_audio_.CopyTo(dest, cursor_, &bytes_written)) {
114 if (delayed_stop_posted_) 114 if (delayed_stop_posted_)
115 return 0; 115 return 0;
116 delayed_stop_posted_ = true; 116 delayed_stop_posted_ = true;
117 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( 117 AudioManager::Get()->GetTaskRunner()->PostDelayedTask(
118 FROM_HERE, 118 FROM_HERE,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 g_observer_for_testing = observer; 210 g_observer_for_testing = observer;
211 } 211 }
212 212
213 // static 213 // static
214 void AudioStreamHandler::SetAudioSourceForTesting( 214 void AudioStreamHandler::SetAudioSourceForTesting(
215 AudioOutputStream::AudioSourceCallback* source) { 215 AudioOutputStream::AudioSourceCallback* source) {
216 g_audio_source_for_testing = source; 216 g_audio_source_for_testing = source;
217 } 217 }
218 218
219 } // namespace media 219 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/simple_sources_unittest.cc ('k') | media/audio/virtual_audio_input_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698