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

Side by Side Diff: media/audio/audio_low_latency_input_output_unittest.cc

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added implementation for ALSA. Created 4 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // buffer_->set_forward_capacity(2 * buffer_->forward_capacity()); 218 // buffer_->set_forward_capacity(2 * buffer_->forward_capacity());
219 // buffer_->Clear(); 219 // buffer_->Clear();
220 // } 220 // }
221 } 221 }
222 222
223 void OnError(AudioInputStream* stream) override {} 223 void OnError(AudioInputStream* stream) override {}
224 224
225 // AudioOutputStream::AudioSourceCallback. 225 // AudioOutputStream::AudioSourceCallback.
226 int OnMoreData(AudioBus* audio_bus, 226 int OnMoreData(AudioBus* audio_bus,
227 uint32_t total_bytes_delay, 227 uint32_t total_bytes_delay,
228 uint32_t frames_skipped) override { 228 uint32_t frames_skipped,
229 const AudioTimestamp& timestamp) override {
229 base::AutoLock lock(lock_); 230 base::AutoLock lock(lock_);
230 231
231 // Update one component in the AudioDelayState for the packet 232 // Update one component in the AudioDelayState for the packet
232 // which is about to be played out. 233 // which is about to be played out.
233 if (output_elements_to_write_ < kMaxDelayMeasurements) { 234 if (output_elements_to_write_ < kMaxDelayMeasurements) {
234 delay_states_[output_elements_to_write_].output_delay_ms = 235 delay_states_[output_elements_to_write_].output_delay_ms =
235 BytesToMilliseconds(total_bytes_delay); 236 BytesToMilliseconds(total_bytes_delay);
236 ++output_elements_to_write_; 237 ++output_elements_to_write_;
237 } 238 }
238 239
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 440
440 // All Close() operations that run on the mocked audio thread, 441 // All Close() operations that run on the mocked audio thread,
441 // should be synchronous and not post additional close tasks to 442 // should be synchronous and not post additional close tasks to
442 // mocked the audio thread. Hence, there is no need to call 443 // mocked the audio thread. Hence, there is no need to call
443 // message_loop()->RunUntilIdle() after the Close() methods. 444 // message_loop()->RunUntilIdle() after the Close() methods.
444 aos->Close(); 445 aos->Close();
445 ais->Close(); 446 ais->Close();
446 } 447 }
447 448
448 } // namespace media 449 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698