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

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

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Pass target playout time to AudioSourceCallback::OnMoreData. Created 4 years, 4 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
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 <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 StopStream(); 102 StopStream();
103 if (stream_) 103 if (stream_)
104 stream_->Close(); 104 stream_->Close();
105 stream_ = NULL; 105 stream_ = NULL;
106 stop_closure_.Cancel(); 106 stop_closure_.Cancel();
107 } 107 }
108 108
109 private: 109 private:
110 // AudioOutputStream::AudioSourceCallback overrides: 110 // AudioOutputStream::AudioSourceCallback overrides:
111 // Following methods could be called from *ANY* thread. 111 // Following methods could be called from *ANY* thread.
112 int OnMoreData(AudioBus* dest, 112 int OnMoreData(base::TimeTicks /* target_playout_time */,
113 uint32_t /* total_bytes_delay */, 113 int /* prior_frames_skipped */,
114 uint32_t /* frames_skipped */) override { 114 AudioBus* dest) override {
115 base::AutoLock al(state_lock_); 115 base::AutoLock al(state_lock_);
116 size_t bytes_written = 0; 116 size_t bytes_written = 0;
117 117
118 if (wav_audio_->AtEnd(cursor_) || 118 if (wav_audio_->AtEnd(cursor_) ||
119 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { 119 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) {
120 if (delayed_stop_posted_) 120 if (delayed_stop_posted_)
121 return 0; 121 return 0;
122 delayed_stop_posted_ = true; 122 delayed_stop_posted_ = true;
123 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( 123 AudioManager::Get()->GetTaskRunner()->PostDelayedTask(
124 FROM_HERE, 124 FROM_HERE,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 g_observer_for_testing = observer; 242 g_observer_for_testing = observer;
243 } 243 }
244 244
245 // static 245 // static
246 void AudioStreamHandler::SetAudioSourceForTesting( 246 void AudioStreamHandler::SetAudioSourceForTesting(
247 AudioOutputStream::AudioSourceCallback* source) { 247 AudioOutputStream::AudioSourceCallback* source) {
248 g_audio_source_for_testing = source; 248 g_audio_source_for_testing = source;
249 } 249 }
250 250
251 } // namespace media 251 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698