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

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

Issue 1538463002: Revert of Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 StopStream(); 99 StopStream();
100 if (stream_) 100 if (stream_)
101 stream_->Close(); 101 stream_->Close();
102 stream_ = NULL; 102 stream_ = NULL;
103 stop_closure_.Cancel(); 103 stop_closure_.Cancel();
104 } 104 }
105 105
106 private: 106 private:
107 // AudioOutputStream::AudioSourceCallback overrides: 107 // AudioOutputStream::AudioSourceCallback overrides:
108 // Following methods could be called from *ANY* thread. 108 // Following methods could be called from *ANY* thread.
109 int OnMoreData(AudioBus* dest, 109 int OnMoreData(AudioBus* dest, uint32 /* total_bytes_delay */) override {
110 uint32_t /* total_bytes_delay */,
111 uint32_t /* frames_skipped */) override {
112 base::AutoLock al(state_lock_); 110 base::AutoLock al(state_lock_);
113 size_t bytes_written = 0; 111 size_t bytes_written = 0;
114 112
115 if (wav_audio_->AtEnd(cursor_) || 113 if (wav_audio_->AtEnd(cursor_) ||
116 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { 114 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) {
117 if (delayed_stop_posted_) 115 if (delayed_stop_posted_)
118 return 0; 116 return 0;
119 delayed_stop_posted_ = true; 117 delayed_stop_posted_ = true;
120 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( 118 AudioManager::Get()->GetTaskRunner()->PostDelayedTask(
121 FROM_HERE, 119 FROM_HERE,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 g_observer_for_testing = observer; 236 g_observer_for_testing = observer;
239 } 237 }
240 238
241 // static 239 // static
242 void AudioStreamHandler::SetAudioSourceForTesting( 240 void AudioStreamHandler::SetAudioSourceForTesting(
243 AudioOutputStream::AudioSourceCallback* source) { 241 AudioOutputStream::AudioSourceCallback* source) {
244 g_audio_source_for_testing = source; 242 g_audio_source_for_testing = source;
245 } 243 }
246 244
247 } // namespace media 245 } // 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