| 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 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "media/audio/audio_io.h" | 14 #include "media/audio/audio_io.h" |
| 15 #include "media/audio/audio_manager.h" | 15 #include "media/audio/audio_manager.h" |
| 16 #include "media/audio/audio_output_dispatcher_impl.h" | 16 #include "media/audio/audio_output_dispatcher_impl.h" |
| 17 #include "media/base/audio_parameters.h" | 17 #include "media/base/audio_parameters.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| 21 class OnMoreDataConverter; | 21 class OnMoreDataConverter; |
| 22 | 22 |
| 23 // AudioOutputResampler is a browser-side resampling and buffering solution | 23 // AudioOutputResampler is a browser-side resampling and buffering solution |
| 24 // which ensures audio data is always output at given parameters. See the | 24 // which ensures audio data is always output at given parameters. See the |
| 25 // AudioConverter class for details on the conversion process. | 25 // AudioConverter class for details on the conversion process. |
| 26 // | 26 // |
| 27 // AOR works by intercepting the AudioSourceCallback provided to StartStream() | 27 // AOR works by intercepting the AudioSourceCallback provided to StartStream() |
| 28 // and redirecting it through an AudioConverter instance. |total_bytes_delay| | 28 // and redirecting it through an AudioConverter instance. |
| 29 // is adjusted for buffer delay caused by the conversion process. | |
| 30 // | 29 // |
| 31 // AOR will automatically fall back from AUDIO_PCM_LOW_LATENCY to | 30 // AOR will automatically fall back from AUDIO_PCM_LOW_LATENCY to |
| 32 // AUDIO_PCM_LINEAR if the output device fails to open at the requested output | 31 // AUDIO_PCM_LINEAR if the output device fails to open at the requested output |
| 33 // parameters. If opening still fails, it will fallback to AUDIO_FAKE. | 32 // parameters. If opening still fails, it will fallback to AUDIO_FAKE. |
| 34 class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher { | 33 class MEDIA_EXPORT AudioOutputResampler : public AudioOutputDispatcher { |
| 35 public: | 34 public: |
| 36 AudioOutputResampler(AudioManager* audio_manager, | 35 AudioOutputResampler(AudioManager* audio_manager, |
| 37 const AudioParameters& input_params, | 36 const AudioParameters& input_params, |
| 38 const AudioParameters& output_params, | 37 const AudioParameters& output_params, |
| 39 const std::string& output_device_id, | 38 const std::string& output_device_id, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // have been created within |close_delay_|. Without this, audio may be lost | 87 // have been created within |close_delay_|. Without this, audio may be lost |
| 89 // to a fake stream indefinitely for transient errors. | 88 // to a fake stream indefinitely for transient errors. |
| 90 base::Timer reinitialize_timer_; | 89 base::Timer reinitialize_timer_; |
| 91 | 90 |
| 92 DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler); | 91 DISALLOW_COPY_AND_ASSIGN(AudioOutputResampler); |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 } // namespace media | 94 } // namespace media |
| 96 | 95 |
| 97 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ | 96 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_RESAMPLER_H_ |
| OLD | NEW |