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

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

Issue 623263003: replace OVERRIDE and FINAL with override and final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « media/audio/simple_sources.h ('k') | media/audio/sounds/audio_stream_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 uint32 /* total_bytes_delay */) 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,
119 stop_closure_.callback(), 119 stop_closure_.callback(),
120 base::TimeDelta::FromMilliseconds(kKeepAliveMs)); 120 base::TimeDelta::FromMilliseconds(kKeepAliveMs));
121 return 0; 121 return 0;
122 } 122 }
123 cursor_ += bytes_written; 123 cursor_ += bytes_written;
124 return dest->frames(); 124 return dest->frames();
125 } 125 }
126 126
127 virtual void OnError(AudioOutputStream* /* stream */) OVERRIDE { 127 virtual void OnError(AudioOutputStream* /* stream */) override {
128 LOG(ERROR) << "Error during system sound reproduction."; 128 LOG(ERROR) << "Error during system sound reproduction.";
129 } 129 }
130 130
131 void StopStream() { 131 void StopStream() {
132 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); 132 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
133 133
134 if (stream_ && started_) { 134 if (stream_ && started_) {
135 // Do not hold the |state_lock_| while stopping the output stream. 135 // Do not hold the |state_lock_| while stopping the output stream.
136 stream_->Stop(); 136 stream_->Stop();
137 if (g_observer_for_testing) 137 if (g_observer_for_testing)
(...skipping 72 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.h ('k') | media/audio/sounds/audio_stream_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698