OLD | NEW |
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 "media/audio/audio_output_resampler.h" | 5 #include "media/audio/audio_output_resampler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class OnMoreDataConverter | 22 class OnMoreDataConverter |
23 : public AudioOutputStream::AudioSourceCallback, | 23 : public AudioOutputStream::AudioSourceCallback, |
24 public AudioConverter::InputCallback { | 24 public AudioConverter::InputCallback { |
25 public: | 25 public: |
26 OnMoreDataConverter(const AudioParameters& input_params, | 26 OnMoreDataConverter(const AudioParameters& input_params, |
27 const AudioParameters& output_params); | 27 const AudioParameters& output_params); |
28 ~OnMoreDataConverter() override; | 28 ~OnMoreDataConverter() override; |
29 | 29 |
30 // AudioSourceCallback interface. | 30 // AudioSourceCallback interface. |
31 int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) override; | 31 int OnMoreData(AudioBus* dest, uint32 total_bytes_delay) override; |
| 32 void OnSkippedData(uint32_t frames_skipped) override {} |
32 void OnError(AudioOutputStream* stream) override; | 33 void OnError(AudioOutputStream* stream) override; |
33 | 34 |
34 // Sets |source_callback_|. If this is not a new object, then Stop() must be | 35 // Sets |source_callback_|. If this is not a new object, then Stop() must be |
35 // called before Start(). | 36 // called before Start(). |
36 void Start(AudioOutputStream::AudioSourceCallback* callback); | 37 void Start(AudioOutputStream::AudioSourceCallback* callback); |
37 | 38 |
38 // Clears |source_callback_| and flushes the resampler. | 39 // Clears |source_callback_| and flushes the resampler. |
39 void Stop(); | 40 void Stop(); |
40 | 41 |
41 bool started() const { return source_callback_ != nullptr; } | 42 bool started() const { return source_callback_ != nullptr; } |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 dest->ZeroFramesPartial(frames, dest->frames() - frames); | 398 dest->ZeroFramesPartial(frames, dest->frames() - frames); |
398 return frames > 0 ? 1 : 0; | 399 return frames > 0 ? 1 : 0; |
399 } | 400 } |
400 | 401 |
401 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 402 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
402 error_occurred_ = true; | 403 error_occurred_ = true; |
403 source_callback_->OnError(stream); | 404 source_callback_->OnError(stream); |
404 } | 405 } |
405 | 406 |
406 } // namespace media | 407 } // namespace media |
OLD | NEW |