| OLD | NEW |
| 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 // Creates an output stream based on the ALSA PCM interface. | 5 // Creates an output stream based on the ALSA PCM interface. |
| 6 // | 6 // |
| 7 // On device write failure, the stream will move itself to an invalid state. | 7 // On device write failure, the stream will move itself to an invalid state. |
| 8 // No more data will be pulled from the data source, or written to the device. | 8 // No more data will be pulled from the data source, or written to the device. |
| 9 // All calls to public API functions will either no-op themselves, or return an | 9 // All calls to public API functions will either no-op themselves, or return an |
| 10 // error if possible. Specifically, If the stream is in an error state, Open() | 10 // error if possible. Specifically, If the stream is in an error state, Open() |
| 11 // will return false, and Start() will call OnError() immediately on the | 11 // will return false, and Start() will call OnError() immediately on the |
| 12 // provided callback. | 12 // provided callback. |
| 13 // | 13 // |
| 14 // If the stream is successfully opened, Close() must be called. After Close | 14 // If the stream is successfully opened, Close() must be called. After Close |
| 15 // has been called, the object should be regarded as deleted and not touched. | 15 // has been called, the object should be regarded as deleted and not touched. |
| 16 // | 16 // |
| 17 // AlsaPcmOutputStream is a single threaded class that should only be used from | 17 // AlsaPcmOutputStream is a single threaded class that should only be used from |
| 18 // the audio thread. When modifying the code in this class, please read the | 18 // the audio thread. When modifying the code in this class, please read the |
| 19 // threading assumptions at the top of the implementation. | 19 // threading assumptions at the top of the implementation. |
| 20 | 20 |
| 21 #ifndef MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ | 21 #ifndef MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ |
| 22 #define MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ | 22 #define MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ |
| 23 | 23 |
| 24 #include <alsa/asoundlib.h> | 24 #include <alsa/asoundlib.h> |
| 25 | 25 |
| 26 #include <string> | 26 #include <string> |
| 27 | 27 |
| 28 #include "base/compiler_specific.h" | 28 #include "base/compiler_specific.h" |
| 29 #include "base/gtest_prod_util.h" | 29 #include "base/gtest_prod_util.h" |
| 30 #include "base/macros.h" |
| 30 #include "base/memory/scoped_ptr.h" | 31 #include "base/memory/scoped_ptr.h" |
| 31 #include "base/memory/weak_ptr.h" | 32 #include "base/memory/weak_ptr.h" |
| 32 #include "base/time/time.h" | 33 #include "base/time/time.h" |
| 33 #include "media/audio/audio_io.h" | 34 #include "media/audio/audio_io.h" |
| 34 #include "media/audio/audio_parameters.h" | 35 #include "media/audio/audio_parameters.h" |
| 35 | 36 |
| 36 namespace base { | 37 namespace base { |
| 37 class MessageLoop; | 38 class MessageLoop; |
| 38 } | 39 } |
| 39 | 40 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 221 |
| 221 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); | 222 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); |
| 222 }; | 223 }; |
| 223 | 224 |
| 224 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, | 225 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, |
| 225 AlsaPcmOutputStream::InternalState); | 226 AlsaPcmOutputStream::InternalState); |
| 226 | 227 |
| 227 }; // namespace media | 228 }; // namespace media |
| 228 | 229 |
| 229 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ | 230 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ |
| OLD | NEW |